Project

General

Profile

Feature #4084 ยป unsigned_long.diff

tenderlovemaking (Aaron Patterson), 11/24/2010 01:48 PM

View differences:

pack.c
bigendian_p = 1;
goto pack_integer;
case 'Y': /* unsigned long 64 bit (network byte-order) */
signed_p = 0;
integer_size = 8;
bigendian_p = 1;
goto pack_integer;
case 'v': /* unsigned short (VAX byte-order) */
signed_p = 0;
integer_size = 2;
......
* | |
* n | Integer | 16-bit unsigned, network (big-endian) byte order
* N | Integer | 32-bit unsigned, network (big-endian) byte order
* Y | Integer | 64-bit unsigned, network (big-endian) byte order
* v | Integer | 16-bit unsigned, VAX (little-endian) byte order
* V | Integer | 32-bit unsigned, VAX (little-endian) byte order
* | |
......
bigendian_p = 1;
goto unpack_integer;
case 'Y': /* unsigned long 64 bit (network byte-order) */
signed_p = 0;
integer_size = 8;
bigendian_p = 1;
goto unpack_integer;
case 'v':
signed_p = 0;
integer_size = 2;
test/ruby/test_array.rb
assert_equal(@cls[], a)
end
def test_pack_64_network
assert_equal("\x0\x0\x0\x1\x0\x0\x0\x1", [(1 << 32) + 1].pack('Y'))
end
def test_unpack_64_network
assert_equal((1 << 32) + 1, "\x0\x0\x0\x1\x0\x0\x0\x1".unpack('Y').first)
end
def test_pack
a = @cls[*%w( cat wombat x yy)]
assert_equal("catwomx yy ", a.pack("A3A3A3A3"))
    (1-1/1)