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

Discussion in 'Ruby' started by Clifford Heath, Mar 3, 2006.

  1. 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.
     
    Clifford Heath, Mar 3, 2006
    #1
    1. Advertising

  2. On Mar 2, 2006, at 7:58 PM, Clifford Heath wrote:

    > 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()
     
    Logan Capaldo, Mar 3, 2006
    #2
    1. Advertising

  3. Logan Capaldo wrote:
    > 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.
     
    Clifford Heath, Mar 3, 2006
    #3
  4. On Mar 3, 2006, at 1:58 AM, Clifford Heath wrote:

    > 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
     
    Daniel Harple, Mar 3, 2006
    #4
  5. On Mar 2, 2006, at 8:18 PM, Clifford Heath wrote:

    > Logan Capaldo wrote:
    >> 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.
    >


    Hopefully by now you've seen Daniel's more accurate response. (LL2NUM
    (x))
     
    Logan Capaldo, Mar 3, 2006
    #5
  6. Daniel Harple wrote:
    > 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.
     
    Clifford Heath, Mar 3, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bright
    Replies:
    1
    Views:
    548
  2. Timo Dammes
    Replies:
    2
    Views:
    6,541
    Elliot Schei
    Jun 11, 2004
  3. bob

    Shift register example?

    bob, Feb 18, 2005, in forum: VHDL
    Replies:
    1
    Views:
    3,269
    Ralf Hildebrandt
    Feb 18, 2005
  4. Sam Roberts
    Replies:
    15
    Views:
    308
    Sam Roberts
    Feb 7, 2005
  5. unbewusst
    Replies:
    4
    Views:
    109
    unbewusst
    Aug 22, 2007
Loading...

Share This Page