We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I'm using LPC4088 (Cortex M4) and I need to swap uint32_t on the bit level. I have a chip that transfer data 32bits (with SSP) with Lsb first - so I have to swap the result in my code. Because I do it very often - I need the fastest algorithem to do that.
1. The easy way its to shift 32 times and create a new variable depend on the lsb bits. 2. Another technic is to handle the uint32 as 4 bytes (8 bit) and to use lookup table for each byte to swap it. This technic read first byte - swap it (with lookup table) and put in the new location (at the msb side) - and continue for all 4 byte.
Maybe there is a faster technic - (ASM, C..)
Any better solution? Doron
The REV works on a byte level - Change from big endian to little endian. I Need a bit level solution..