I use
result:=(swapendian(dword(x)) shr 8) or (x and $FF000000)
The generated code size seems about the same if I remove the redundant CONST from flipcolor, and the type of used instructions too.
(added later:)
Hmm,
result:=rordword(swapendian(dword(x)),8);
looks shorter on x86 :-)
movl %eax,%edx
# Var x located in register edx
shll $8,%eax
andl $-16711936,%eax
shrl $8,%edx
andl $16711935,%edx
orl %edx,%eax
roll $16,%eax
rorl $8,%eax
Note that the compiler can't seem to peephole a roll 16,x with a rorl 8,x into one rol 8,x ?