[squeak-dev] Integer bits

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Integer bits

Nicolas Cellier-3

To speed a little bit SmallInteger highBit and lowBit,
see http://bugs.squeak.org/view.php?id=7113

This is not a premature optimization.
These low level messages are important for a number of packages.
- DigitalSignature
- ArbitraryPrecisionFloat
- LargeInteger arithmetic / printing (mantis #6887)
- conversions:
   - Float asTrueFraction (mantis #3373)
   - Fraction asFloat (mantis #3568)
   - SqNumberParser (mantis #3512 #6976 #6982)
- ...
We can optimize further.
The precomputed array could be easily extended to 256 elements if needed.
Concerning space, a ByteArray would also be sufficient, but would
require a Class variable.

This helped me finding http://bugs.squeak.org/view.php?id=7114
Analysis of senders seems to indicate this flaw did not strike yet.
A long time since i did not find a bug. Is kernel stabilizing?

Last, for manipulating bits, i found that a bitAt: was lacking.
See http://bugs.squeak.org/view.php?id=6985

Nicolas