I need to swap bytes of a 32 bit value 11223344 should be swapped as 44332211. Currently i'm using following logic.
val = ((((val) & 0xff000000) >> 24)|
(((val) & 0x00ff0000) >> 8) |
(((val) & 0x0000ff00) << 8) |
(((val) & 0x000000ff) << 24));
This is working as expected. But i just wanted to know is there any other fastest/Optimized way to do the same.