diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-09-19 19:15:08 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-09-19 19:15:08 +0000 |
commit | 03ba4131783cc9e872f8bb26a03f15bc11f27564 (patch) | |
tree | 88db8dba75ae06ba3bad08e42c5e52efc162535c /include/linux/byteorder | |
parent | 257730f99381dd26e10b832fce4c94cae7ac1176 (diff) |
- Merge with Linux 2.1.121.
- Bugfixes.
Diffstat (limited to 'include/linux/byteorder')
-rw-r--r-- | include/linux/byteorder/generic.h | 11 | ||||
-rw-r--r-- | include/linux/byteorder/swab.h | 9 | ||||
-rw-r--r-- | include/linux/byteorder/swabb.h | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h index 5200dc1ad..8fae0f0ef 100644 --- a/include/linux/byteorder/generic.h +++ b/include/linux/byteorder/generic.h @@ -5,18 +5,18 @@ * linux/byteorder_generic.h * Generic Byte-reordering support * - * Francois-Rene Rideau <rideau@ens.fr> 19970707 + * Francois-Rene Rideau <fare@tunes.org> 19970707 * gathered all the good ideas from all asm-foo/byteorder.h into one file, * cleaned them up. * I hope it is compliant with non-GCC compilers. * I decided to put __BYTEORDER_HAS_U64__ in byteorder.h, * because I wasn't sure it would be ok to put it in types.h * Upgraded it to 2.1.43 - * Francois-Rene Rideau <rideau@ens.fr> 19971012 + * Francois-Rene Rideau <fare@tunes.org> 19971012 * Upgraded it to 2.1.57 * to please Linus T., replaced huge #ifdef's between little/big endian * by nestedly #include'd files. - * Francois-Rene Rideau <rideau@ens.fr> 19971205 + * Francois-Rene Rideau <fare@tunes.org> 19971205 * Made it to 2.1.71; now a facelift: * Put files under include/linux/byteorder/ * Split swab from generic support. @@ -31,6 +31,11 @@ * nybble swapping support... * = every architecture could add their byteswap macro in asm/byteorder.h * see how some architectures already do (i386, alpha, ppc, etc) + * = cpu_to_beXX and beXX_to_cpu might some day need to be well + * distinguished throughout the kernel. This is not the case currently, + * since little endian, big endian, and pdp endian machines needn't it. + * But this might be the case for, say, a port of Linux to 20/21 bit + * architectures (and F21 Linux addict around?). */ /* diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h index 7c1f5c985..813df46c3 100644 --- a/include/linux/byteorder/swab.h +++ b/include/linux/byteorder/swab.h @@ -6,7 +6,7 @@ * Byte-swapping, independently from CPU endianness * swabXX[ps]?(foo) * - * Francois-Rene Rideau <rideau@ens.fr> 19971205 + * Francois-Rene Rideau <fare@tunes.org> 19971205 * separated swab functions from cpu_to_XX, * to clean up support for bizarre-endian architectures. * @@ -15,10 +15,13 @@ * */ +/* casts are necessary for constants, because we never know how for sure + * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. + */ #define ___swab16(x) \ ((__u16)( \ - (((__u16)(x) & 0x00ffU) << 8) | \ - (((__u16)(x) & 0xff00U) >> 8) )) + (((__u16)(x) & (__u16)0x00ffU) << 8) | \ + (((__u16)(x) & (__u16)0xff00U) >> 8) )) #define ___swab32(x) \ ((__u32)( \ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h index 22407afdf..782db2e8e 100644 --- a/include/linux/byteorder/swabb.h +++ b/include/linux/byteorder/swabb.h @@ -8,8 +8,8 @@ * * Support for obNUXIous pdp-endian and other bizarre architectures. * Will Linux ever run on such ancient beasts? if not, this file - * will be but a programming pearl. Still, it's a reminder that - * cpu_to_beXX and beXX_to_cpu should be well distinguished. + * will be but a programming pearl. Still, it's a reminder that we + * shouldn't be making too many assumptions when trying to be portable. * */ |