Browse Source

tidy up rounding code

richarddobson 3 tuần trước cách đây
mục cha
commit
0deaabd863
1 tập tin đã thay đổi với 8 bổ sung7 xóa
  1. 8 7
      dev/externals/portsf/portsf.c

+ 8 - 7
dev/externals/portsf/portsf.c

@@ -488,9 +488,10 @@ static int psf_wordsize(psf_stype type)
 }
 }
 
 
 
 
-#if defined _WIN32 && defined _MSC_VER
+#ifdef _MSC_VER
+#  if(_MSC_VER <= 1200)
 /* fast convergent rounding */
 /* fast convergent rounding */
-__inline long psf_round(double fval)
+__inline int psf_round(double fval)
 {
 {
     int result;
     int result;
     _asm{
     _asm{
@@ -501,18 +502,18 @@ __inline long psf_round(double fval)
     return result;
     return result;
 }
 }
 
 
-#else
+#  else
 /* slow convergent rounding ! */
 /* slow convergent rounding ! */
 /* TODO: implement IEEE round-to-even */
 /* TODO: implement IEEE round-to-even */
-long psf_round(double val);
-
-long psf_round(double val)
+int psf_round(double val);
+# endif 
+int psf_round(double val)
 {
 {
     long k;
     long k;
     k = (long)(fabs(val)+0.5);
     k = (long)(fabs(val)+0.5);
     if(val < 0.0)
     if(val < 0.0)
         k = -k;
         k = -k;
-    return k;
+    return (int) k;
 }
 }
 #endif
 #endif