From: Ned Konz Date: 2001-08-04T15:36:56+09:00 Subject: [ruby-talk:19111] Re: Endianness and integer indexing On Friday 03 August 2001 11:08 pm, you wrote: > You mean "& 1", right? As in, " if (a & 1)==0 then > print 'even' ; else print 'odd' ; end;". Sorry, yes, of course that's what I meant. Fingers too fast tonight (or brain too slow). > 10000.times { if > > 5213451352345234523452345234523452345234523612345123412341234123412341234[0 >] == 0 ; then a=true; else a=false; end } > > Use the Unix 'time' command or the profiler, either way. I get 5.5 microseconds per repetition. i.e. 1e6 reps was a little over 5 seconds. This is with a 466/533 Celeron. How long is it taking you? Interestingly, this is about 3x as fast as Squeak (Smalltalk), which actually has a LargeIntegers plugin (written in C) that's there for digital signature algorithms. Their bitAnd: method is a primitive in this plugin. Perhaps they did something wrong... -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com