Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dylan-lang/base64
base: 86aeab78d8
...
head fork: dylan-lang/base64
compare: 9236e0037c
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Showing with 8 additions and 11 deletions.
  1. +6 −6 base64.dylan
  2. +2 −5 library.dylan
View
12 base64.dylan
@@ -58,15 +58,15 @@ define function base64-encode
when (sidx + n < string.size)
let char-code :: <integer> = as(<integer>, string[sidx + n]);
value := logior(value, logand(#xFF, char-code));
- inc!(chars);
+ chars := chars + 1;
end;
when (n = 1)
value := ash(value, 8);
end;
end;
- result[didx + 3] := encoding-vector[iff(chars > 3, logand(value, #x3F), 64)];
+ result[didx + 3] := encoding-vector[if (chars > 3) logand(value, #x3F) else 64 end];
value := ash(value, -6);
- result[didx + 2] := encoding-vector[iff(chars > 2, logand(value, #x3F), 64)];
+ result[didx + 2] := encoding-vector[if (chars > 2) logand(value, #x3F) else 64 end];
value := ash(value, -6);
result[didx + 1] := encoding-vector[logand(value, #x3F)];
value := ash(value, -6);
@@ -92,15 +92,15 @@ define function base64-decode
let value = decoding-vector[as(<integer>, char)];
unless (value == -1 | value == 64)
bitstore := logior(ash(bitstore, 6), value);
- inc!(bitcount, 6);
+ bitcount := bitcount + 6;
when (bitcount >= 8)
- dec!(bitcount, 8);
+ bitcount := bitcount - 8;
let code = logand(ash(bitstore, 0 - bitcount), #xFF);
if (zero?(code))
exit-block();
else
result[ridx] := as(<byte-character>, code);
- inc!(ridx);
+ ridx := ridx + 1;
bitstore := logand(bitstore, #xFF);
end;
end;
View
7 library.dylan
@@ -5,17 +5,14 @@ License: This code is in the public domain
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
define library base64
+ use dylan;
use common-dylan;
- use io;
- use uncommon-dylan;
export base64;
end;
define module base64
use dylan;
- use common-extensions, exclude: { format-to-string };
- use uncommon-dylan, exclude: { split };
- use streams;
+ use dylan-extensions, import: { <byte-character>, when };
export
base64-encode,
base64-decode;

No commit comments for this range

Something went wrong with that request. Please try again.