"Sputnik" help  
Sputnik Help
SwapBytes64(<value>)

Description

Swaps the byte order of an unsigned 64-bit integer.

Parameters

<value> The unsigned 64-bit integer to swap the bytes of.

Return Value

Success: Returns the value with the byte order swapped.
Failure: Returns false.

Remarks

The SwapBytes64 function swaps the byte order of an unsigned 64-bit integer. It rearranges the bytes so that the least significant byte becomes the most significant byte, and vice versa.

Please note that if you intend to use the SwapBytes64 function on double or signed integers, you can do so by performing a direct cast that reinterprets the bits. However, caution must be exercised when applying this approach, as it may result in unexpected behavior or loss of precision due to differences in data representations between integer and floating-point types.

It is recommended to use the SwapBytes64 function strictly for unsigned 64-bit integers. If you need to swap the byte order of double or signed integers, consider using appropriate conversion or serialization techniques specific to the data type.

Related

Example

Example of usage:

my $a = SwapBytes64(777);
my $b = SwapBytes64($a);
say $a;
say $b;

my $a = SwapBytes64((^UInt64)-777);
my $b = (^Int64)SwapBytes64($a);
say $a;
say $b;

// PRINTS
// 649362771271483392
// 777
// 17869438896475996159
// -777

 


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