Go Down

Topic: problem with bitshifting (Read 341 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy