"Sputnik" help  
Sputnik Help
BitXor(<value>, ...)

Description

Performs a bitwise XOR (exclusive OR) operation on the given values and returns the result.

Parameters

<value> The values on which to perform the bitwise XOR operation.

Return Value

Success: Returns the result of the bitwise XOR operation.
Failure: Returns 0.

Remarks

The BitXor function takes multiple values as input and performs a bitwise XOR operation on them. It calculates the exclusive OR of the corresponding bits of each value and returns the resulting value.

The function starts with the first value and performs the bitwise XOR operation with each subsequent value. The final result is returned as the output.

The BitXor function is commonly used for bitwise manipulation and comparing bit patterns.

Related

Example

Example of usage:

my $a = BitXor(1, 0); // 0001b XOR 0000b = 0001b
my $b = BitXor(1, 1); // 0001b XOR 0001b = 0000b
my $c = BitXor(13, 7); // 1101b XOR 0111b = 1010b
my $d = BitXor(2, 3, 6); // 0010b XOR 0011b XOR 0110b = 0111b
say unpack("B*", (Byte)$a, @UnpackSingle);
say unpack("B*", (Byte)$b, @UnpackSingle);
say unpack("B*", (Byte)$c, @UnpackSingle);
say unpack("B*", (Byte)$d, @UnpackSingle);

// PRINTS
// 00000001
// 00000000
// 00001010
// 00000111

 


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