summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-04 02:35:07 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-04 02:35:07 +0000
commit106595827ad33295d2f5bd1c1255c87293215a54 (patch)
treef36ca132f726e4c77d3e7ab458eabd1425b46af1
parentda39199964fe8d8e87ac94c737376835f3cec2d1 (diff)
* ext/openssl/ossl_bn.c (ossl_bn_to_i): Use bn2hex to speed up.
In general, binary to/from decimal needs extra cost. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/openssl/ossl_bn.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 853d4071c2..3697bfc704 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Apr 4 11:33:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_bn.c (ossl_bn_to_i): Use bn2hex to speed up.
+ In general, binary to/from decimal needs extra cost.
+
Thu Apr 4 07:24:18 2013 Tanaka Akira <akr@fsij.org>
* ext/socket/extconf.rb: Specify arguments to test functions.
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 822b854efe..1038135ae8 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -226,10 +226,10 @@ ossl_bn_to_i(VALUE self)
GetBN(self, bn);
- if (!(txt = BN_bn2dec(bn))) {
+ if (!(txt = BN_bn2hex(bn))) {
ossl_raise(eBNError, NULL);
}
- num = rb_cstr_to_inum(txt, 10, Qtrue);
+ num = rb_cstr_to_inum(txt, 16, Qtrue);
OPENSSL_free(txt);
return num;