From: Jeffrey Schwab Date: 2006-10-26T22:45:13+09:00 Subject: Re: simple math question Ken Bloom wrote: > On Thu, 26 Oct 2006 01:19:08 +0000, Jeffrey Schwab wrote: > >> Paul Lutus wrote: >>> Brad Tilley wrote: >>> >>>> Thanks for all the examples guys! Being Ruby, I thought there might be >>>> some super simple method that just magically did this. I'll stick with >>>> the old-fashioned modulo test. >>> If speed matters, the modulo test is way slower than testing the LSB. >> Do you mean on a specific architecture, or is there a Ruby-specific >> reason for one to be slower than the other? > > Modulo uses division hardware, which is slower than the hardware for > bitwise operations. On what modern architecture? (I write x86 firmware.)