svn commit: trunk/busybox: archival/libunarchive include libbb miscetc...
Peter Kjellerstedt
peter.kjellerstedt at axis.com
Mon May 29 08:14:17 UTC 2006
> -----Original Message-----
> From: busybox-cvs-bounces at busybox.net
> [mailto:busybox-cvs-bounces at busybox.net] On Behalf Of
> landley at busybox.net
> Sent: Monday, May 29, 2006 07:51
> To: busybox-cvs at busybox.net
> Subject: svn commit: trunk/busybox: archival/libunarchive
> include libbb miscetc...
>
> Author: landley
> Date: 2006-05-28 22:51:12 -0700 (Sun, 28 May 2006)
> New Revision: 15215
>
> Log:
> Add SWAP_LE?? and SWAP_BE?? macros, and make things use them.
> Converts values to/from little endian or big endian, which is
> a NOP if that's what the current platform already is.
>
>
> Modified:
> trunk/busybox/archival/libunarchive/decompress_unlzma.c
> trunk/busybox/include/platform.h
> trunk/busybox/libbb/md5.c
> trunk/busybox/miscutils/hdparm.c
>
>
> Changeset:
> Modified: trunk/busybox/include/platform.h
> ===================================================================
> --- trunk/busybox/include/platform.h 2006-05-29 05:21:29 UTC (rev
15214)
> +++ trunk/busybox/include/platform.h 2006-05-29 05:51:12 UTC (rev
15215)
> @@ -118,6 +113,22 @@
> # define BB_LITTLE_ENDIAN 1
> #endif
>
> +#if BB_BIG_ENDIAN
> +#define SWAP_BE16(x) x
> +#define SWAP_BE32(x) x
> +#define SWAP_BE64(x) x
Please correct the three defines above to be defined to (x) rather
than just x. Otherwise a construct like SWAP_BE16(VALUE1 | VALUE2) &
MASK
will be evaluated as VALUE1 | (VALUE2 & MASK) on a BE machine...
> +#define SWAP_LE16(x) bswap_16(x)
> +#define SWAP_LE32(x) bswap_32(x)
> +#define SWAP_LE64(x) bswap_64(x)
> +#else
> +#define SWAP_BE16(x) bswap_16(x)
> +#define SWAP_BE32(x) bswap_32(x)
> +#define SWAP_BE64(x) bswap_64(x)
> +#define SWAP_LE16(x) x
> +#define SWAP_LE32(x) x
> +#define SWAP_LE64(x) x
See above.
> +#endif
> +
> /* ---- Networking ------------------------------------------ */
> #ifndef __APPLE__
> # include <arpa/inet.h>
//Peter
More information about the busybox
mailing list