diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-17 11:42:17 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-17 11:42:17 +0000 |
commit | df5604ce5d5e01b064378eb886a72c939f82e2c4 (patch) | |
tree | 5e7e28646cc7477d499930702d9915ce6d4b44d1 /pack.c | |
parent | 871c83dddf8132d2668249cc0917320bb86712fd (diff) |
* pack.c (pack_unpack): fix v and V with big endian.
[1].pack("V").unpack("V") was [4294967296].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1617,7 +1617,7 @@ pack_unpack(VALUE str, VALUE fmt) PACK_LENGTH_ADJUST(unsigned short,2); while (len-- > 0) { unsigned short tmp = 0; - memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2)); + memcpy(&tmp, s, NATINT_LEN(unsigned short,2)); s += NATINT_LEN(unsigned short,2); UNPACK_PUSH(UINT2NUM(vtohs(tmp))); } @@ -1628,7 +1628,7 @@ pack_unpack(VALUE str, VALUE fmt) PACK_LENGTH_ADJUST(unsigned long,4); while (len-- > 0) { unsigned long tmp = 0; - memcpy(OFF32(&tmp), s, NATINT_LEN(long,4)); + memcpy(&tmp, s, NATINT_LEN(long,4)); s += NATINT_LEN(long,4); UNPACK_PUSH(ULONG2NUM(vtohl(tmp))); } |