This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

generic bswap* don't support constants


I found that <bits/byteswap.h> used on ix86 (from sysdeps/i386/bits)
support 16/32/64-bit constants swapping through __bswap_constant_*
macros and selection by __builtin_constant_p, thus allowing to use
bswap_{16,32,64} macros from <byteswap.h> e.g. on 16/32/64-bit enums.
The same applies to <bits/byteswap.h> used on ia64, m68k, s390 and
x86_64 architectures.

But generic <bits/byteswap.h> (from sysdeps/generic/bits) supports only
64-bit constants; using bswap_16 or bswap_32 for enum value (which
works on i386 and other archs mentioned above) e.g. on ppc architecture
results in error.

I think it's at least inconsequent...
Generic 16/32-bit constant support can be easily added by adding
(in sysdeps/generic/bits/byteswap.h) __builtin_constant_p clauses to
__bswap_{16,32}, similarly to this used in __bswap_64 macro.


-- 
Jakub Bogusz    http://cyber.cs.net.pl/~qboosh/
PLD Team        http://www.pld-linux.org/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]