| 23 | } |
| 24 | |
| 25 | int RandomTable::Seed(int x, int z, int y) const |
| 26 | { |
| 27 | // make x, z out of order |
| 28 | const int mask = Size - 1; |
| 29 | x = _table[x & mask]; |
| 30 | z = _table[z & mask]; |
| 31 | y = _table[y & mask]; |
| 32 | // bitwise interleave x, z, and y |
| 33 | int xz = 0; |
| 34 | // only 12 bits is significant |
| 35 | xz <<= 1, xz |= x & 1, x >>= 1; |
| 36 | xz <<= 1, xz |= z & 1, z >>= 1; |
| 37 | xz <<= 1, xz |= y & 1, y >>= 1; |
| 38 | |
| 39 | xz <<= 1, xz |= x & 1, x >>= 1; |
| 40 | xz <<= 1, xz |= z & 1, z >>= 1; |
| 41 | xz <<= 1, xz |= y & 1, y >>= 1; |
| 42 | |
| 43 | xz <<= 1, xz |= x & 1, x >>= 1; |
| 44 | xz <<= 1, xz |= z & 1, z >>= 1; |
| 45 | xz <<= 1, xz |= y & 1, y >>= 1; |
| 46 | |
| 47 | xz <<= 1, xz |= x & 1, x >>= 1; |
| 48 | xz <<= 1, xz |= z & 1, z >>= 1; |
| 49 | xz <<= 1, xz |= y & 1, y >>= 1; |
| 50 | return xz; |
| 51 | } |
| 52 | |
| 53 | int RandomTable::Seed(int x, int z) const |
| 54 | { |
no outgoing calls
no test coverage detected