> Example, with the new patch [...]
> #define htonl(x) ((unsigned long)___htonl(x))
> Which will simply turn into `x'.
> This will break libc if you build it against these headers!
I really think you do need some holidays. Try using Windows a bit.
Well, actually, the code expands to ((unsigned long)x), which is
the correct answer: the "n" in htonl means "network order", which
is broken endian (big), "thanks" to Sun.
> At least that was what happend back when I made
> the mistake of defining htonl(x) directly to x back in late 1.3.x (or
> was it early 2.1.x - can't remember, Andreas corrected this at some
> later point).
If you defined it as x, it's broken, even on big endian (lack of typecast),
and even more on other endianned bawxes.
> What I don't like against this current approach is that the header
> files in include/linux are mastering the access to the swap
> functions.
They are not quite. First, nobody forces asm/byteorder.h to include any of
linux/byteorder/*.h. Second, you get full control of optimization
(see the alpha, i386, m68k, ppc, sparc64 files that do).
> I would much rather like to see this done by having a
> library as I mentioned and then a list of defines in
> asm-foo/byteorder.h that uses these macros. These library macros can
> use the constant tricks etc. to optimize when appropriate.
CODE, NOT WORDS. Show your library, then (perhaps) Linus will replace
my stuff with yours. Besides, explain me how my patch doesn't do precisely
what you wish.
> For people using the standard versions of the functions,
> asm-foo/byteorder.h will simply turn into 6 defines for the cpu_to_x()
> macros in this file. This will result in the same optimisation but
> will IMHO be much easier to read.
The exact number of usable definitions provided by asm/byteorder.h is 44
(84 if also removing __ prefixes). I personally find them much better where
there are than individually "controlled" in asm-specific files. Please give
me an example of useful "control" not permitted in the 2.1.71 setting.
> Ok this seems to have turned into a religious issue now,
So you alone constitute a church? :)
== Faré -=- (FR) François-René Rideau -=- (VN) Уng-Vû Bân -=- rideau@ens.fr ==
Join a project for a free reflective computing system! | 6 rue Augustin Thierry
TUNES is a Useful, Not Expedient System. | 75019 PARIS FRANCE
http://www.eleves.ens.fr:8080/home/rideau/Tunes/ -=- Reflection&Cybernethics ==