C
clinisbut
What I want to do exactly is this:
I need to split (in a binary way) an Int into two bytes.
Something like:
int value : 340
same value in binary: 101010100
convert this to 2 bytes:
byte1 = 2 ( 1 in binary );
byte2 = 84 ( 1010100 );
I'm trying to do this but does not work:
byte1 = value>>8;
byte2 = value & 0x00FF;
But gives me wrong values... What I'm doing wrong!?
I need to split (in a binary way) an Int into two bytes.
Something like:
int value : 340
same value in binary: 101010100
convert this to 2 bytes:
byte1 = 2 ( 1 in binary );
byte2 = 84 ( 1010100 );
I'm trying to do this but does not work:
byte1 = value>>8;
byte2 = value & 0x00FF;
But gives me wrong values... What I'm doing wrong!?