"Sputnik" help  
Sputnik Help
IsolateLowBit(<value>)

Description

Isolates the lowest set bit in an unsigned 64-bit integer value.

Parameters

<value> The unsigned 64-bit integer value to isolate the lowest set bit.

Return Value

Success: Returns true.
Failure: Returns false.

Remarks

This function isolates the lowest set bit in the given unsigned 64-bit integer value. It uses a bitwise AND operation with the two's complement of the value to obtain the isolated bit. If the value is zero, indicating no set bits, the function returns zero.

Related

Example

Example of usage:

my $value1 = 10; // Binary: 1010
my $isolated1 = IsolateLowBit($value1);
say $isolated1;

my $value2 = 0; // No set bits
my $isolated2 = IsolateLowBit($value2);
say $isolated2;

my $value3 = 255; // Binary: 11111111
my $isolated3 = IsolateLowBit($value3);
say $isolated3;

// PRINTS
// 2
// 0
// 1

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org