Skip to content

Commit

Permalink
fix performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchan0321 committed Jul 24, 2024
1 parent c10fcd5 commit 31df95a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/hexdump.prfm
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ begin {
set eof <nil>;
set p 0;
while {false? eof} do: {
[1 .. 16 do: {| i | symbol ["c%d" fmt $i]}] := [1 .. 16 do: {$b get}];
(c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16) := [1 .. 16 do: {$b get}];

d := "";
1 each to: 16 do: {| i |
s ::= symbol ["c%d" fmt $i];
if {nil? [set $s]} {
(c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16) each do: {| i |
s ::= set $i;
if $s {
$d append! [$HexChar get $s];
set $i ["%02x" fmt $s];
} {
$d append! " ";
set $s " ";
set $i " ";
set eof <t>;
} {
$d append! [$HexChar get [set $s]];
set $s ["%02x" fmt [set $s]];
};
};
println ["%08d %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v" fmt
Expand Down

0 comments on commit 31df95a

Please sign in to comment.