diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-06 21:20:04 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-06 21:20:04 +0000 |
commit | c9c67d2fe0d8d502d444c477d3272c4092513a53 (patch) | |
tree | 81a21632cffe836b8e768ed733eedcbfd999426a /ext/-test- | |
parent | 64ed7df5434bc2978d5a92a1e750bab39b11edfa (diff) |
* bignum.c (rb_int_import): New function.
(int_import_push_bits): Ditto.
* internal.h (rb_int_import): Declared.
* pack.c (pack_unpack): Use rb_int_import for BER compressed integer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-')
-rw-r--r-- | ext/-test-/bignum/depend | 1 | ||||
-rw-r--r-- | ext/-test-/bignum/import.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/ext/-test-/bignum/depend b/ext/-test-/bignum/depend index 2787ca3196..217aed9dac 100644 --- a/ext/-test-/bignum/depend +++ b/ext/-test-/bignum/depend @@ -1,3 +1,4 @@ $(OBJS): $(HDRS) $(ruby_headers) export.o: export.c $(top_srcdir)/internal.h +import.o: import.c $(top_srcdir)/internal.h diff --git a/ext/-test-/bignum/import.c b/ext/-test-/bignum/import.c new file mode 100644 index 0000000000..22cc86dcde --- /dev/null +++ b/ext/-test-/bignum/import.c @@ -0,0 +1,18 @@ +#include "ruby.h" +#include "internal.h" + +static VALUE +rb_int_import_m(VALUE klass, VALUE sign, VALUE buf, VALUE wordcount, VALUE wordorder, VALUE wordsize, VALUE endian, VALUE nails) +{ + StringValue(buf); + + return rb_int_import(NUM2INT(sign), RSTRING_PTR(buf), + NUM2SIZE(wordcount), NUM2INT(wordorder), NUM2SIZE(wordsize), + NUM2INT(endian), NUM2SIZE(nails)); +} + +void +Init_import(VALUE klass) +{ + rb_define_singleton_method(rb_cInteger, "test_import", rb_int_import_m, 7); +} |