mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 12:12:25 +00:00
Fix generalised ReadNum and use for Sym reading.
This commit is contained in:
parent
3dc5049d5a
commit
1fa182c7ce
24 changed files with 59 additions and 163 deletions
|
|
@ -657,7 +657,7 @@ Especially Length would become fairly complex.
|
|||
PROCEDURE ReadNum*(VAR R: Rider; VAR x: ARRAY OF SYSTEM.BYTE);
|
||||
VAR s, b: SYSTEM.INT8; q: SYSTEM.INT64;
|
||||
BEGIN s := 0; q := 0; Read(R, b);
|
||||
WHILE b >= 128 DO INC(q, ASH(b-128, s)); INC(s, 7); Read(R, b) END;
|
||||
WHILE b < 0 DO INC(q, ASH(b+128, s)); INC(s, 7); Read(R, b) END;
|
||||
INC(q, ASH(b MOD 64 - b DIV 64 * 64, s));
|
||||
ASSERT(LEN(x) <= 8);
|
||||
SYSTEM.MOVE(SYSTEM.ADR(q), SYSTEM.ADR(x), LEN(x)) (* Assumes little endian representation of q and x. *)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue