Skip to content

Commit

Permalink
naive string concat implementation
Browse files Browse the repository at this point in the history
This probably does a lot of unecessary conversions, but it seems obviously correct and so a reasonable starting point.
  • Loading branch information
rickyvetter authored Sep 25, 2024
1 parent 39ee469 commit e87ed78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/mlBytes.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,12 @@ function caml_string_concat(a, b) {
}

//Provides: caml_string_concat
//Requires: caml_convert_string_to_bytes, MlBytes
//Requires: caml_string_of_jsbytes, caml_jsbytes_of_string
//If: !js-string
function caml_string_concat(s1, s2) {
s1.t & 6 && caml_convert_string_to_bytes(s1);
s2.t & 6 && caml_convert_string_to_bytes(s2);
return new MlBytes(s1.t, s1.c + s2.c, s1.l + s2.l);
return caml_string_of_jsbytes(
caml_jsbytes_of_string(s1) + caml_jsbytes_of_string(s2),
);
}

//Provides: caml_string_unsafe_get const
Expand Down

0 comments on commit e87ed78

Please sign in to comment.