Project

General

Profile

Feature #4084 ยป unsigned_long.diff

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

View differences:

pack.c
733 733
            bigendian_p = 1;
734 734
            goto pack_integer;
735 735

  
736
	  case 'Y':		/* unsigned long 64 bit (network byte-order) */
737
            signed_p = 0;
738
            integer_size = 8;
739
            bigendian_p = 1;
740
            goto pack_integer;
741

  
736 742
	  case 'v':		/* unsigned short (VAX byte-order) */
737 743
            signed_p = 0;
738 744
            integer_size = 2;
......
1301 1307
 *                |         |
1302 1308
 *      n         | Integer | 16-bit unsigned, network (big-endian) byte order
1303 1309
 *      N         | Integer | 32-bit unsigned, network (big-endian) byte order
1310
 *      Y         | Integer | 64-bit unsigned, network (big-endian) byte order
1304 1311
 *      v         | Integer | 16-bit unsigned, VAX (little-endian) byte order
1305 1312
 *      V         | Integer | 32-bit unsigned, VAX (little-endian) byte order
1306 1313
 *                |         |
......
1643 1650
	    bigendian_p = 1;
1644 1651
	    goto unpack_integer;
1645 1652

  
1653
	  case 'Y':		/* unsigned long 64 bit (network byte-order) */
1654
            signed_p = 0;
1655
            integer_size = 8;
1656
            bigendian_p = 1;
1657
            goto unpack_integer;
1658

  
1646 1659
	  case 'v':
1647 1660
	    signed_p = 0;
1648 1661
	    integer_size = 2;
test/ruby/test_array.rb
946 946
    assert_equal(@cls[], a)
947 947
  end
948 948

  
949
  def test_pack_64_network
950
    assert_equal("\x0\x0\x0\x1\x0\x0\x0\x1", [(1 << 32) + 1].pack('Y'))
951
  end
952

  
953
  def test_unpack_64_network
954
    assert_equal((1 << 32) + 1, "\x0\x0\x0\x1\x0\x0\x0\x1".unpack('Y').first)
955
  end
956

  
949 957
  def test_pack
950 958
    a = @cls[*%w( cat wombat x yy)]
951 959
    assert_equal("catwomx  yy ", a.pack("A3A3A3A3"))