"Sputnik" help  
Sputnik Help
BinaryFillBit(<binary>, <setTo>)

Description

The BinaryFillBit function fills the entire <binary> with the specified value (<setTo>).

Parameters

<binary> The binary to be filled.
<setTo> A boolean value indicating the value to which all bits in the binary should be set.

Return Value

Success: Returns true if the binary was successfully filled.
Failure: Returns false.

Remarks

The binary manipulation functions provided in this library allow you to work with individual bits within a binary data structure. A bit is the smallest unit of information in computing and can have two possible values: 0 or 1. The functions enable you to retrieve, set, toggle, invert, fill, and clear individual bits within a binary. In Sputnik, the binary data is stored in bytes, with each byte capable of holding 8 bits. These functions provide a convenient way to perform low-level bit manipulation operations on binary data.

Related

BinarySetBit, BinaryGetBit, BinaryClearBit, BinaryInvertBit

Example

Filling all the bits to true (1):

my $binary = pack("B*", "10101101");
BinaryFillBit($binary, true);
my $unpacked = "";
for (my $i = 0; $i < 8; $i++)
    $unpacked .= BinaryGetBit($binary, $i) ? "1" : "0";
say $unpacked;
// PRINTS
// 11111111

Filling all the bits to false (0):

my $binary = pack("B*", "10101101");
BinaryFillBit($binary, false);
my $unpacked = "";
for (my $i = 0; $i < 8; $i++)
    $unpacked .= BinaryGetBit($binary, $i) ? "1" : "0";
say $unpacked;
// PRINTS
// 00000000

 


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