From 4f77ad5d019618893c59a0f8d5bfa6b98e50a3be Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 18 Aug 2026 13:31:47 +0200 Subject: Make Int and Word aliases to fixed-size types --- source/common.elna | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/common.elna') diff --git a/source/common.elna b/source/common.elna index 1bdfa1f..c5b67f8 100644 --- a/source/common.elna +++ b/source/common.elna @@ -17,13 +17,13 @@ type proc write*(fd: Int; buf: Pointer; Word: Int): Int extern -proc write_s*(value: []const Char) +proc write_s*(value: []const Word8) begin (* fwrite(cast(value.ptr: Pointer), value.length, 1u, stdout) *) write(1, cast(value.ptr: Pointer), cast(value.length: Int)) return -proc write_z*(value: ^Char) +proc write_z*(value: ^Word8) begin write(1, cast(value: Pointer), cast(strlen(value): Int)) return @@ -37,7 +37,7 @@ begin end return -proc write_c*(value: Char) +proc write_c*(value: Word8) begin putchar(cast(value: Int)); fflush(nil) @@ -47,7 +47,7 @@ proc write_i*(value: Int) var digit: Int n: Word - buffer: [10]Char + buffer: [10]Word8 begin n := 10u; @@ -58,7 +58,7 @@ begin digit := value % 10; value := value / 10; - buffer[n] := cast(cast('0': Int) + digit: Char); + buffer[n] := cast(cast('0': Int) + digit: Word8); n := n - 1u end; while n < 10u do @@ -78,7 +78,7 @@ begin return nil (* Returns true or false depending whether two strings are equal. *) -proc string_compare*(lhs_pointer: ^Char; lhs_length: Word; rhs_pointer: []const Char): Bool +proc string_compare*(lhs_pointer: ^Word8; lhs_length: Word; rhs_pointer: []const Word8): Bool var result: Bool begin -- cgit v1.2.3