Is there any API in Linux for changing the byte order of a 64 -bit (long long) variable?
Please comment....
thanks
Is there any API in Linux for changing the byte order of a 64 -bit (long long) variable?
Please comment....
thanks
There are several implementations of "byteswapping" in Linux, but it very much depends on several things which is the best solution:
- what you are actually trying to achieve.
- are you actually just swapping the bytes, or is it dependant on the host?
- is this part of a user-mode application or kernel mode code?
One of the first hits in google shows this:
http://www.digipedia.pl/man/bswap16.9.html
Whilst this page talks about BSD, it appears (from the google search) that the same functionality is implemented in Linux too.
--
Mats