<< Click to Display Table of Contents >> Bitmap operations library |
![]() ![]() ![]() |
bytestoshort(Input1, Input2) - used to pack 2 bytes in the short (Output = Input<<8+Input2).
shorttobyte(Input1, Input2) - used to unpack short value in 2 bytes (Output = Input[Input2]).
shortstoint(Input1, Input2) - used to pack 2 shorts in the int (Output = Input<<16+Input2).
inttoshort(Input1,Input2) - used to unpack int value in 2 shorts (Output = Input[Input2]).
readbit(Input1, Input2) - used to read bit of the input value (Output = Input[Input2]).
setbit(Input1, Input2) - used to set bit of the input value (Output = Input | 1<<Input2).
resetbit(Input1,Input2) - used to reset bit of the input value (Output = Input & ~(1<<Input2)).
Example:
int a = setbit(6, 0);
print(a);
Response:
a = 7;