Skip to content

ByteSwap

Narta Xaymar Dirks edited this page Oct 28, 2026 · 6 revisions
BlitzLLVM

ByteSwap 〔BlitzLLVM〕

ByteSwap:Int32 value:Int32
Parameter Mode Type Default Description
value In Int32 required An integer.

Returns: The number with its bytes in the other order.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Reverses the order of the bytes of a number, which converts between the order that the processor uses (little endian) and the order that files and networks often use (big endian). A one byte number is returned as it is. The result has the type of the number. This is a BlitzLLVM extension. It looks at the bits of the number the way its type has them, so the same value counts differently as a Byte, an Int or a Long: a number written in the program is an Int (32 bits) unless it is larger, and Byte, UByte, Short, UShort, UInt, Long and ULong give the other widths. A real or a text is taken as an Int, like the bit operators do.

Differences

  • Not in the originals.

Examples

Print Hex(ByteSwap($12345678))
Print ByteSwap(UShort($1234))
Print ByteSwap(ULong(1))
78563412
13330
72057594037927936

Related Commands

ATan, ATan2, SatByte 〔BlitzLLVM〕, SatUByte 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally