Skip to content

Commit 6c3bbeb

Browse files
committed
Update bigstring.js
1 parent bd95543 commit 6c3bbeb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

runtime/bigstring.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,15 @@ function bigstring_blit_stub(s1, i1, s2, i2, len){
2424
for (var i = 0; i < len; i++) caml_ba_set_1(s2,i2 + i,caml_ba_get_1(s1,i1 + i));
2525
return 0;
2626
}
27+
28+
//Provides: bigstring_memcmp_stub
29+
//Requires: caml_ba_get_1
30+
function bigstring_memcmp_stub(v_s1, v_s1_pos, v_s2, v_s2_pos, v_len){
31+
for (var i = 0; i < v_len; i++) {
32+
var a = caml_ba_get_1(v_s1,v_s1_pos + i);
33+
var b = caml_ba_get_1(v_s2,v_s2_pos + i);
34+
if (a < b) return -1;
35+
if (a > b) return 1;
36+
}
37+
return 0;
38+
}

0 commit comments

Comments
 (0)