fixed and cleaned up fp support, optimisation yet to come
[fw/sdcc] / device / lib / _fs2slong.c
index 1c3aec8c8f7d49a2dee2042d9256972010a14819..236ef878789d91600cf3be43e5d70236c4d3680e 100644 (file)
@@ -1,6 +1,4 @@
-#include <limits.h>
-
-unsigned long __fs2ulong (float a1);
+#include <float.h>
 
 /* convert float to signed long */
 signed long __fs2slong (float f) {
@@ -9,12 +7,8 @@ signed long __fs2slong (float f) {
     return 0;
 
   if (f<0) {
-    if (f<=LONG_MIN)
-      return LONG_MIN;
     return -__fs2ulong(-f);
   } else {
-    if (f>=LONG_MAX)
-      return LONG_MAX;
     return __fs2ulong(f);
   }
 }