FIXNUM Size

Discussion in 'Ruby' started by Jabari Zakiya, Jul 24, 2004.

  1. Currently FIXNUMs are set to fit 32-bit CPUs.

    For 64-bit CPUs (AMD, etc) will a FIXNUMs scale to
    fit 64-bit registers, or remain the same.
     
    Jabari Zakiya, Jul 24, 2004
    #1
    1. Advertising

  2. On Jul 24, 2004, at 12:11 PM, Jabari Zakiya wrote:

    > Currently FIXNUMs are set to fit 32-bit CPUs.
    >
    > For 64-bit CPUs (AMD, etc) will a FIXNUMs scale to
    > fit 64-bit registers, or remain the same.
    >

    They scale, see ruby.h for more details but here are some of the
    relevant parts:

    #if SIZEOF_LONG != SIZEOF_VOIDP
    # error ---->> ruby requires sizeof(void*) == sizeof(long) to be
    compiled. <<----
    #endif
    typedef unsigned long VALUE;

    /* ...snip ... */

    #define FIXNUM_MAX (LONG_MAX>>1)

    /* ...snip ... */

    #define INT2FIX(i) ((VALUE)(((long)(i))<<1 | FIXNUM_FLAG))
    #define LONG2FIX(i) INT2FIX(i)

    -Charlie
     
    Charles Mills, Jul 24, 2004
    #2
    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. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    12,742
    Michael Jung
    May 25, 2008
  2. RichardOnRails
    Replies:
    1
    Views:
    423
    RichardOnRails
    Dec 21, 2009
  3. Kero
    Replies:
    0
    Views:
    228
  4. Heesob Park

    Why Fixnum===Fixnum is false?

    Heesob Park, May 13, 2009, in forum: Ruby
    Replies:
    5
    Views:
    139
    Joel VanderWerf
    May 14, 2009
  5. MaggotChild
    Replies:
    6
    Views:
    152
    MaggotChild
    Dec 2, 2009
Loading...

Share This Page