Difference between revisions of "Bit.bswap"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
<translate>Swaps the bytes of its argument and returns it. This can be used to convert little-endian 32 bit numbers to big-endian 32 bit numbers or vice versa.</translate> | <translate>Swaps the bytes of its argument and returns it. This can be used to convert little-endian 32 bit numbers to big-endian 32 bit numbers or vice versa.</translate> | ||
− | < | + | <syntaxhighlight lang="lua"> |
(number) = bit.bswap(x) | (number) = bit.bswap(x) | ||
− | </ | + | </syntaxhighlight> |
=== <translate>Parameters</translate> === | === <translate>Parameters</translate> === | ||
'''x''': (number) <translate>number to swap</translate> <br/> | '''x''': (number) <translate>number to swap</translate> <br/> | ||
=== <translate>Return values</translate> === | === <translate>Return values</translate> === | ||
'''<translate>Returns</translate>''' (number) <translate>Swapped bytes</translate><br/> | '''<translate>Returns</translate>''' (number) <translate>Swapped bytes</translate><br/> | ||
+ | |||
+ | {{Bit}} |
Latest revision as of 14:26, 13 July 2023
Available since: Gideros 2013.09
Class: bit
Description
Swaps the bytes of its argument and returns it. This can be used to convert little-endian 32 bit numbers to big-endian 32 bit numbers or vice versa.
(number) = bit.bswap(x)
Parameters
x: (number) number to swap
Return values
Returns (number) Swapped bytes