diff options
Diffstat (limited to 'chilbert')
-rw-r--r-- | chilbert/GrayCodeRank.hpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/chilbert/GrayCodeRank.hpp b/chilbert/GrayCodeRank.hpp index 818b6dc..b067ce2 100644 --- a/chilbert/GrayCodeRank.hpp +++ b/chilbert/GrayCodeRank.hpp @@ -43,31 +43,29 @@ namespace chilbert HC &hc ) { - int i, j, hr, hcr; - FBV_UINT hm, hcm; + hc = 0; - hc.reset(); - - hr = hcr = 0; - hm = hcm = 1; + int hi = 0; + int hci = 0; // Run through the levels of precision - for ( i = 0; i < m; i++ ) + for ( int i = 0; i < m; i++ ) { // Run through the dimensions - j = ds[i]; + int j = ds[i]; do { // This dimension contributes a bit? if ( ms[j] > i ) { - if ( h.racks()[hr] & hm ) - hc.racks()[hcr] |= hcm; - hcm<<=1; if (hcm==0) {hcm=1;++hcr;} + if (testBit(h, hi)) { + setBit(hc, hci); + } + ++hci; } if ( ++j == n ) j = 0; - hm<<=1; if (hm==0) {hm=1;++hr;} + ++hi; } while ( j != ds[i] ); } |