summaryrefslogtreecommitdiff
path: root/lib/std/hasprefix.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
commit2bc852bda98762d3bc01548bf972e3f1b137fbfb (patch)
tree74831deed3c9057c5fe0cbb8790d220e855bc792 /lib/std/hasprefix.myr
parent3de952510eb2a23350d24ed926f19c0cf72a12f2 (diff)
downloadmc-2bc852bda98762d3bc01548bf972e3f1b137fbfb.tar.gz
Move Myrddin libs to lib/ subdirectory.
Diffstat (limited to 'lib/std/hasprefix.myr')
-rw-r--r--lib/std/hasprefix.myr12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/std/hasprefix.myr b/lib/std/hasprefix.myr
new file mode 100644
index 0000000..c9749f6
--- /dev/null
+++ b/lib/std/hasprefix.myr
@@ -0,0 +1,12 @@
+use "cmp.use"
+pkg std =
+ const hasprefix : (s : byte[:], pre : byte[:] -> bool)
+;;
+
+const hasprefix = {s, pre
+ match strncmp(s, pre, pre.len)
+ | `Equal: -> true
+ | _: -> false
+ ;;
+}
+