From 7107fc45c5316c2521165ea56d9d370860f0a905 Mon Sep 17 00:00:00 2001 From: Julian Weigt Date: Fri, 23 Jan 2026 17:48:51 +0100 Subject: Only consider strings that end in 0. --- charf.c | 9 ++++----- 1 file 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; -- cgit v1.2.3