shhyou / ypsilon-fork

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

bytevector-s64-set! only sets 32 bits #118

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
bytevector-s64-set! only sets 32 bits:

Ypsilon 0.9.6-trunk/r503 Copyright (c) 2009 Y.Fujita, LittleWing Company
Limited.
> (let ((bv (make-bytevector 8 0)))
  (bytevector-s64-set! bv 0 -1 (endianness big))
  (values bv (bytevector-s64-ref bv 0 (endianness big))))
#<values #vu8(255 255 255 255 0 0 0 0) -4294967296>
> 

The procedure works as expected with (endianness little).

Original issue reported on code.google.com by weinh...@gmail.com on 2 Aug 2009 at 6:03

GoogleCodeExporter commented 9 years ago
It seems a typo, as follows:

Index: src/subr_bvector.cpp
===================================================================
--- src/subr_bvector.cpp    (revision 503)
+++ src/subr_bvector.cpp    (working copy)
@@ -754,7 +754,7 @@
     int64_t s64;
     if (exact_integer_to_int64(argv[2], &s64)) {
         if (param.little) LE64((uint64_t)s64, param.bytes);
-        else BE32((uint64_t)s64, param.bytes);
+        else BE64((uint64_t)s64, param.bytes);
         return scm_unspecified;
     }
     if (exact_integer_pred(argv[2])) {

Original comment by tabe.fix...@gmail.com on 3 Aug 2009 at 3:40