summaryrefslogtreecommitdiff
path: root/tnslc/utils.tnsl
diff options
context:
space:
mode:
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