diff options
| author | Roland McGrath <[email protected]> | 2011-07-09 03:17:24 -0700 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2011-07-09 03:17:24 -0700 |
| commit | 32899ac4f69d4ca4856d5282464c1f9cee928c8a (patch) | |
| tree | 2b45a22f79f4f3464150d5eba73a89ecab0cee22 /lib/system.h | |
| parent | 02a958bc2662c1c9c2d6b663742b9c8e720e25b2 (diff) | |
Clean up byte order handling in md5 and sha1 code.
Diffstat (limited to 'lib/system.h')
| -rw-r--r-- | lib/system.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/system.h b/lib/system.h index 10b4734a..26954264 100644 --- a/lib/system.h +++ b/lib/system.h @@ -1,5 +1,5 @@ /* Declarations for common convenience functions. - Copyright (C) 2006, 2009 Red Hat, Inc. + Copyright (C) 2006-2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -51,6 +51,18 @@ #include <stddef.h> #include <stdint.h> +#include <endian.h> +#include <byteswap.h> + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define LE32(n) (n) +# define BE32(n) bswap_32 (n) +#elif __BYTE_ORDER == __BIG_ENDIAN +# define BE32(n) (n) +# define LE32(n) bswap_32 (n) +#else +# error "Unknown byte order" +#endif extern void *xmalloc (size_t) __attribute__ ((__malloc__)); extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__)); |
