bit swap in byte


Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3927
Posted: 07:56pm 25 Jul 2022      

Not tested, but:

Use a 16 byte lookup table for 4 bits and then:

swapped% = lookup%(x% And &b1111) << 4 + lookup%(x% >> 4)


Best wishes,

Tom