From 5194cf21beef5a52aeb7454bd517b96eff5ff0a0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 7 Aug 2018 17:48:28 +0200 Subject: Simplify compactIndex This enables integral Compact Hilbert Indices. --- chilbert/GrayCodeRank.hpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'chilbert/GrayCodeRank.hpp') 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] ); } -- cgit v1.2.1