hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 6b4d7c63e4e4cfe643148f7ab19ead9e1eb6e417
parent 8d53a9b1060d8396de32f63471b771176dbdc7ab
Author: Ajay R <ar324@protonmail.com>
Date:   Wed, 23 Feb 2022 09:20:33 +0000

base32 and base64: fix iteration variable's decrement logic

Signed-off-by: Ajay R <ar324@protonmail.com>

Diffstat:
Mencoding/base32/base32.ha | 4++--
Mencoding/base64/base64.ha | 4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/encoding/base32/base32.ha b/encoding/base32/base32.ha @@ -116,8 +116,8 @@ fn decode_reader( let valid = true; let np = 0; // Number of padding chars. let p = true; // Pad allowed in buf - for (let i = nr: i64 - 1; i >= 0; i -= 1) { - const ch = buf[i]; + for (let i = nr; i > 0; i -= 1) { + const ch = buf[i - 1]; if (ch == PADDING) { if(s.pad || !p) { valid = false; diff --git a/encoding/base64/base64.ha b/encoding/base64/base64.ha @@ -274,8 +274,8 @@ fn decode_reader( let valid = true; let np = 0; // Number of padding chars. let p = true; // Pad allowed in buf - for (let i = nr: i64 - 1; i >= 0; i -= 1) { - const ch = buf[i]; + for (let i = nr; i > 0; i -= 1) { + const ch = buf[i - 1]; if (ch == PADDING) { if(s.pad || !p) { valid = false;