"Sputnik" help  
Sputnik Help
BitFlip(<value>, [<type>])

Description

Causes a bitflip specific to the given value when the type is in generic mode. It can also perform type-specific conversions by reinterpreting the bits.

Parameters

<value> The value to be subjected to the bitflip or conversion.
<type> Optional type of conversion to perform.

Return Value

Success: Returns a new value with the bitflip or conversion applied.
Failure: Returns 0.

Remarks

The BitFlip function allows you to perform bitflips or type-specific conversions on a given value. By default, when no type argument is provided, the function operates in generic mode, performing a bitflip on the value. However, you can specify a type to perform type-specific conversions by reinterpreting the bits.

The following types are supported for type-specific conversions:

See the BitFlip constants.

Related

Example

Example of usage:

my $value = (UInt16)0xABEF;
my $flipped = BitFlip($value);
say hex($flipped);

// PRINTS
// EBAB

Example of using the type:

my $value = BitFlip(777, @BitFlipIntToFloat);
say "Float value $value";
my $flipped = BitFlip($value, @BitFlipFloatToInt);
say "Flipped value $flipped";

// PRINTS
// Float value 1.088809E-42
// Flipped value 777

 


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