|
225 | 225 | (br $loop)))) |
226 | 226 | (ref.i31 (i32.const -1))) |
227 | 227 |
|
| 228 | + (func (export "caml_bigstring_strncmp") |
| 229 | + (param $vs1 (ref eq)) |
| 230 | + (param $vpos1 (ref eq)) |
| 231 | + (param $vs2 (ref eq)) |
| 232 | + (param $vpos2 (ref eq)) |
| 233 | + (param $vlen (ref eq)) |
| 234 | + (result (ref eq)) |
| 235 | + |
| 236 | + (local $v1 (ref extern)) |
| 237 | + (local $v2 (ref extern)) |
| 238 | + (local $pos1 i32) |
| 239 | + (local $pos2 i32) |
| 240 | + (local $len i32) |
| 241 | + |
| 242 | + (local $i i32) |
| 243 | + (local $c1 i32) |
| 244 | + (local $c2 i32) |
| 245 | + |
| 246 | + (local.set $v1 (call $caml_ba_get_view (local.get $vs1))) |
| 247 | + (local.set $v2 (call $caml_ba_get_view (local.get $vs2))) |
| 248 | + (local.set $pos1 (i31.get_s (ref.cast (ref i31) (local.get $vpos1)))) |
| 249 | + (local.set $pos2 (i31.get_s (ref.cast (ref i31) (local.get $vpos2)))) |
| 250 | + (local.set $len (i31.get_s (ref.cast (ref i31) (local.get $vlen)))) |
| 251 | + (loop $loop |
| 252 | + (if (i32.lt_u (local.get $i) (local.get $len)) |
| 253 | + (then |
| 254 | + (local.set $c1 |
| 255 | + (call $dv_get_ui8 (local.get $v1) |
| 256 | + (i32.add (local.get $pos1) (local.get $i)))) |
| 257 | + (local.set $c2 |
| 258 | + (call $dv_get_ui8 (local.get $v2) |
| 259 | + (i32.add (local.get $pos2) (local.get $i)))) |
| 260 | + (local.set $i (i32.add (local.get $i) (i32.const 1))) |
| 261 | + (if (i32.lt_u (local.get $c1) (local.get $c2)) |
| 262 | + (then (return (ref.i31 (i32.const -1))))) |
| 263 | + (if (i32.gt_u (local.get $c1) (local.get $c2)) |
| 264 | + (then (return (ref.i31 (i32.const 1))))) |
| 265 | + (if (i32.eq (local.get $c1) (i32.const 0)) |
| 266 | + (then (return (ref.i31 (i32.const 0))))) |
| 267 | + (br $loop)))) |
| 268 | + (ref.i31 (i32.const 0))) |
| 269 | + |
228 | 270 | (export "caml_bigstring_blit_string_to_ba" |
229 | 271 | (func $caml_bigstring_blit_bytes_to_ba)) |
230 | 272 | (func $caml_bigstring_blit_bytes_to_ba |
|
0 commit comments