Hacker tips

From miki
Revision as of 10:06, 23 January 2020 by Mip (talk | contribs) (Created page with "== Hex == See Hex. == Bit manipulation == === Endian swap === For 32-bit: <source lang="bash"> #pseudo code v = (v <<< 24) & 0xff00ff00 | (v <<< 8) & 0x00ff00ff </source>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hex

See Hex.

Bit manipulation

Endian swap

For 32-bit:

#pseudo code
v = (v <<< 24) & 0xff00ff00 | (v <<< 8) & 0x00ff00ff

This only requires 2 rotations, 2 bitwise and and 1 bitwise or.