summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Weigt <juw@posteo.de>2026-01-23 17:48:51 +0100
committerJulian Weigt <juw@posteo.de>2026-02-04 15:57:00 +0100
commit7107fc45c5316c2521165ea56d9d370860f0a905 (patch)
tree7d741ef4b16cb4880f54d25c8e69493da8dc157f
parent2d1d2bb2cbb6eb0702e6f7a17f8e867bc1de227d (diff)
Only consider strings that end in 0.
-rw-r--r--charf.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/charf.c b/charf.c
index d179b29..cc75381 100644
--- a/charf.c
+++ b/charf.c
@@ -158,9 +158,8 @@ void compute_maximalfunction(VALUETYPE* f, VALUETYPE* Mf, int D){
int generate_each_charf(VALUETYPE* f, index_t i){
index_t s=0;
int d=2;
- /*number of strings of length d that begin with 1*/
- index_t powd = 1UL << d-1;
- /*number of strings of length d that begin with 1 but are not all 1*/
+ /*number of strings of length d that begin with 1 and end with 0*/
+ index_t powd = 1UL << d-2;
while(i-s >= powd-1){
s += powd-1;
d++;
@@ -169,8 +168,8 @@ int generate_each_charf(VALUETYPE* f, index_t i){
if(d>N) return -1;
- /*t starts with 1 and then comes i-s.*/
- index_t t = (1UL << d-1) + i-s;
+ /*t starts with 1, then comes i-s and then 0.*/
+ index_t t = (1UL << d-1) + ( (i-s) << 1 );
/*Indicates if we want to consider this t.*/
bool is_representative = true;