From: Brian Candler Date: 2002-10-12T19:44:42+09:00 Subject: Re: Things That Newcomers to Ruby Should Know On Sat, Oct 12, 2002 at 11:11:47AM +0100, Brian Candler wrote: > However in practise this is efficient, since there appears to be a very > compact internal representation of references to Fixnums: > > irb(main):001:0> 0.id > 1 > irb(main):002:0> 1.id > 3 > irb(main):003:0> 2.id > 5 ... which I presume is cleverly exploiting the property that in the underlying processor, all pointers need to point to objects which are word-aligned; a word is 16 bits (2 bytes) or a multiple thereof; and therefore all valid pointers are even. So if an odd pointer cannot be valid, we might as well use it to represent a Fixnum, with the value in the top 31 bits. Brian.