aboutsummaryrefslogtreecommitdiff
path: root/gen
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-28 09:38:33 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-28 09:38:33 +0200
commitc81b789d32d280ce8c9c5da5022798619e8ee7a6 (patch)
treef585c915a25ae3a83e90c728f1886872bd51b749 /gen
parentb0a33e153973a1db86fe1d6aa2fbba53cee374a2 (diff)
Fix columns()
Diffstat (limited to 'gen')
-rwxr-xr-xgen/prop/bool-props.py2
-rwxr-xr-xgen/prop/gc2
-rw-r--r--gen/prop/lib.py4
3 files changed, 4 insertions, 4 deletions
diff --git a/gen/prop/bool-props.py b/gen/prop/bool-props.py
index 32a293e..c0f9d05 100755
--- a/gen/prop/bool-props.py
+++ b/gen/prop/bool-props.py
@@ -44,7 +44,7 @@ def genfile(cs: list[tuple[bool, ...]], blksize: int) -> None:
print()
bcnt = blksize // 8
- bpc = columns(bcnt)
+ bpc = columns(bcnt, 5)
print(f'static constexpr unsigned char stage2[][{bcnt}] = {{')
for c in cs:
x = sum(map(lambda x: x[1] << x[0], enumerate(c)))
diff --git a/gen/prop/gc b/gen/prop/gc
index 4f95242..f37cb4b 100755
--- a/gen/prop/gc
+++ b/gen/prop/gc
@@ -40,7 +40,7 @@ def genfile(cs: list[tuple[bool, ...]], blksize: int) -> None:
print()
- ppc = columns(blksize)
+ ppc = columns(blksize, 6)
print(f'static constexpr enum uprop_gc stage2[][{blksize}] = {{')
for c in cs:
for i in range(blksize // ppc):
diff --git a/gen/prop/lib.py b/gen/prop/lib.py
index 0912208..e71fcf0 100644
--- a/gen/prop/lib.py
+++ b/gen/prop/lib.py
@@ -14,13 +14,13 @@ def powers_of_2() -> Generator[int, None, None]:
yield 2 ** i
i += 1
-def columns(n: int) -> int:
+def columns(n: int, m: int) -> int:
xs = list(set(functools.reduce(list.__add__, (
[i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)
)))
for x in sorted(xs, reverse=True):
y = 5
- y += x * 5
+ y += x * m
y += x - 1
if y <= 80:
return x