hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit eee5d5873e92af055b2806768c04cdefce64a83e
parent 547f5c55af03e0b004127e489c1447dacd0ee783
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed,  3 Feb 2021 17:15:36 -0500

rt::strcmp: import from harec

Diffstat:
Art/strcmp.ha | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/rt/strcmp.ha b/rt/strcmp.ha @@ -0,0 +1,18 @@ +type string = struct { + data: *[*]u8, + length: size, + capacity: size, +}; + +export fn strcmp(_a: str, _b: str) bool = { + if (len(_a) != len(_b)) { + return false; + }; + let a = (&_a: *string).data, b = (&_b: *string).data; + for (let i = 0z; i < len(_a); i += 1z) { + if (a[i] != b[i]) { + return false; + }; + }; + return true; +};