"Sputnik" help  
Sputnik Help
PartialBytesToUInt64(<binary>, <leftBytes>)

Description

Converts a portion of a binary string to an unsigned 64-bit integer.

Parameters

<binary> The binary string from which to extract the data.
<leftBytes> The number of bytes to consider from the beginning of the binary string. Must be in the range of 0 to 7.

Return Value

Success: Returns unsigned 64-bit integer extracted from the specified portion of the binary string.
Failure: Returns null.

Remarks

This function takes a binary string and extracts a portion of it to form a 64-bit unsigned integer. The extracted portion is determined by the number of leftmost bytes specified by the leftBytes parameter. If leftBytes is greater than or equal to the length of the binary string, the entire binary string is converted to an unsigned integer. Otherwise, bitwise operations are used to combine the specified bytes into a single unsigned 64-bit integer.

Related

Example

Example of usage:

my $binary = 0b110101010011001100110011;
my $leftBytes = 2;
my $result = PartialBytesToUInt64($binary, $leftBytes);
say $result;

// PRINTS
// 13107

 


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