summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Weigt <juw@posteo.de>2026-01-24 08:46:42 +0100
committerJulian Weigt <juw@posteo.de>2026-02-04 15:57:00 +0100
commit64ff0a76657ed6e689c996d99c7b09e3a82629d3 (patch)
treeab3a51d772f807ed8a70adfa14da7b0075d8fc93
parent7107fc45c5316c2521165ea56d9d370860f0a905 (diff)
Order by smallest because we go through smallest first.
-rw-r--r--charf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/charf.c b/charf.c
index cc75381..63ee0d8 100644
--- a/charf.c
+++ b/charf.c
@@ -169,7 +169,7 @@ int generate_each_charf(VALUETYPE* f, index_t i){
if(d>N) return -1;
/*t starts with 1, then comes i-s and then 0.*/
- index_t t = (1UL << d-1) + ( (i-s) << 1 );
+ index_t t = ( (i-s) << 1 ) + 1UL;
/*Indicates if we want to consider this t.*/
bool is_representative = true;
@@ -190,11 +190,11 @@ int generate_each_charf(VALUETYPE* f, index_t i){
/*Such t which may equal its translates have already been filtered out by the previous step because they are copies of at least two shorter functions.*/
index_t ones = 0;
for(int o = 0; o<d; o++) ones += 1UL << o;
- if(is_representative) for(int n=1; n<d; n++) if( t <= ( (t<<n) & ones ) + ((t>>(d-n)) & ones) ) is_representative = false;
+ if(is_representative) for(int n=1; n<d; n++) if( t >= ( (t<<n) & ones ) + ((t>>(d-n)) & ones) ) is_representative = false;
/*Set f to the values encoded in bit string t which is a value between 1 and powd = (1<<d)-2.*/
if(is_representative){
- for(int n=0; n<d; n++) f[n] = int_to_valuetype((t >> (d-n-1)) & 1);
+ for(int n=0; n<d; n++) f[n] = int_to_valuetype((t >> n) & 1);
return d;
}
else return 0;