diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2014-06-19 10:13:43 -0400 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-06-23 11:00:12 -0400 |
commit | a49db98d1f85ada0c4e5bb22bd93d541e7159c43 (patch) | |
tree | d6389a6c05e1f7046b830a5d158af77f6b205e03 /include/fpu | |
parent | d9c1647d896d3192cba9dbf98fb7efab876edde5 (diff) |
fpu: softfloat: drop INLINE macro
This commit expands all uses of the INLINE macro and drop it.
The reason for this is to avoid clashes with external libraries with
bad name conventions and also because renaming keywords is not a good
practice.
PS: I'm fine with this change to be licensed under softfloat-2a or
softfloat-2b.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'include/fpu')
-rw-r--r-- | include/fpu/softfloat.h | 99 |
1 files changed, 49 insertions, 50 deletions
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 4b3090ca74..77177c5317 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -63,7 +63,6 @@ typedef uint64_t uint64; typedef int64_t int64; #define LIT64( a ) a##LL -#define INLINE static inline #define STATUS_PARAM , float_status *status #define STATUS(field) status->field @@ -181,59 +180,59 @@ typedef struct float_status { flag default_nan_mode; } float_status; -INLINE void set_float_detect_tininess(int val STATUS_PARAM) +static inline void set_float_detect_tininess(int val STATUS_PARAM) { STATUS(float_detect_tininess) = val; } -INLINE void set_float_rounding_mode(int val STATUS_PARAM) +static inline void set_float_rounding_mode(int val STATUS_PARAM) { STATUS(float_rounding_mode) = val; } -INLINE void set_float_exception_flags(int val STATUS_PARAM) +static inline void set_float_exception_flags(int val STATUS_PARAM) { STATUS(float_exception_flags) = val; } -INLINE void set_floatx80_rounding_precision(int val STATUS_PARAM) +static inline void set_floatx80_rounding_precision(int val STATUS_PARAM) { STATUS(floatx80_rounding_precision) = val; } -INLINE void set_flush_to_zero(flag val STATUS_PARAM) +static inline void set_flush_to_zero(flag val STATUS_PARAM) { STATUS(flush_to_zero) = val; } -INLINE void set_flush_inputs_to_zero(flag val STATUS_PARAM) +static inline void set_flush_inputs_to_zero(flag val STATUS_PARAM) { STATUS(flush_inputs_to_zero) = val; } -INLINE void set_default_nan_mode(flag val STATUS_PARAM) +static inline void set_default_nan_mode(flag val STATUS_PARAM) { STATUS(default_nan_mode) = val; } -INLINE int get_float_detect_tininess(float_status *status) +static inline int get_float_detect_tininess(float_status *status) { return STATUS(float_detect_tininess); } -INLINE int get_float_rounding_mode(float_status *status) +static inline int get_float_rounding_mode(float_status *status) { return STATUS(float_rounding_mode); } -INLINE int get_float_exception_flags(float_status *status) +static inline int get_float_exception_flags(float_status *status) { return STATUS(float_exception_flags); } -INLINE int get_floatx80_rounding_precision(float_status *status) +static inline int get_floatx80_rounding_precision(float_status *status) { return STATUS(floatx80_rounding_precision); } -INLINE flag get_flush_to_zero(float_status *status) +static inline flag get_flush_to_zero(float_status *status) { return STATUS(flush_to_zero); } -INLINE flag get_flush_inputs_to_zero(float_status *status) +static inline flag get_flush_inputs_to_zero(float_status *status) { return STATUS(flush_inputs_to_zero); } -INLINE flag get_default_nan_mode(float_status *status) +static inline flag get_default_nan_mode(float_status *status) { return STATUS(default_nan_mode); } @@ -284,22 +283,22 @@ float128 int64_to_float128(int64_t STATUS_PARAM); float128 uint64_to_float128(uint64_t STATUS_PARAM); /* We provide the int16 versions for symmetry of API with float-to-int */ -INLINE float32 int16_to_float32(int16_t v STATUS_PARAM) +static inline float32 int16_to_float32(int16_t v STATUS_PARAM) { return int32_to_float32(v STATUS_VAR); } -INLINE float32 uint16_to_float32(uint16_t v STATUS_PARAM) +static inline float32 uint16_to_float32(uint16_t v STATUS_PARAM) { return uint32_to_float32(v STATUS_VAR); } -INLINE float64 int16_to_float64(int16_t v STATUS_PARAM) +static inline float64 int16_to_float64(int16_t v STATUS_PARAM) { return int32_to_float64(v STATUS_VAR); } -INLINE float64 uint16_to_float64(uint16_t v STATUS_PARAM) +static inline float64 uint16_to_float64(uint16_t v STATUS_PARAM) { return uint32_to_float64(v STATUS_VAR); } @@ -319,7 +318,7 @@ int float16_is_quiet_nan( float16 ); int float16_is_signaling_nan( float16 ); float16 float16_maybe_silence_nan( float16 ); -INLINE int float16_is_any_nan(float16 a) +static inline int float16_is_any_nan(float16 a) { return ((float16_val(a) & ~0x8000) > 0x7c00); } @@ -380,7 +379,7 @@ int float32_is_signaling_nan( float32 ); float32 float32_maybe_silence_nan( float32 ); float32 float32_scalbn( float32, int STATUS_PARAM ); -INLINE float32 float32_abs(float32 a) +static inline float32 float32_abs(float32 a) { /* Note that abs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -388,7 +387,7 @@ INLINE float32 float32_abs(float32 a) return make_float32(float32_val(a) & 0x7fffffff); } -INLINE float32 float32_chs(float32 a) +static inline float32 float32_chs(float32 a) { /* Note that chs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -396,32 +395,32 @@ INLINE float32 float32_chs(float32 a) return make_float32(float32_val(a) ^ 0x80000000); } -INLINE int float32_is_infinity(float32 a) +static inline int float32_is_infinity(float32 a) { return (float32_val(a) & 0x7fffffff) == 0x7f800000; } -INLINE int float32_is_neg(float32 a) +static inline int float32_is_neg(float32 a) { return float32_val(a) >> 31; } -INLINE int float32_is_zero(float32 a) +static inline int float32_is_zero(float32 a) { return (float32_val(a) & 0x7fffffff) == 0; } -INLINE int float32_is_any_nan(float32 a) +static inline int float32_is_any_nan(float32 a) { return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL); } -INLINE int float32_is_zero_or_denormal(float32 a) +static inline int float32_is_zero_or_denormal(float32 a) { return (float32_val(a) & 0x7f800000) == 0; } -INLINE float32 float32_set_sign(float32 a, int sign) +static inline float32 float32_set_sign(float32 a, int sign) { return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31)); } @@ -490,7 +489,7 @@ int float64_is_signaling_nan( float64 ); float64 float64_maybe_silence_nan( float64 ); float64 float64_scalbn( float64, int STATUS_PARAM ); -INLINE float64 float64_abs(float64 a) +static inline float64 float64_abs(float64 a) { /* Note that abs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -498,7 +497,7 @@ INLINE float64 float64_abs(float64 a) return make_float64(float64_val(a) & 0x7fffffffffffffffLL); } -INLINE float64 float64_chs(float64 a) +static inline float64 float64_chs(float64 a) { /* Note that chs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -506,32 +505,32 @@ INLINE float64 float64_chs(float64 a) return make_float64(float64_val(a) ^ 0x8000000000000000LL); } -INLINE int float64_is_infinity(float64 a) +static inline int float64_is_infinity(float64 a) { return (float64_val(a) & 0x7fffffffffffffffLL ) == 0x7ff0000000000000LL; } -INLINE int float64_is_neg(float64 a) +static inline int float64_is_neg(float64 a) { return float64_val(a) >> 63; } -INLINE int float64_is_zero(float64 a) +static inline int float64_is_zero(float64 a) { return (float64_val(a) & 0x7fffffffffffffffLL) == 0; } -INLINE int float64_is_any_nan(float64 a) +static inline int float64_is_any_nan(float64 a) { return ((float64_val(a) & ~(1ULL << 63)) > 0x7ff0000000000000ULL); } -INLINE int float64_is_zero_or_denormal(float64 a) +static inline int float64_is_zero_or_denormal(float64 a) { return (float64_val(a) & 0x7ff0000000000000LL) == 0; } -INLINE float64 float64_set_sign(float64 a, int sign) +static inline float64 float64_set_sign(float64 a, int sign) { return make_float64((float64_val(a) & 0x7fffffffffffffffULL) | ((int64_t)sign << 63)); @@ -585,39 +584,39 @@ int floatx80_is_signaling_nan( floatx80 ); floatx80 floatx80_maybe_silence_nan( floatx80 ); floatx80 floatx80_scalbn( floatx80, int STATUS_PARAM ); -INLINE floatx80 floatx80_abs(floatx80 a) +static inline floatx80 floatx80_abs(floatx80 a) { a.high &= 0x7fff; return a; } -INLINE floatx80 floatx80_chs(floatx80 a) +static inline floatx80 floatx80_chs(floatx80 a) { a.high ^= 0x8000; return a; } -INLINE int floatx80_is_infinity(floatx80 a) +static inline int floatx80_is_infinity(floatx80 a) { return (a.high & 0x7fff) == 0x7fff && a.low == 0x8000000000000000LL; } -INLINE int floatx80_is_neg(floatx80 a) +static inline int floatx80_is_neg(floatx80 a) { return a.high >> 15; } -INLINE int floatx80_is_zero(floatx80 a) +static inline int floatx80_is_zero(floatx80 a) { return (a.high & 0x7fff) == 0 && a.low == 0; } -INLINE int floatx80_is_zero_or_denormal(floatx80 a) +static inline int floatx80_is_zero_or_denormal(floatx80 a) { return (a.high & 0x7fff) == 0; } -INLINE int floatx80_is_any_nan(floatx80 a) +static inline int floatx80_is_any_nan(floatx80 a) { return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1); } @@ -670,39 +669,39 @@ int float128_is_signaling_nan( float128 ); float128 float128_maybe_silence_nan( float128 ); float128 float128_scalbn( float128, int STATUS_PARAM ); -INLINE float128 float128_abs(float128 a) +static inline float128 float128_abs(float128 a) { a.high &= 0x7fffffffffffffffLL; return a; } -INLINE float128 float128_chs(float128 a) +static inline float128 float128_chs(float128 a) { a.high ^= 0x8000000000000000LL; return a; } -INLINE int float128_is_infinity(float128 a) +static inline int float128_is_infinity(float128 a) { return (a.high & 0x7fffffffffffffffLL) == 0x7fff000000000000LL && a.low == 0; } -INLINE int float128_is_neg(float128 a) +static inline int float128_is_neg(float128 a) { return a.high >> 63; } -INLINE int float128_is_zero(float128 a) +static inline int float128_is_zero(float128 a) { return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0; } -INLINE int float128_is_zero_or_denormal(float128 a) +static inline int float128_is_zero_or_denormal(float128 a) { return (a.high & 0x7fff000000000000LL) == 0; } -INLINE int float128_is_any_nan(float128 a) +static inline int float128_is_any_nan(float128 a) { return ((a.high >> 48) & 0x7fff) == 0x7fff && ((a.low != 0) || ((a.high & 0xffffffffffffLL) != 0)); |