Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
mansr
on April 4, 2012
|
parent
|
context
|
favorite
| on:
The byte order fallacy
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: