From 0c9a719d7728e026e2bd4dfef61d940d3ca7248f Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 11 Jun 2013 21:39:55 +0000 Subject: * internal.h (INTEGER_PACK_NEGATIVE): Defined. (rb_integer_unpack): sign argument removed. * bignum.c (rb_integer_unpack): sign argument removed. Non-negative integers generated by default. INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers. * pack.c (pack_unpack): Follow the above change. * random.c (int_pair_to_real_inclusive): Ditto. (make_seed_value): Ditto. (mt_state): Ditto. (limited_big_rand): Ditto. * marshal.c (r_object0): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/-test-/bignum/pack.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ext/-test-/bignum') diff --git a/ext/-test-/bignum/pack.c b/ext/-test-/bignum/pack.c index 2544a92176..553c101be6 100644 --- a/ext/-test-/bignum/pack.c +++ b/ext/-test-/bignum/pack.c @@ -54,11 +54,11 @@ rb_integer_pack_2comp_m(VALUE val, VALUE numwords_arg, VALUE wordsize_arg, VALUE } static VALUE -rb_integer_unpack_m(VALUE klass, VALUE sign, VALUE buf, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags) +rb_integer_unpack_m(VALUE klass, VALUE buf, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags) { StringValue(buf); - return rb_integer_unpack(NUM2INT(sign), RSTRING_PTR(buf), + return rb_integer_unpack(RSTRING_PTR(buf), NUM2SIZET(numwords), NUM2SIZET(wordsize), NUM2SIZET(nails), NUM2INT(flags)); } @@ -69,7 +69,7 @@ Init_pack(VALUE klass) rb_define_method(rb_cInteger, "test_pack_raw", rb_integer_pack_raw_m, 5); rb_define_method(rb_cInteger, "test_pack", rb_integer_pack_m, 4); rb_define_method(rb_cInteger, "test_pack_2comp", rb_integer_pack_2comp_m, 4); - rb_define_singleton_method(rb_cInteger, "test_unpack", rb_integer_unpack_m, 6); + rb_define_singleton_method(rb_cInteger, "test_unpack", rb_integer_unpack_m, 5); rb_define_const(rb_cInteger, "INTEGER_PACK_MSWORD_FIRST", INT2NUM(INTEGER_PACK_MSWORD_FIRST)); rb_define_const(rb_cInteger, "INTEGER_PACK_LSWORD_FIRST", INT2NUM(INTEGER_PACK_LSWORD_FIRST)); rb_define_const(rb_cInteger, "INTEGER_PACK_MSBYTE_FIRST", INT2NUM(INTEGER_PACK_MSBYTE_FIRST)); @@ -77,4 +77,6 @@ Init_pack(VALUE klass) rb_define_const(rb_cInteger, "INTEGER_PACK_NATIVE_BYTE_ORDER", INT2NUM(INTEGER_PACK_NATIVE_BYTE_ORDER)); rb_define_const(rb_cInteger, "INTEGER_PACK_LITTLE_ENDIAN", INT2NUM(INTEGER_PACK_LITTLE_ENDIAN)); rb_define_const(rb_cInteger, "INTEGER_PACK_BIG_ENDIAN", INT2NUM(INTEGER_PACK_BIG_ENDIAN)); + rb_define_const(rb_cInteger, "INTEGER_PACK_FORCE_BIGNUM", INT2NUM(INTEGER_PACK_FORCE_BIGNUM)); + rb_define_const(rb_cInteger, "INTEGER_PACK_NEGATIVE", INT2NUM(INTEGER_PACK_NEGATIVE)); } -- cgit v1.2.3