|
On Fri, Aug 22, 2008 at 09:14:12PM +0300, Igor Stasenko wrote:
> I just stumbled over a trap with MillisecondClockMask value which is
> 16r1FFFFFFF
> while in Hydra code i using another mask - 16r3FFFFFFF
>
> Can anyone tell, why mask is 1 bit shorter than maximum safe value?
>
> 16r3FFFFFFF << 1 + 1 ---> 16r7FFFFFFF - fits in positive smallint
Igor,
I don't know the answer to this, but I can take a guess. When running
an InterpreterSimulator, the shorter bitmask helps to ensure that the
receiver of #bitAnd: will be an instance of SmallInteger.
> What you think, what mask is better to keep?
> I don't think that changing a mask will make any difference to
> language side. Because this mask used only together with millisecond
> clock values , which in C is 32 bit wrappable counter. Losing some
> high bits don't makes much difference , but i think using 16r3FFFFFFF
> would be better, or if not, please, tell me why.
The only practical difference is that the clock rolls over at least once
every 6 days rather than at least once every 12 days. I would leave the
mask alone. Dan Ingalls wrote the original code, and I suspect that he
had a good reason for the mask value that he picked, even if I'm only
guessing at what the reason was ;)
my $0.02,
Dave
|