Libraries.Compute.BitwiseOperations Documentation

The BitwiseOperations class provides a way for a programmer to conduct bitwise operations on integer values. Common operations include bitwise and, bitwise or, shift operators, exclusive or, and negation. While these operators are provided for convenience, it should be noted that conducting bitwise operations in Quorum is slightly slower than conducting similar operations in other programming languages, due to the fact that such operations are conducted as system functions here. This makes the meaning of the calls more obvious than traditional, but makes them pass through the system plugin architecture, which makes several function calls.

Example Code

use Libraries.Compute.BitwiseOperations
BitwiseOperations ops

integer left = 10
integer right = 25
integer result = ops:And(left, righ

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
And(integer left, integer right)This action provides a bitwise and operation.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
ExclusiveOr(integer left, integer right)This action provides a bitwise exclusive or operation.
GetHashCode()This action gets the hash code for an object.
Negate(integer value)This action provides a bitwise negate operation.
Or(integer left, integer right)This action provides a bitwise or operation.
ShiftLeft(integer value, integer amount)This action provides a bitwise shift left operation, shifting in zeros from the right and discarding the bits shifted off.
ShiftRight(integer value, integer amount)This action provides a bitwise shift right operation.
ShiftRightPositive(integer value, integer amount)This action provides a bitwise shift right operation.

Actions Documentation

And(integer left, integer right)

This action provides a bitwise and operation.

Example Code

use Libraries.Compute.BitwiseOperations
    BitwiseOperations ops

    integer left = 10
    integer right = 25
    integer result = ops:And(left, righ

Parameters

Return

integer:

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

ExclusiveOr(integer left, integer right)

This action provides a bitwise exclusive or operation.

Example Code

use Libraries.Compute.BitwiseOperations
    BitwiseOperations ops

    integer left = 10
    integer right = 25
    integer result = ops:ExclusiveOr(left, righ

Parameters

Return

integer:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode

Return

integer: The integer hash code of the object.

Negate(integer value)

This action provides a bitwise negate operation.

Example Code

use Libraries.Compute.BitwiseOperations
    BitwiseOperations ops

    integer value = 10
    integer result = ops:Negate(valu

Parameters

Return

integer:

Or(integer left, integer right)

This action provides a bitwise or operation.

Example Code

use Libraries.Compute.BitwiseOperations
    BitwiseOperations ops

    integer left = 10
    integer right = 25
    integer result = ops:Or(left, righ

Parameters

Return

integer:

ShiftLeft(integer value, integer amount)

This action provides a bitwise shift left operation, shifting in zeros from the right and discarding the bits shifted off.

Example Code

use Libraries.Compute.BitwiseOperations
    BitwiseOperations ops

    integer value = 10
    integer amount = 3
    integer result = ops:ShiftLeft(value, amoun

Parameters

Return

integer:

ShiftRight(integer value, integer amount)

This action provides a bitwise shift right operation. This version of the operation keeps the sign bit on the left (Sign-propogating right shift) and discards the bits shifted off.

Example Code

use Libraries.Compute.BitwiseOperations
    BitwiseOperations ops

    integer value = 10
    integer amount = 3
    integer result = ops:ShiftRight(value, amoun

Parameters

Return

integer:

ShiftRightPositive(integer value, integer amount)

This action provides a bitwise shift right operation. This version shifts in zeros from the left (Zero-fill right shift) and discards the bits shifted off.

Example Code

use Libraries.Compute.BitwiseOperations
    BitwiseOperations ops

    integer value = 10
    integer amount = 3
    integer result = ops:ShiftRightKeepSign(value, amoun

Parameters

Return

integer: