"Sputnik" help  
Sputnik Help
BinaryClearBit(<binary>,<index>)

Description

The BinaryClearBit function clears (resets) the bit at the specified index in the <binary>, setting it to 0 (false).

Parameters

<binary> The binary in which to clear the bit.
<index> The index of the bit to clear (0-based).

Return Value

Success: Returns true if the bit was successfully cleared..
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, BinaryFillBit, BinaryInvertBit

Example

Clearing a bit (setting it to false (0)):

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

 


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