summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Weigt <juw@posteo.de>2026-01-23 12:07:34 +0100
committerJulian Weigt <juw@posteo.de>2026-02-04 15:56:59 +0100
commitfe916c402bab77a97286a56cfe4a3992092749bb (patch)
treed166cc81601547810216553ccf26891ccc0e8bcc
parenta77a26bb356b70684be89d86b95713daa5db8b3f (diff)
Write 1UL instead of 1 for function representation to make shift operation work correctly.
-rw-r--r--charf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/charf.c b/charf.c
index b3aa4e0..53ab4ef 100644
--- a/charf.c
+++ b/charf.c
@@ -37,7 +37,7 @@
typedef unsigned long index_t;
/*maximum length of the support of f*/
-#define N 32
+#define N 36
/*maximal order of derivative*/
#define K 64
@@ -157,9 +157,9 @@ void compute_maximalfunction(VALUETYPE* f, VALUETYPE* Mf, int D){
/*Generates all characteristic functions of length up N.*/
int generate_each_charf(VALUETYPE* f, index_t i){
index_t s=0;
- int d=1;
+ int d=31;
/*number of strings of length d that begin with 1*/
- index_t powd = 1;
+ index_t powd = 1UL << d-1;
/*number of strings of length d that begin with 1 but are not all 1*/
while(i-s >= powd-1){
s += powd-1;
@@ -170,7 +170,7 @@ 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 = (1 << d-1) + i-s;
+ index_t t = (1UL << d-1) + i-s;
/*Indicates if we want to consider this t.*/
bool is_representative = true;
@@ -180,7 +180,7 @@ int generate_each_charf(VALUETYPE* f, index_t i){
if(d % r == 0){
bool is_r_copy = true;
index_t ones = 0;
- for(int o = 0; o<r; o++) ones += ((index_t)1)<<o;
+ for(int o = 0; o<r; o++) ones += 1UL <<o;
index_t tail = t & ones;
for(int n = 1; n < d/r; n++) if( ( (t>>n*r) & ones ) != tail ) is_r_copy = false;
if(is_r_copy) is_representative = false;