From: William Djaja Tjokroaminata Date: 2002-10-17T09:05:14+09:00 Subject: Re: Porting a CRC function to ruby Hi Matthew, I think in Ruby it is for efficiency purpose. Ruby internal C implementation distinguishes objects (which are represented as VALUE, which is an alias for unsigned long) as either a pointer or an immediate object. Fixnum, which is an immediate object, is not allocated on Ruby gc heap, so it is "cheaper" to deal with Fixnum's; the only cost is that Fixnum is now only 31-bit significant instead of full 32-bit significant. You can also browse -talk starting at 53043 regarding the left shift and the least significant bit. Regards, Bill ============================================================================ Matthew Miller wrote: > Thanks for the insight. I tried my suggestion of masking off all but the > lower two bytes and the CRC works with the packets I've tested it with. > Still I wish that ruby had an unsigned integer class. > BTW, why does Fixnum left shift by one the integer it stores? I can't think > of any reason why that would be done.