summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-06-01 21:34:58 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-06-01 21:34:58 +0800
commitcd1466f30c146e12faa0db7e1b53b508bf2274c6 (patch)
treed938d02d17bbf4949b0dc1d21dee861afe171bdc /t
parentf90115fba35887aea8d4064b57f4909cd6937134 (diff)
64 bit support
Diffstat (limited to 't')
-rw-r--r--t/extern.pas2
-rw-r--r--t/sha1.pas10
2 files changed, 5 insertions, 7 deletions
diff --git a/t/extern.pas b/t/extern.pas
index 89a3c78..92c0481 100644
--- a/t/extern.pas
+++ b/t/extern.pas
@@ -10,7 +10,7 @@ var
i:integer;
begin
Pascal_puts('Hello, World!');
- Pascal_printf('Variadic Function Test: %d, %s, %x\n', 1, 'yes', 0x12345678);
+ Pascal_printf('Variadic Function Test: %d, %s, %llx\n', 1, 'yes', 0x123456789abcd);
for i:=0 to 10 do
begin
if i=3 then continue;
diff --git a/t/sha1.pas b/t/sha1.pas
index 35c9341..523593b 100644
--- a/t/sha1.pas
+++ b/t/sha1.pas
@@ -3,7 +3,7 @@ program sha1;
type
sha1_ctx = record
h:array [0..4] of integer;
- bytes:integer;
+ bytes:int64;
buf:array [0..63] of char
end;
@@ -119,8 +119,8 @@ end;
function sha1_final(md:^char; ctx:^sha1_ctx):void;
var
- used, free:integer;
- bits, i:integer;
+ used, free, i:integer;
+ bits:int64;
begin
used := ctx^.bytes and 0x3f;
ctx^.buf[used] := 0x80;
@@ -134,9 +134,7 @@ begin
end;
memset(@ctx^.buf[used], 0, free-8);
bits := ctx^.bytes shl 3;
- for i := 0 to 3 do
- ctx^.buf[56+i] := 0;
- for i := 4 to 7 do
+ for i := 0 to 7 do
ctx^.buf[i+56] := bits shr (8*(7-i));
sha1_body(ctx, @ctx^.buf, 64);
for i := 0 to 19 do