catacomb/__init__.py (KeySZRange.pad): Return correct value.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 17 Nov 2019 23:23:41 +0000 (23:23 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 27 Nov 2019 15:11:29 +0000 (15:11 +0000)
If the input is already a multiple of the modulus, then don't round up
to the next one.

catacomb/__init__.py

index 9178475..65695bb 100644 (file)
@@ -623,7 +623,7 @@ class _tmp:
   def pad(me, sz):
     if sz > me.max: raise ValueError, 'key too large'
     elif sz < me.min: return me.min
-    else: sz += me.mod; return sz - sz%me.mod
+    else: sz += me.mod - 1; return sz - sz%me.mod
 _augment(KeySZRange, _tmp)
 
 class _tmp: