spir <denis.s...@gmail.com> wrote:
foreach ( i; 0..BIT_SIZE ) {
bit = ( code >> i ) & 1;
node = node.nodes[bit];
}
You have not read my post carefully enough ;-) That's ~ how I coded
traversing the bit seq backwards (right-to-left, LSB -> MSB); but I was
trying to find a way to traverse it forwards.
Sorry. Indeed I messed up:
foreach_reverse ( i; 0..BIT_SIZE ) {
bit = ( code >> i ) & 1;
node = node.nodes[bit];
}
or
foreach ( i; 0..BIT_SIZE ) {
bit = ( code >> ( BIT_SIZE + 1 - i ) ) & 1;
node = node.nodes[bit];
}
--
Simen