[PATCH] D14054: Use hexadecimal floating point literals instead of decimal

angelsl via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 25 22:00:50 PDT 2015


angelsl created this revision.
angelsl added a reviewer: compnerd.
angelsl added subscribers: compnerd, llvm-commits.

http://reviews.llvm.org/D14054

Files:
  lib/builtins/fixunsdfdi.c
  lib/builtins/fixunssfdi.c
  lib/builtins/floatdidf.c
  lib/builtins/floatundidf.c

Index: lib/builtins/floatundidf.c
===================================================================
--- lib/builtins/floatundidf.c
+++ lib/builtins/floatundidf.c
@@ -32,9 +32,9 @@
 COMPILER_RT_ABI double
 __floatundidf(du_int a)
 {
-	static const double twop52 = 4503599627370496.0; // 0x1.0p52
-	static const double twop84 = 19342813113834066795298816.0; // 0x1.0p84
-	static const double twop84_plus_twop52 = 19342813118337666422669312.0; // 0x1.00000001p84
+	static const double twop52 = 0x10000000000000.0; // 0x1.0p52
+	static const double twop84 = 0x1000000000000000000000.0; // 0x1.0p84
+	static const double twop84_plus_twop52 = 0x1000000010000000000000.0; // 0x1.00000001p84
 	
 	union { uint64_t x; double d; } high = { .d = twop84 };
 	union { uint64_t x; double d; } low = { .d = twop52 };
Index: lib/builtins/floatdidf.c
===================================================================
--- lib/builtins/floatdidf.c
+++ lib/builtins/floatdidf.c
@@ -32,8 +32,8 @@
 COMPILER_RT_ABI double
 __floatdidf(di_int a)
 {
-	static const double twop52 = 4503599627370496.0; // 0x1.0p52
-	static const double twop32 = 4294967296.0; // 0x1.0p32
+	static const double twop52 = 0x10000000000000.0; // 0x1.0p52
+	static const double twop32 = 0x100000000.0; // 0x1.0p32
 	
 	union { int64_t x; double d; } low = { .d = twop52 };
 	
Index: lib/builtins/fixunssfdi.c
===================================================================
--- lib/builtins/fixunssfdi.c
+++ lib/builtins/fixunssfdi.c
@@ -23,8 +23,8 @@
 {
     if (a <= 0.0f) return 0;
     double da = a;
-    su_int high = da / 4294967296.f;               /* da / 0x1p32f; */
-    su_int low = da - (double)high * 4294967296.f; /* high * 0x1p32f; */
+    su_int high = da / 0x100000000.0f;               /* da / 0x1p32f; */
+    su_int low = da - (double)high * 0x100000000.0f; /* high * 0x1p32f; */
     return ((du_int)high << 32) | low;
 }
 
Index: lib/builtins/fixunsdfdi.c
===================================================================
--- lib/builtins/fixunsdfdi.c
+++ lib/builtins/fixunsdfdi.c
@@ -22,8 +22,8 @@
 __fixunsdfdi(double a)
 {
     if (a <= 0.0) return 0;
-    su_int high = a / 4294967296.f;               /* a / 0x1p32f; */
-    su_int low = a - (double)high * 4294967296.f; /* high * 0x1p32f; */
+    su_int high = a / 0x100000000.0f;               /* a / 0x1p32f; */
+    su_int low = a - (double)high * 0x100000000.0f; /* high * 0x1p32f; */
     return ((du_int)high << 32) | low;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14054.38372.patch
Type: text/x-patch
Size: 2476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151026/fcd5f374/attachment.bin>


More information about the llvm-commits mailing list