diff --git a/src/encoder.ts b/src/encoder.ts index 411f6e3..635a5c9 100644 --- a/src/encoder.ts +++ b/src/encoder.ts @@ -15,8 +15,8 @@ function encode6bit(b: number) { function encode3bytes(b1: number, b2: number, b3: number) { return encode6bit((b1 >> 2) & 0x3f).concat( - encode6bit(((b1 & 0x3) << 4) | ((b2 >> 4) & 0x3f)), - encode6bit(((b2 & 0xf) << 2) | ((b3 >> 6) & 0x3f)), + encode6bit((((b1 & 0x3) << 4) | (b2 >> 4)) & 0x3f), + encode6bit((((b2 & 0xf) << 2) | (b3 >> 6)) & 0x3f), encode6bit(b3 & 0x3f), ); }