summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/base64.scm7
1 files changed, 2 insertions, 5 deletions
diff --git a/chickadee/base64.scm b/chickadee/base64.scm
index 8fe384c..6575785 100644
--- a/chickadee/base64.scm
+++ b/chickadee/base64.scm
@@ -122,17 +122,14 @@ return a bytevector containing the decoded data."
(let ((offset (* i 3)))
(cond
((< i groups)
- (let ((x (logior (ash (bytevector-u8-ref bv offset) 16)
- (ash (bytevector-u8-ref bv (1+ offset)) 8)
- (bytevector-u8-ref bv (+ offset 2)))))
+ (let ((x (bytevector-uint-ref bv offset (endianness big) 3)))
(put-char port (encode (ash (logand x #xfc0000) -18)))
(put-char port (encode (ash (logand x #x03f000) -12)))
(put-char port (encode (ash (logand x #x000fc0) -6)))
(put-char port (encode (logand x #x00003f)))
(lp (1+ i))))
((eq? padding 1)
- (let ((x (logior (ash (bytevector-u8-ref bv offset) 8)
- (bytevector-u8-ref bv (1+ offset)))))
+ (let ((x (bytevector-u16-ref bv offset (endianness big))))
(put-char port (encode (ash (logand x #xfc00) -10)))
(put-char port (encode (ash (logand x #x03f0) -4)))
(put-char port (encode (ash (logand x #x000f) 2)))