diff options
author | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-08-05 19:57:20 +0000 |
---|---|---|
committer | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-08-05 19:57:20 +0000 |
commit | 0898ee9197a0049e479a12f4c5b3c65e3deaf03b (patch) | |
tree | 187b76db955e603a3b26db7383f2d815f68f80ce /test | |
parent | 1fcb40b79d8fbfcc9acb0966d5f9bba09431f832 (diff) | |
download | compiler-rt-0898ee9197a0049e479a12f4c5b3c65e3deaf03b.tar.gz compiler-rt-0898ee9197a0049e479a12f4c5b3c65e3deaf03b.tar.bz2 compiler-rt-0898ee9197a0049e479a12f4c5b3c65e3deaf03b.tar.xz |
Refactor test suit endianness pre-processor code. More style and readability fixes, start labling endif's
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@78234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Unit/int_lib.h | 95 |
1 files changed, 28 insertions, 67 deletions
diff --git a/test/Unit/int_lib.h b/test/Unit/int_lib.h index bee74592..bc8c98e7 100644 --- a/test/Unit/int_lib.h +++ b/test/Unit/int_lib.h @@ -1,70 +1,31 @@ -//===-- int_lib.h - configuration header for libgcc replacement -----------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file is a configuration header for libgcc replacement. -// This file is not part of the interface of this library. -// -//===----------------------------------------------------------------------===// +/* ===-- int_lib.h - configuration header for libgcc replacement -----------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file is a configuration header for libgcc replacement. + * This file is not part of the interface of this library. + * + * ===----------------------------------------------------------------------=== + */ #ifndef INT_LIB_H #define INT_LIB_H -// Assumption: signed integral is 2's complement -// Assumption: right shift of signed negative is arithmetic shift +/* Assumption: signed integral is 2's complement */ +/* Assumption: right shift of signed negative is arithmetic shift */ #include <limits.h> +#include "endianness.h" +#include <math.h> -// TODO: Improve this to minimal pre-processor hackish'ness. -#if defined (__SVR4) && defined (__sun) -// config.h build via CMake. -//#include <config.h> - -// Solaris header for endian and byte swap -//#if defined HAVE_SYS_BYTEORDER_H -#include <sys/byteorder.h> - -// Solaris defines endian by setting _LITTLE_ENDIAN or _BIG_ENDIAN -#ifdef _BIG_ENDIAN -# define IS_BIG_ENDIAN -#endif -#ifdef _LITTLE_ENDIAN -# define IS_LITTLE_ENDIAN -#endif - -#ifdef IS_BIG_ENDIAN -#define __BIG_ENDIAN__ 1 -#define __LITTLE_ENDIAN__ 0 -#endif -#ifdef IS_LITTLE_ENDIAN -#define __BIG_ENDIAN__ 0 -#define __LITTLE_ENDIAN__ 1 -#endif - -#endif //End of Solaris ifdef. - -#ifdef __LITTLE_ENDIAN__ -#if __LITTLE_ENDIAN__ -#define _YUGA_LITTLE_ENDIAN 1 -#define _YUGA_BIG_ENDIAN 0 -#endif -#endif - -#ifdef __BIG_ENDIAN__ -#if __BIG_ENDIAN__ -#define _YUGA_LITTLE_ENDIAN 0 -#define _YUGA_BIG_ENDIAN 1 -#endif -#endif - -#if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN) -#error unable to determine endian -#endif +#if !defined(INFINITY) && defined(HUGE_VAL) +#define INFINITY HUGE_VAL +#endif /* INFINITY */ typedef int si_int; typedef unsigned su_int; @@ -83,7 +44,7 @@ typedef union #else si_int high; su_int low; -#endif +#endif /* _YUGA_LITTLE_ENDIAN */ }; } dwords; @@ -98,7 +59,7 @@ typedef union #else su_int high; su_int low; -#endif +#endif /* _YUGA_LITTLE_ENDIAN */ }; } udwords; @@ -118,7 +79,7 @@ typedef union #else di_int high; du_int low; -#endif +#endif /* _YUGA_LITTLE_ENDIAN */ }; } twords; @@ -133,7 +94,7 @@ typedef union #else du_int high; du_int low; -#endif +#endif /* _YUGA_LITTLE_ENDIAN */ }; } utwords; @@ -157,7 +118,7 @@ make_tu(du_int h, du_int l) return r.all; } -#endif +#endif /* __x86_64 */ typedef union { @@ -179,7 +140,7 @@ typedef struct #else udwords high; udwords low; -#endif +#endif /* _YUGA_LITTLE_ENDIAN */ } uqwords; typedef union @@ -188,4 +149,4 @@ typedef union long double f; } long_double_bits; -#endif +#endif /* INT_LIB_H */ |