diff options
| author | Julian Weigt <juw@posteo.de> | 2026-01-24 08:46:42 +0100 |
|---|---|---|
| committer | Julian Weigt <juw@posteo.de> | 2026-02-04 15:57:00 +0100 |
| commit | 64ff0a76657ed6e689c996d99c7b09e3a82629d3 (patch) | |
| tree | ab3a51d772f807ed8a70adfa14da7b0075d8fc93 /charf.c | |
| parent | 7107fc45c5316c2521165ea56d9d370860f0a905 (diff) | |
Order by smallest because we go through smallest first.
Diffstat (limited to 'charf.c')
| -rw-r--r-- | charf.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; |
