From bee7954037af2025fdeae9a75f0c113cd39024cb Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 20 May 2023 23:53:12 -0400 Subject: File copy example --- tnslc/utils.tnsl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tnslc/utils.tnsl (limited to 'tnslc/utils.tnsl') diff --git a/tnslc/utils.tnsl b/tnslc/utils.tnsl new file mode 100644 index 0000000..6fe7769 --- /dev/null +++ b/tnslc/utils.tnsl @@ -0,0 +1,20 @@ +/; cstr_len (~uint8 cstr) [int] + int i = 0 + /; loop (cstr{i} !== 0) [i++] ;/ + return i +;/ + +/; cstr_eq (~uint8 a, b) [bool] + int ln = cstr_len(a) + /; if (ln !== cstr_len(b)) + return false + ;/ + + /; loop (int i = 0; i < ln) [i++] + /; if (a{i} !== b{i}) + return false + ;/ + ;/ + + return true +;/ \ No newline at end of file -- cgit v1.2.3