
13 Nov
2007
13 Nov
'07
9:31 p.m.
On Tue, 2007-11-13 at 14:21 -0800, Ryan Ingram wrote:
On 11/13/07, Ryan Ingram
wrote: Also, what stops getRule from going off the end of the array? I didn't see anything that prevented that in the code, and you're using unsafeAt, which seems like a potential bug. Never mind, I realized this is a ring buffer with `mod` s. That's another slow operation when you're doing code as tight as this. If you can guarantee the ring is a power of 2 in size you can use a mask instead, or use my original suggestion of deriving rules from the previous rule and the new bit; the initial state is determined by the last bits in the buffer and you never wrap.
rem is faster than mod and equivalent if everything is positive.