a fast way to try may be like: /* bgrp 32 bit, blue, green, red, pad */ #define blue *(data+o) #define red *(data+o+2) swap_rb(*data) { for (o=0;o<sizeof(*data);o=+4) { blue^=red; red=^blue; blue^=red; }This is pseudo code to demonstrate exor swapping. just converts the data and if the data size is cachable, it should run fast. for 24 bit it requires a new loop.
Hope it helps, Cagdas