aboutsummaryrefslogtreecommitdiffstats
path: root/chilbert
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-07 17:48:28 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 14:46:16 +0200
commit5194cf21beef5a52aeb7454bd517b96eff5ff0a0 (patch)
treee4a18ab0857d5594afe75505e88b0656a5cec2e5 /chilbert
parent4984100559a00e055a502fc8fe85d7ca66589b36 (diff)
downloadchilbert-5194cf21beef5a52aeb7454bd517b96eff5ff0a0.tar.gz
chilbert-5194cf21beef5a52aeb7454bd517b96eff5ff0a0.tar.bz2
chilbert-5194cf21beef5a52aeb7454bd517b96eff5ff0a0.zip
Simplify compactIndex
This enables integral Compact Hilbert Indices.
Diffstat (limited to 'chilbert')
-rw-r--r--chilbert/GrayCodeRank.hpp22
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] );
}