Skip to content

Commit

Permalink
fpu: softfloat: drop INLINE macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luiz Capitulino committed Jun 23, 2014
1 parent d9c1647 commit a49db98
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 93 deletions.
38 changes: 19 additions & 19 deletions fpu/softfloat-macros.h
Expand Up @@ -55,7 +55,7 @@ these four paragraphs for those parts of this code that are retained.
| The result is stored in the location pointed to by `zPtr'.
*----------------------------------------------------------------------------*/

INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
{
uint32_t z;

Expand All @@ -81,7 +81,7 @@ INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
| The result is stored in the location pointed to by `zPtr'.
*----------------------------------------------------------------------------*/

INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
{
uint64_t z;

Expand Down Expand Up @@ -115,7 +115,7 @@ INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
| described above, and is returned at the location pointed to by `z1Ptr'.)
*----------------------------------------------------------------------------*/

INLINE void
static inline void
shift64ExtraRightJamming(
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
Expand Down Expand Up @@ -152,7 +152,7 @@ INLINE void
| which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
shift128Right(
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
Expand Down Expand Up @@ -187,7 +187,7 @@ INLINE void
| the locations pointed to by `z0Ptr' and `z1Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
shift128RightJamming(
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
Expand Down Expand Up @@ -238,7 +238,7 @@ INLINE void
| `z2Ptr'.)
*----------------------------------------------------------------------------*/

INLINE void
static inline void
shift128ExtraRightJamming(
uint64_t a0,
uint64_t a1,
Expand Down Expand Up @@ -296,7 +296,7 @@ INLINE void
| pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
shortShift128Left(
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
Expand All @@ -315,7 +315,7 @@ INLINE void
| `z1Ptr', and `z2Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
shortShift192Left(
uint64_t a0,
uint64_t a1,
Expand Down Expand Up @@ -350,7 +350,7 @@ INLINE void
| are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
add128(
uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr )
{
Expand All @@ -370,7 +370,7 @@ INLINE void
| `z1Ptr', and `z2Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
add192(
uint64_t a0,
uint64_t a1,
Expand Down Expand Up @@ -408,7 +408,7 @@ INLINE void
| `z1Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
sub128(
uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr )
{
Expand All @@ -426,7 +426,7 @@ INLINE void
| pointed to by `z0Ptr', `z1Ptr', and `z2Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
sub192(
uint64_t a0,
uint64_t a1,
Expand Down Expand Up @@ -462,7 +462,7 @@ INLINE void
| `z0Ptr' and `z1Ptr'.
*----------------------------------------------------------------------------*/

INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr )
static inline void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr )
{
uint32_t aHigh, aLow, bHigh, bLow;
uint64_t z0, zMiddleA, zMiddleB, z1;
Expand Down Expand Up @@ -492,7 +492,7 @@ INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr
| `z2Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
mul128By64To192(
uint64_t a0,
uint64_t a1,
Expand Down Expand Up @@ -520,7 +520,7 @@ INLINE void
| the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'.
*----------------------------------------------------------------------------*/

INLINE void
static inline void
mul128To256(
uint64_t a0,
uint64_t a1,
Expand Down Expand Up @@ -702,7 +702,7 @@ static int8 countLeadingZeros64( uint64_t a )
| Otherwise, returns 0.
*----------------------------------------------------------------------------*/

INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
{

return ( a0 == b0 ) && ( a1 == b1 );
Expand All @@ -715,7 +715,7 @@ INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
| Otherwise, returns 0.
*----------------------------------------------------------------------------*/

INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
{

return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
Expand All @@ -728,7 +728,7 @@ INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
| returns 0.
*----------------------------------------------------------------------------*/

INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
{

return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
Expand All @@ -741,7 +741,7 @@ INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
| Otherwise, returns 0.
*----------------------------------------------------------------------------*/

INLINE flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
{

return ( a0 != b0 ) || ( a1 != b1 );
Expand Down
48 changes: 24 additions & 24 deletions fpu/softfloat.c
Expand Up @@ -66,7 +66,7 @@ these four paragraphs for those parts of this code that are retained.
| Returns the fraction bits of the half-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE uint32_t extractFloat16Frac(float16 a)
static inline uint32_t extractFloat16Frac(float16 a)
{
return float16_val(a) & 0x3ff;
}
Expand All @@ -75,7 +75,7 @@ INLINE uint32_t extractFloat16Frac(float16 a)
| Returns the exponent bits of the half-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE int_fast16_t extractFloat16Exp(float16 a)
static inline int_fast16_t extractFloat16Exp(float16 a)
{
return (float16_val(a) >> 10) & 0x1f;
}
Expand All @@ -84,7 +84,7 @@ INLINE int_fast16_t extractFloat16Exp(float16 a)
| Returns the sign bit of the single-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE flag extractFloat16Sign(float16 a)
static inline flag extractFloat16Sign(float16 a)
{
return float16_val(a)>>15;
}
Expand Down Expand Up @@ -255,7 +255,7 @@ static int64 roundAndPackUint64(flag zSign, uint64_t absZ0,
| Returns the fraction bits of the single-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE uint32_t extractFloat32Frac( float32 a )
static inline uint32_t extractFloat32Frac( float32 a )
{

return float32_val(a) & 0x007FFFFF;
Expand All @@ -266,7 +266,7 @@ INLINE uint32_t extractFloat32Frac( float32 a )
| Returns the exponent bits of the single-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE int_fast16_t extractFloat32Exp(float32 a)
static inline int_fast16_t extractFloat32Exp(float32 a)
{

return ( float32_val(a)>>23 ) & 0xFF;
Expand All @@ -277,7 +277,7 @@ INLINE int_fast16_t extractFloat32Exp(float32 a)
| Returns the sign bit of the single-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE flag extractFloat32Sign( float32 a )
static inline flag extractFloat32Sign( float32 a )
{

return float32_val(a)>>31;
Expand Down Expand Up @@ -328,7 +328,7 @@ static void
| significand.
*----------------------------------------------------------------------------*/

INLINE float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
static inline float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
{

return make_float32(
Expand Down Expand Up @@ -440,7 +440,7 @@ static float32
| Returns the fraction bits of the double-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE uint64_t extractFloat64Frac( float64 a )
static inline uint64_t extractFloat64Frac( float64 a )
{

return float64_val(a) & LIT64( 0x000FFFFFFFFFFFFF );
Expand All @@ -451,7 +451,7 @@ INLINE uint64_t extractFloat64Frac( float64 a )
| Returns the exponent bits of the double-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE int_fast16_t extractFloat64Exp(float64 a)
static inline int_fast16_t extractFloat64Exp(float64 a)
{

return ( float64_val(a)>>52 ) & 0x7FF;
Expand All @@ -462,7 +462,7 @@ INLINE int_fast16_t extractFloat64Exp(float64 a)
| Returns the sign bit of the double-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE flag extractFloat64Sign( float64 a )
static inline flag extractFloat64Sign( float64 a )
{

return float64_val(a)>>63;
Expand Down Expand Up @@ -513,7 +513,7 @@ static void
| significand.
*----------------------------------------------------------------------------*/

INLINE float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
static inline float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
{

return make_float64(
Expand Down Expand Up @@ -625,7 +625,7 @@ static float64
| value `a'.
*----------------------------------------------------------------------------*/

INLINE uint64_t extractFloatx80Frac( floatx80 a )
static inline uint64_t extractFloatx80Frac( floatx80 a )
{

return a.low;
Expand All @@ -637,7 +637,7 @@ INLINE uint64_t extractFloatx80Frac( floatx80 a )
| value `a'.
*----------------------------------------------------------------------------*/

INLINE int32 extractFloatx80Exp( floatx80 a )
static inline int32 extractFloatx80Exp( floatx80 a )
{

return a.high & 0x7FFF;
Expand All @@ -649,7 +649,7 @@ INLINE int32 extractFloatx80Exp( floatx80 a )
| `a'.
*----------------------------------------------------------------------------*/

INLINE flag extractFloatx80Sign( floatx80 a )
static inline flag extractFloatx80Sign( floatx80 a )
{

return a.high>>15;
Expand Down Expand Up @@ -679,7 +679,7 @@ static void
| extended double-precision floating-point value, returning the result.
*----------------------------------------------------------------------------*/

INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
static inline floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
{
floatx80 z;

Expand Down Expand Up @@ -921,7 +921,7 @@ static floatx80
| floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE uint64_t extractFloat128Frac1( float128 a )
static inline uint64_t extractFloat128Frac1( float128 a )
{

return a.low;
Expand All @@ -933,7 +933,7 @@ INLINE uint64_t extractFloat128Frac1( float128 a )
| floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE uint64_t extractFloat128Frac0( float128 a )
static inline uint64_t extractFloat128Frac0( float128 a )
{

return a.high & LIT64( 0x0000FFFFFFFFFFFF );
Expand All @@ -945,7 +945,7 @@ INLINE uint64_t extractFloat128Frac0( float128 a )
| `a'.
*----------------------------------------------------------------------------*/

INLINE int32 extractFloat128Exp( float128 a )
static inline int32 extractFloat128Exp( float128 a )
{

return ( a.high>>48 ) & 0x7FFF;
Expand All @@ -956,7 +956,7 @@ INLINE int32 extractFloat128Exp( float128 a )
| Returns the sign bit of the quadruple-precision floating-point value `a'.
*----------------------------------------------------------------------------*/

INLINE flag extractFloat128Sign( float128 a )
static inline flag extractFloat128Sign( float128 a )
{

return a.high>>63;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ static void
| significand.
*----------------------------------------------------------------------------*/

INLINE float128
static inline float128
packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 )
{
float128 z;
Expand Down Expand Up @@ -7088,7 +7088,7 @@ uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
}

#define COMPARE(s, nan_exp) \
INLINE int float ## s ## _compare_internal( float ## s a, float ## s b, \
static inline int float ## s ## _compare_internal( float ## s a, float ## s b, \
int is_quiet STATUS_PARAM ) \
{ \
flag aSign, bSign; \
Expand Down Expand Up @@ -7140,7 +7140,7 @@ int float ## s ## _compare_quiet( float ## s a, float ## s b STATUS_PARAM ) \
COMPARE(32, 0xff)
COMPARE(64, 0x7ff)

INLINE int floatx80_compare_internal( floatx80 a, floatx80 b,
static inline int floatx80_compare_internal( floatx80 a, floatx80 b,
int is_quiet STATUS_PARAM )
{
flag aSign, bSign;
Expand Down Expand Up @@ -7186,7 +7186,7 @@ int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM )
return floatx80_compare_internal(a, b, 1 STATUS_VAR);
}

INLINE int float128_compare_internal( float128 a, float128 b,
static inline int float128_compare_internal( float128 a, float128 b,
int is_quiet STATUS_PARAM )
{
flag aSign, bSign;
Expand Down Expand Up @@ -7242,7 +7242,7 @@ int float128_compare_quiet( float128 a, float128 b STATUS_PARAM )
* semantics provided by many CPUs which predate that specification.
*/
#define MINMAX(s) \
INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \
static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \
int ismin, int isieee STATUS_PARAM) \
{ \
flag aSign, bSign; \
Expand Down

0 comments on commit a49db98

Please sign in to comment.