Example of how to rb_class_new_instance(... rb_cBignum)?

C

Clifford Heath

I'm building a C extension and have a "long long"
which I want to turn into a Bignum. Can anyone
point me to an example please? I've googled without
success.

Clifford Heath.
 
L

Logan Capaldo

I'm building a C extension and have a "long long"
which I want to turn into a Bignum. Can anyone
point me to an example please? I've googled without
success.

Clifford Heath.

Basing this purely on a random guess (based on reasonable assumptions
about ruby) try:
LONGLONG2NUM()
 
C

Clifford Heath

Logan said:
Basing this purely on a random guess (based on reasonable assumptions
about ruby) try:
LONGLONG2NUM()

Reasonable guess I suppose, except that doesn't seem to
be declared anywhere (ruby 1.8.1-11) :-(.

Clifford.
 
D

Daniel Harple

I'm building a C extension and have a "long long"
which I want to turn into a Bignum. Can anyone
point me to an example please? I've googled without
success.

Clifford Heath.

VALUE foo = LL2NUM(my_long);

-- Daniel
 
L

Logan Capaldo

Reasonable guess I suppose, except that doesn't seem to
be declared anywhere (ruby 1.8.1-11) :-(.

Clifford.

Hopefully by now you've seen Daniel's more accurate response. (LL2NUM
(x))
 
C

Clifford Heath

Daniel said:
VALUE foo = LL2NUM(my_long);

Thanks both. I have my extension working.

Kudos to Matz also - it's really easy to build these things :).

Clifford Heath.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top