[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: endianness guide



Rolando Abarca wrote:

On Thu, 10 Feb 2005, Guglielmo Dapavo wrote:

Is there any gide howto / utility that can help me to convert a module from little-endian to big-endian?

Thanks
--
Guglielmo


I don't know if by module you mean kernel module, but you should look at the ntoh[l|s] && hton[l|s] macros. That should help... (the "host" is supposed to be big endian, so if you work on a big endian machine, ntohX does nothing).

So if I'm using a big endian machine like a mac, also when I use hton[l|s] nothing happens (big endian -> network). hton and ntoh are only used to make code portable is that right?

Ciao
--
Guglielmo



Reply to: