Changeset 7e557805 in mainline
- Timestamp:
- 2005-12-20T12:48:15Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e649dfa
- Parents:
- b5440cf
- Location:
- softfloat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
softfloat/generic/comparison.c
rb5440cf r7e557805 40 40 }; 41 41 42 inline int isFloat32Infinity(float32 f) 43 { 44 return ((f.parts.exp==0xFF)&&(f.parts.mantisa==0x0)); 45 }; 46 47 /** 48 * @return 1, if both floats are equal - but NaNs are not recognized 49 */ 50 inline int isFloat32eq(float32 a, float32 b) 51 { 52 return ((a==b)||(((a.binary| b.binary)&0x7FFFFFFF)==0)); /* a equals to b or both are zeros (with any sign) */ 53 } 54 55 /** 56 * @return 1, if a>b - but NaNs are not recognized 57 */ 58 inline int isFloat32lt(float32 a, float32 b) 59 { 60 if (((a.binary| b.binary)&0x7FFFFFFF)==0) { 61 return 0; 62 }; 63 a.parts.sign^=a.parts.sign; 64 b.parts.sign^=b.parts.sign; 65 return (a.binary<b.binary); 66 67 } 68 69 -
softfloat/generic/softfloat.c
rb5440cf r7e557805 84 84 /* Comparison functions */ 85 85 86 /* a<b .. -1 87 * a=b .. 0 88 * a>b .. 1 89 * */ 90 91 int __cmpsf2(double a, double b) 92 { 93 float32 fa,fb; 94 fa.f=a; 95 fb.f=b; 96 if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) { 97 return 1; /* no special constant for unordered - maybe signaled? */ 98 }; 99 100 101 if (isFloat32eq(fa,fb)) { 102 return 0; 103 }; 104 105 if (isFloat32lt(fa,fb)) { 106 return -1; 107 }; 108 return 1; 109 } 110 111 int __unordsf2(float a, float b) 112 { 113 float32 fa,fb; 114 fa.f=a; 115 fb.f=b; 116 return ((isFloat32NaN(fa))||(isFloat32NaN(fb))); 117 }; 118 119 /** 120 * @return zero, if neither argument is a NaN and are equal 121 * */ 122 int __eqsf2(float a, float b) 123 { 124 float32 fa,fb; 125 fa.f=a; 126 fb.f=b; 127 if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) { 128 /* TODO: sigNaNs*/ 129 return 1; 130 }; 131 return isFloat32eq(fa,fb)-1; 132 }; 133 134 /* strange behavior, but it was in gcc documentation */ 135 int __nesf2(float a, float b) 136 { 137 return __eqsf2(a,b); 138 }; 86 139 /* Other functions */ 87 140 -
softfloat/include/sftypes.h
rb5440cf r7e557805 33 33 typedef union { 34 34 float f; 35 __u32 binary; 36 35 37 struct { 36 38 #ifdef __BIG_ENDIAN__ … … 50 52 typedef union { 51 53 double d; 54 __u64 binary; 55 52 56 struct { 53 57 #ifdef __BIG_ENDIAN__
Note:
See TracChangeset
for help on using the changeset viewer.