This is by Andres Valloud (who also wrote Fundamentals of Smalltalk Programming Technique). This has a catalogue of different hash functions, but the exercises are particularly interesting.
For testing and exercises, I used a 64 bit squeak on Linux.
The first chapter begins with several bit operations, more examples can be found here. Exercise 1.25 lists some problems with VSE square-root, not sure how 3 vseSqrtFloor
is reported to evaluate to 2 - it evaluated to 1 in squeak. It is significantly slower than sqrtFloor
- 33 per second vs 10k for:
[(2 raisedTo: 512) vseSqrtFloor = (2 raisedTo: 256)] bench. [(2 raisedTo: 512) sqrtFloor = (2 raisedTo: 256)] bench.
Exercise 1.26 states that:
((2*n) choose: n)
is either divisible by 4 or 9 except for n=64 or n=256, but it is also true for n=1,2,4. The choose: message is defined in later exercises.