
Bitwiser Object
by Danny Worth
Description
Conditions
Flag Set
Arguments
Bit Flag: | 1 Bit of 32bit value (0-31) |
Value: | Value to test |
Details
Test if a bit within a value is set. eg Bit flag 5 set in 845623: 11001110011100110111 would be true.
Expressions
OR
Arguments
First Value: | First value to perform OR operation against |
Value: | Second value to perform OR operation with |
Returns: | Result integer |
Details
There are 3 OR functions one for each 8/16/32bit.
Merges the bits of the 2 values. For example OR_32( "Bitwiser Object", 2546, 341996 ) would return 344062.
XOR
Arguments
First Value: | First value to perform XOR operation against |
Value: | Second value to perform XOR operation with |
Returns: | Result integer |
Details
There are 3 XOR functions one for each 8/16/32bit.
Toggles the bits of a value where the bits of the 2 overlap. For example XOR_32( "Bitwiser Object", 2546, 341996 ) would return 343582.
AND
Arguments
First Value: | First value to perform AND operation against |
Value: | Second value to perform AND operation with |
Returns: | Result integer |
Details
There are 3 AND functions one for each 8/16/32bit.
Clears the bits of a value where the bits of the 2nd value are not set. For example AND_32( "Bitwiser Object", 2546, 341996 ) would return 480.
NOT
Arguments
Value: | Value to perform NOT operation against |
Returns: | Result integer |
Details
There are 3 NOT functions one for each 8/16/32bit.
Inverts the bits of value. For example NOT_32( "Bitwiser Object", 2546 ) would return -2547.
Rotate Left
Arguments
Value: | Value to perform rotate operation against |
Rotate Amount: | The number of bits to rotate |
Returns: | Result integer |
Details
There are 3 Rotate Left functions one for each 8/16/32bit.
Also known as circular shift, rotate is similar to shift except when the bits move out of bounds they wrap round. For example ROL_32( "Bitwiser Object", 2546, 3 ) would return 20368.
Rotate Right
Arguments
Value: | Value to perform rotate operation against |
Rotate Amount: | The number of bits to rotate |
Returns: | Result integer |
Details
There are 3 Rotate Right functions one for each 8/16/32bit.
Also known as circular shift, rotate is similar to shift except when the bits move out of bounds they wrap round. For example ROR_32( "Bitwiser Object", 2546, 3 ) would return 1073742142.
Shift Left
Arguments
Value: | Value to perform shift operation against |
Shift Amount: | The number of bits to shift |
Returns: | Result integer |
Details
There are 3 Shift Left functions one for each 8/16/32bit.
Moves the bits along in left direction but when the bits move outside of their bounds they are truncated and lost. For example LSH_32( "Bitwiser Object", 2546, 3 ) would return 20368.
Shift Right
Arguments
Value: | Value to perform shift operation against |
Shift Amount: | The number of bits to shift |
Returns: | Result integer |
Details
There are 3 Shift Right functions one for each 8/16/32bit.
Moves the bits along in right direction but when the bits move outside of their bounds they are truncated and lost. For example RSH_32( "Bitwiser Object", 2546, 3 ) would return 318.
Set Bit Flag
Arguments
Value: | Value to set bit on |
Bit: | The number of bit to set (0-31) |
Returns: | Result integer |
Details
Sets the specified bit of a value specified in the Bit argument. For example to set the first bit of Global Value A. Set Global Value A to SetBitFlag( "Bitwiser Object", Global Value A, 0 ).
Clear Bit Flag
Arguments
Value: | Value to clear bit on |
Bit: | The number of bit to clear (0-31) |
Returns: | Result integer |
Details
Clears the specified bit of a value specified in the Bit argument. For example to clear the first bit of Global Value A. Set Global Value A to ClearBitFlag( "Bitwiser Object", Global Value A, 0 ).
Toggle Bit Flag
Arguments
Value: | Value to toggle bit on |
Bit: | The number of bit to toggle (0-31) |
Returns: | Result integer |
Details
Toggles the specified bit of a value specified in the Bit argument. For example to toggle the first bit of Global Value A. Set Global Value A to ToggleBitFlag( "Bitwiser Object", Global Value A, 0 ).
Embed Value
Arguments
Value to embed to: | Value to embed on |
Value to embed: | Value to embed |
Bit offset: | Offset in bits where to place the value |
Bit length: | Length in bits of the value |
Returns: | Result integer |
Details
Embeds a value into another allowing you to store multiple values in 1 integer. For example to embed 2 values 25 and 15 that use 5 bits in Global Value A. Set Global Value A to EmbedValue( "Bitwiser Object", Global Value A, 15, 0, 5 ) then again Set Global Value A to EmbedValue( "Bitwiser Object", Global Value A, 25, 5, 5 ).
Retrieve Embedded Value
Arguments
Value to retrieve from: | Value to retrieve embedded from |
Bit offset: | Offset in bits where to retrieve the value |
Bit length: | Length in bits of the value |
Returns: | Result integer |
Details
Retrieves an embedded value from a value. For example to retrieve 2 embedded values that use 5 bits from Global Value A. Set First Value to RetrieveEmbeddedValue( "Bitwiser Object", Global Value A, 0, 5 ) then again Set Value 2 to EmbedValue( "Bitwiser Object", Global Value A, 5, 5 ).
Get Signed
Arguments
Value: | Value to get signed from |
Returns: | Result integer |
Details
There are 2 Get Signed functions one each for 8/16bit.
Values in Fusion are all 32bit signed even if you retrieve a 8 or 16 bit value. As a result when retrieving an 8 or 16 bit value it returns an equivilent value of an unsigned value (as it is below the limit of a signed 32bit value). Get signed converts a 8/16bit value to signed. For example Signed8( "Bitwiser Object", 255 ) would return -1.