# Thread: What is wrong my algorithm i ask here becouse i give formula in C ?

1. ## What is wrong my algorithm i ask here becouse i give formula in C ?

What is wrong m algorithm i ask here becouse i give formula in C ?
(x + y % 2) *255
i read this way when x and y are both odd or even code gives 255
but if one is odd and one is even i get 0.
how i must modify this to get it working way what i mean. i try make quick algorithm which gives part of checkerboard using given x and y coordinate. in theory when i get it work i can do bigger broads diving x and y using some number... 2. I'm a tad bit confused on what you're trying to ask. I'm new here, but could you please show your code? 3. Modulo has a higher binding then addition. Your Formula will calculate in this way:
Code:
`(x + (y % 2)) * 255`
If you want that the formula give you the expected result, you should edit the formula like this:
Code:
`((x + y) % 2) * 255` 4. Hi just remember like the "Please Excuse My Dear Aunt Sally" paren, expon, mult,div, add sub, modulo is like division. 5. Originally Posted by Mathacka Hi just remember like the "Please Excuse My Dear Aunt Sally" paren, expon, mult,div, add sub, modulo is like division.
I try but now this dont work way what expect area is arraged alpha,red,green,blue ja again sama etc... and what i expect black white checkerboard.
[C] Non wokring checkerboard - Pastebin.com 6. Are you really sure that the datas are arranged in ARGB? Normaly, the datas in an 32bit image are arranged in the order RGBA. 7. Originally Posted by WoodSTokk Are you really sure that the datas are arranged in ARGB? Normaly, the datas in an 32bit image are arranged in the order RGBA.
problem what i haveis nothing do with this. I try get pic of result.
and these platforms use PowerPC and some even motorla 68000 series (for example 68060). 8. Originally Posted by Vanhapolle problem what i haveis nothing do with this. I try get pic of result.
and these platforms use PowerPC and some even motorla 68000 series (for example 68060).
there is pic which shows using yellow and black (dont care gray background) what is wrong still. variable type can store here
which nothing ischanged 32bit non signed values which i earlier thinked ansver
but looks it not. ANother solution is made code which i still
understand which adds x and y. and checks lowest bitvalue
becouse its then tells its number evenor odd. but such ..........ecks must be learned then.
https://www.flickr.com/photos/65552520@N07/15976327250/ 9. Your formula calculate how many bytes you must seek in the picture for pptry.
At the end, you add pprtx to the result, this is wrong.
You must also multiply pptrx with bytesperpixel!

Test this formula:
Code:
`pptr = (pptrx + pptry * image_w) * bytesperpixel;` Popular pages Recent additions 