Class FHBitSet

Used to represent and manipulate a 32 bit bitset.

Examples

FHBitSet fh;

fh.set(43);
fh.setBitNo(15, true);
printLine(fh.toLsbString()); // Prints "00000000000000001000000000101011"

Constructors

FHBitSet()

Initializes a new instance of the FHBitSet class.

Declaration

FHBitSet

Examples

FHBitSet fh;

fh.set(43);
fh.setBitNo(15, true);
printLine(fh.toLsbString()); // Prints "00000000000000001000000000101011"

Methods

getBitNo(Integer)

Checks if a specified bit is set.

Declaration

Bool getBitNo(Integer number)

Parameters

Type Name Description
Integer number Bit number to check (0-31).

Returns

Type Description
Bool True if a specified bit is set; otherwise, false.

set(Integer)

Initializes the bitset from an Integer.

Declaration

Void set(Integer value)

Examples

FHBitSet fh;

fh.set(44);
print(fh.toLsbString());

Parameters

Type Name Description
Integer value Used to initialize the bitset.

Returns

Type Description
Void

set(String)

Initializes the bitset from a String.

Declaration

Void set(String rep)

Parameters

Type Name Description
String rep Used to initialize the bitset. For example, "1234"

Returns

Type Description
Void

setBitNo(Integer,Bool)

Sets a specific bit.

Declaration

Void setBitNo(Integer number, Bool val)

Examples

FHBitSet fh;

Bool b = true;
fh.set(0);
fh.setBitNo(15, b);
print(fh.toLsbString());
Output: 00000000000000001000000000000000

Parameters

Type Name Description
Integer number Index of the bit to set
Bool val Value to set this bit to - (True/False - 1/0).

Returns

Type Description
Void

toInteger()

Returns the bitset as an integer.

Declaration

Integer toInteger()

Returns

Type Description
Integer The Integer representation of the bitset.

toLsbString()

Returns an LSB (Least Significant Byte first) string representation of the bitset.

Declaration

String toLsbString()

Examples

FHBitSet fh;

fh.set(44);
print(fh.toLsbString());
Output: 00000000000000000000000000101100

Returns

Type Description
String The LSB string representation of the bitset.