commit 5114c09428a6465eddc33aab98eb142fa544d877 parent e4cb0183985688c375e30e36832f49c17506c513 Author: erai <erai@omiltem.net> Date: Mon, 3 Jun 2024 00:41:14 -0400 add memcmp Diffstat:
M | lib.c | | | 22 | ++++++++++++++++++++++ |
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/lib.c b/lib.c @@ -15,6 +15,28 @@ strlen(s: *byte): int { } } +memcmp(a: *byte, b: *byte, n: int): int { + var i: int; + + i = 0; + + loop { + if i == n { + return 0; + } + + if (a[i] > b[i]) { + return 1; + } + + if (a[i] < b[i]) { + return -1; + } + + i = i + 1; + } +} + strcmp(a: *byte, b: *byte): int { var i: int;