September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,11 +1,11 @@
|
|||
sub encode-ascii(Str $s) {
|
||||
my @b = $s.ords».fmt("%07b")».comb;
|
||||
my @b = flat $s.ords».fmt("%07b")».comb;
|
||||
@b.push(0) until @b %% 8; # padding
|
||||
Buf.new: gather while @b { take reduce * *2+*, (@b.pop for ^8) }
|
||||
}
|
||||
|
||||
sub decode-ascii(Buf $b) {
|
||||
my @b = $b.list».fmt("%08b")».comb;
|
||||
my @b = flat $b.list».fmt("%08b")».comb;
|
||||
@b.shift until @b %% 7; # remove padding
|
||||
@b = gather while @b { take reduce * *2+*, (@b.pop for ^7) }
|
||||
return [~] @b».chr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue