Go Down

Topic: problem with bitshifting (Read 326 times) previous topic - next topic

nbuechi

hy, i wanna do a simple bitshifting.
heres my code:



   case 4:
     int zw1 = gameData1 >> 1;
     int zw2 = gameData2 >> 1;
     gameData1 = zw1;
     gameData2 = zw2;

     break;



but it doesnt work. yes, it enters this case, i checked that.


anyone an idea, why this does not work?

in 17 hours is my presentation of my diploma project. so if anyone got a suggestion, i'll be happy for it. ;)

mellis

You can just do:

gameData1 >>= 1;

But what's not working?  What data type is gameData1?

nbuechi

int gameData1 = 255;



just simple.

bens

What you posted looks fine.  I suspect the problem is in part of the code you haven't posted yet.

- Ben

Go Up