Does anyone know how I can get rid of the following assembler warning?
Code is x86, 32 bit:
int test (int x)
{
int y;
// do a bit-rotate by 8 on
While I'm thinking about it ... you should replace the "q" constraint with a capital "Q" constraint in Chris's second solution:
int
test(int x)
{
int y;
asm ("xchg %b0, %h0" : "=Q" (y) : "0" (x));
return y;
}
"q" and "Q" are slightly different in 64-bit mode, where you can get the lowest byte for all of the integer registers (ax, bx, cx, dx, si, di, sp, bp, r8-r15). But you can only get the second-lowest byte (e.g. ah) for the four original 386 registers (ax, bx, cx, dx).