I need to do someing like this
int g
g - 0000000FF
d = 123455
int d
g & d
C# will not let me use the shift cmd on ints . Is it because g is to high Please help me this this matter3
Cisco
I need to do someing like this
int g
g - 0000000FF
d = 123455
int d
g & d
C# will not let me use the shift cmd on ints . Is it because g is to high Please help me this this matter3
Cisco
Bit shifting
MetaMeta
I do not quite follow... what do you want to bit shift When By how much
The code you've got there goes into C# pretty easily:
int g = 0x0000000FF;
int d = 123455;
int result = g & d;
and to do bit shifting on it it is just as easy:
int shifted = result << 8;
The one issue you may be having is if you shift something too far, it overflows or loses data due to the types involved:
short val = 1 << 16; //Gives error: Constant value '65536' cannot be converted to a 'short'
To get around this, you'll need to store the result into a different type:
int val = 1 << 16; //Works