Commits

Alex Gaynor  committed 0065938

use the new append_float, and fix translation error

  • Participants
  • Parent commits 0ed55d8
  • Branches struct-double

Comments (0)

Files changed (2)

File pypy/rlib/rstruct/ieee.py

 
 
 def pack_float(result, x, size, be):
-    l = [] if be else result
+    l = []
     unsigned = float_pack(x, size)
     for i in range(size):
         l.append(chr((unsigned >> (i * 8)) & 0xFF))
     if be:
         l.reverse()
-        result.append("".join(l))
+    result.append("".join(l))
 
 
 def unpack_float(s, be):

File pypy/rlib/rstruct/nativefmttable.py

 
 def pack_double(fmtiter):
     doubleval = fmtiter.accept_float_arg()
-    double_buf[0] = doubleval
-    p = rffi.cast(rffi.CCHARP, double_buf)
-    for i in range(sizeof_double):
-        fmtiter.result.append(p[i])
+    fmtiter.result.append_float(doubleval)
 
 @specialize.argtype(0)
 def unpack_double(fmtiter):
 def pack_float(fmtiter):
     doubleval = fmtiter.accept_float_arg()
     floatval = r_singlefloat(doubleval)
-    float_buf[0] = floatval
-    p = rffi.cast(rffi.CCHARP, float_buf)
-    for i in range(sizeof_float):
-        fmtiter.result.append(p[i])
+    fmtiter.result.append_float(floatval)
 
 @specialize.argtype(0)
 def unpack_float(fmtiter):