[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unresolved: htonl(), htons(), __memcpy3d
On Thu, 22 Feb 2001 aprasad@in.ibm.com wrote:
> just compile with -O2 options.
Yeah, this got me for a while very recently and although I found
out what was wrong I never looked too closely at what was going
on in that header file, but I have now.
It all seems a bit strange to me..... maybe somebody could explain
it to me?
in include/linux/byteorder/generic.h... (version 2.4.1)
protoypes defined for htonl, line 150
> extern __u32 ntohl(__u32);
if __OPTIMIZE__ is defined the macros __htonl and htonl are defined
> #if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
.
.
> #define ___htonl(x) __cpu_to_be32(x)
.
.
> #define htonl(x) ___htonl(x)
Now, the comment at the top of the file says
> * It seems that some programs (which? where? or perhaps a standard? POSIX?)
> * might like the above to be functions, not macros (why?).
> * if that's true, then detect them, and take measures.
> * Anyway, the measure is: define only ___ntohl as a macro instead,
> * and in a separate file, have
> * unsigned long inline ntohl(x){return ___ntohl(x);}
That inline function doesn't seem to exist, and even if it did, it
wouldn't be able to be used from a module(?)
Could someone explain the wisdom of all this to me and why __OPTIMIZE__
needs to be defined before these macros can be used?
Cheers,
Mark
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.surriel.com/kernelnewbies.shtml