<< Click to Display Table of Contents >> Bitmap operations library |
|
bytestoshort(Input1, Input2) - used to pack 2 bytes into the short (Output = Input1<<8+Input2).
bytestoint(Input1, Input2, Input3, Input4) - used to pack 4 bytes into the int (Output = Input1<<24+Input2<<16+Input3<<8+Input4).
bytestofloat(Input1, Input2, Input3, Input4) - used to pack 4 bytes into the float (Output = IntToFloat(Input1<<24+Input2<<16+Input3<<8+Input4)).
bytestolong(Input1, Input2, Input3, Input4, Input5, Input6, Input7, Input8) - used to pack 8 bytes into the long (Output = Input1<<56+Input2<<48+Input3<<40+Input4<<32+Input5<<24+Input6<<16+Input7<<8+Input8).
bytestodouble(Input1, Input2, Input3, Input4, Input5, Input6, Input7, Input8) - used to pack 8 bytes into the double (Output = LongToDouble (Input1<<56+Input2<<48+Input3<<40+Input4<<32+Input5<<24+Input6<<16+Input7<<8+Input8)).
shortstoint(Input1, Input2) - used to pack 2 shorts in the int (Output = Input<<16+Input2).
inttoshort(Input1,Input2) - used to unpack int value into 2 shorts (Output = Input[Input2]).
inttobyte(Input1,Input2) - used to unpack int value into 4 bytes (Output = Input[Input2]).
floattobyte(Input1,Input2) - used to unpack float value into 4 bytes (Output =(int) Input[Input2]).
longtobyte(Input1,Input2) - used to unpack long value into 8 bytes (Output = Input[Input2]).
doubletobyte(Input1,Input2) - used to unpack double value into 8 bytes (Output =(long) 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;