diff options
| -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; |
