Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The operand constraint should be "r" since bswap works only on registers. You can also simplify it a little using an input/output operand:

    asm ("bswap %0" : "+r"(x));
That said, since version 4.5, gcc recognises the typical byte-swapping pattern and uses the appropriate CPU instruction.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: