From a904f76704c1bd3d3a18d53494bb559f7d1c2b9f Mon Sep 17 00:00:00 2001 From: Connor Date: Mon, 10 Sep 2018 12:24:24 -0700 Subject: [PATCH] --- ac_encode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ac_encode.py b/ac_encode.py index 7592d17..57aacd2 100644 --- a/ac_encode.py +++ b/ac_encode.py @@ -82,8 +82,10 @@ def encode(string, c0=BETA0, c1=BETA1, adaptive=True): # if the gap a-b is getting small, rescale it while a > QUARTER and b < THREEQU: charstack[0] += 1 - a += a - HALF - b += b - HALF + a *= 2 + b *= 2 + a -= HALF + b -= HALF assert a <= HALF assert b >= HALF