"Sputnik" help |

Sputnik
Help

Description

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

Parameters

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

Return Value

Success: | Returns the value with the byte order swapped. |

Failure: | Returns false. |

Remarks

The **SwapBytes32** function swaps the byte order of an unsigned
32-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 **SwapBytes32** 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 **SwapBytes32** function strictly
for unsigned 32-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=SwapBytes32(777);my$b=SwapBytes32($a);say $a;say $b;my$a=SwapBytes32((^UInt32)-777);my$b=(^Int32)SwapBytes32($a);say $a;say $b;// PRINTS// 151191552// 777// 4160552959// -777

Contact

Cheryl (uberfox@hotmail.com)

Homepage

http://ubersoft.org