summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-16 19:43:24 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-16 19:43:24 +0000
commitb86269e445e85cb6a7fdfb6361328004d20caadc (patch)
treea8cd9194798196df8db9caeadbab7eb255a5feba /bignum.c
parent73deb733926e8b4cf58949141d11a1083911f227 (diff)
* pack.c: all features are backport from 1.9. [ruby-dev:24826]
* bignum.c (rb_big2ulong_pack): new function to pack Bignums. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bignum.c b/bignum.c
index 06228416bf..aba88df04d 100644
--- a/bignum.c
+++ b/bignum.c
@@ -748,6 +748,17 @@ big2ulong(x, type)
}
unsigned long
+rb_big2ulong_pack(x)
+ VALUE x;
+{
+ unsigned long num = big2ulong(x, "unsigned long", Qfalse);
+ if (!RBIGNUM(x)->sign) {
+ return -num;
+ }
+ return num;
+}
+
+unsigned long
rb_big2ulong(x)
VALUE x;
{