From db125fe72caf3fca5970e088cd3d3ead15f1e7ee Mon Sep 17 00:00:00 2001 From: Anurag Soni Date: Tue, 4 May 2021 20:10:11 -0400 Subject: [PATCH] add javascript stub --- lib/runtime.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/runtime.js b/lib/runtime.js index 102f054..276d9e4 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -68,3 +68,14 @@ function bigstringaf_memcmp_string(ba, ba_off, str, str_off, len) { } return 0; } + +//Provides: bigstringaf_memchr +//Requires: caml_ba_get_1 +function bigstringaf_memchr(ba, ba_off, chr, len) { + for (var i = 0; i < len; i++) { + if (caml_ba_get_1(ba, ba_off + i) == chr) { + return (ba_off + i); + } + } + return -1; +}