summaryrefslogtreecommitdiff
path: root/tnslc/utils.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2023-05-20 23:53:12 -0400
committerKyle Gunger <kgunger12@gmail.com>2023-05-20 23:53:12 -0400
commitbee7954037af2025fdeae9a75f0c113cd39024cb (patch)
tree775fc528161f507cf6aab4fddaa4f1ef922860c9 /tnslc/utils.tnsl
parentba0ffe00d0c62c8ac8e0f98596193b69975c9fe9 (diff)
File copy example
Diffstat (limited to 'tnslc/utils.tnsl')
-rw-r--r--tnslc/utils.tnsl20
1 files changed, 20 insertions, 0 deletions
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