Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > FIXNUM Size

Reply
Thread Tools

FIXNUM Size

 
 
Jabari Zakiya
Guest
Posts: n/a
 
      07-24-2004
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.
 
Reply With Quote
 
 
 
 
Charles Mills
Guest
Posts: n/a
 
      07-24-2004

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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby's implementation of Fixnum-assignment RichardOnRails C++ 1 12-21-2009 03:51 PM
Float Arithmetic: Return A Fixnum When Float == Fixnum MaggotChild Ruby 6 12-02-2009 04:28 AM
Why Fixnum===Fixnum is false? Heesob Park Ruby 5 05-14-2009 12:31 AM
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM



Advertisments