#include <Iguana/Utilities/classlib/utils/BitOps.h>
Classes | |
struct | Type |
Magic numbers have unusual or special properties in certain calculations. With binary magic numbers discussed by [Freed, Edwin E. 1983. "Binary Magic Numbers---Some Applications and Algorithms", Dr Dobb's Journal, 8(4: April), pp 24--37.] it is possible to write algorithms that are typically faster by a factor of $N/log_2(N)$ than the more obvious ones. They can be used to:
The binary magic numbers come in a sequence (hence this recursive template) where the Nth number is itself an infinite binary number from right to left of $2^N$ ones follwed by $2^N$ zeroes, followed by $2^N$ ones and so on. The first five numbers in the sequence are ...0101010101010101, ...0011001100110011, ...0000111100001111 and ...0000000011111111. Often one will use just these patterns, but occasionally also the inverse (= one's complement) reverse pattern.
The patterns have B (which must be a power of two, i.e. $2^N$ above) consequtive ones and or zeros. It is assumed that T, the unsigned integral type used as the "word" in the operations, has a size that is a power of two.
Definition at line 94 of file BitOps.h.