Code: Select all
variable=variable|1<<7//set bit 7 in variable
Code: Select all
variable=variable&~(1<<7)//clear bit 7 in variable
Code: Select all
variable=variable^1<<7//toggle bit 7 in variable
Code: Select all
output=!output // toggles boolean variable
Code: Select all
if( (a>b&&b<c)||(d!=c&&e<5) ) //if left statment true or right statment true condition is true
Code: Select all
if( a ) //if the a variable is above 0 the if statement is true, not limited by boolean
Code: Select all
a=~a//flips all bits,if a=10100000 a would then = 01011111
Code: Select all
**************32BIT TO 4 BYTES / 4 BYTES TO 32 BIT ******************
(recall_4 = msB recall_1 = lsB) (d = msB a = lsB)
if shifting bytes into a 32 bit number this is the minimum data types
recall_1 is a byte
recall_2 is a byte
recall_3 is a unsigned int
recall_4 is a unsigned int
--> being paranoid recall_4 i use ulong
input_number = 65535
a = input_number & 0xff // byte
b = (input_number >> 8) & 0xff // byte
c = (input_number >> 16) & 0xff // byte
d = (input_number >> 24) & 0xff // byte
output_number = recall_1 + (recall_2 << 8) + (recall_3 << 16) + (recall_4 << 24)