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, right)

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 a CompareResult.
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, right)

Parameters

Return

integer:

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: 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(t)

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, right)

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(value)

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, right)

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, amount)

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, amount)

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, amount)

Parameters

Return

integer: