|
38 | 38 | (func $ta_get_i8 (param (ref extern)) (param i32) (result i32))) |
39 | 39 | (import "bindings" "ta_get_ui8" |
40 | 40 | (func $ta_get_ui8 (param (ref extern)) (param i32) (result i32))) |
| 41 | + (import "bindings" "ta_get32_ui8" |
| 42 | + (func $ta_get32_ui8 (param (ref extern)) (param i32) (result i32))) |
| 43 | + (import "bindings" "ta_get16_ui8" |
| 44 | + (func $ta_get16_ui8 (param (ref extern)) (param i32) (result i32))) |
41 | 45 | (import "bindings" "ta_set_f64" |
42 | 46 | (func $ta_set_f64 (param (ref extern)) (param i32) (param f64))) |
43 | 47 | (import "bindings" "ta_set_f32" |
|
52 | 56 | (func $ta_set_i8 (param (ref extern)) (param i32) (param (ref i31)))) |
53 | 57 | (import "bindings" "ta_set_ui8" |
54 | 58 | (func $ta_set_ui8 (param (ref extern)) (param i32) (param (ref i31)))) |
| 59 | + (import "bindings" "ta_set16_ui8" |
| 60 | + (func $ta_set16_ui8 (param (ref extern)) (param i32) (param (ref i31)))) |
| 61 | + (import "bindings" "ta_set32_ui8" |
| 62 | + (func $ta_set32_ui8 (param (ref extern)) (param i32) (param i32))) |
55 | 63 | (import "bindings" "ta_fill" |
56 | 64 | (func $ta_fill_int (param (ref extern)) (param i32))) |
57 | 65 | (import "bindings" "ta_fill" |
|
268 | 276 | (local.set $h |
269 | 277 | (call $caml_hash_mix_int |
270 | 278 | (local.get $h) |
271 | | - (i32.or |
272 | | - (i32.or |
273 | | - (call $ta_get_ui8 (local.get $data) (local.get $i)) |
274 | | - (i32.shl (call $ta_get_ui8 (local.get $data) |
275 | | - (i32.add (local.get $i) (i32.const 1))) |
276 | | - (i32.const 8))) |
277 | | - (i32.or |
278 | | - (i32.shl (call $ta_get_ui8 (local.get $data) |
279 | | - (i32.add (local.get $i) (i32.const 2))) |
280 | | - (i32.const 16)) |
281 | | - (i32.shl (call $ta_get_ui8 (local.get $data) |
282 | | - (i32.add (local.get $i) (i32.const 3))) |
283 | | - (i32.const 24)))))) |
| 279 | + (call $ta_get32_ui8 (local.get $data) (local.get $i)))) |
284 | 280 | (local.set $i (i32.add (local.get $i) (i32.const 4))) |
285 | 281 | (br $loop)))) |
286 | 282 | (local.set $w (i32.const 0)) |
|
1912 | 1908 | (struct.get $bigarray $ba_dim (local.get $ba)) |
1913 | 1909 | (i32.const 0))) |
1914 | 1910 | (then (call $caml_bound_error))) |
1915 | | - (ref.i31 (i32.or |
1916 | | - (call $ta_get_ui8 (local.get $data) (local.get $p)) |
1917 | | - (i32.shl (call $ta_get_ui8 (local.get $data) |
1918 | | - (i32.add (local.get $p) (i32.const 1))) |
1919 | | - (i32.const 8))))) |
| 1911 | + (ref.i31 (call $ta_get16_ui8 (local.get $data) (local.get $p)))) |
1920 | 1912 |
|
1921 | 1913 | (func (export "caml_ba_uint8_get32") |
1922 | 1914 | (param $vba (ref eq)) (param $i (ref eq)) (result i32) |
|
1933 | 1925 | (struct.get $bigarray $ba_dim (local.get $ba)) |
1934 | 1926 | (i32.const 0))) |
1935 | 1927 | (then (call $caml_bound_error))) |
1936 | | - (i32.or |
1937 | | - (i32.or |
1938 | | - (call $ta_get_ui8 (local.get $data) (local.get $p)) |
1939 | | - (i32.shl (call $ta_get_ui8 (local.get $data) |
1940 | | - (i32.add (local.get $p) (i32.const 1))) |
1941 | | - (i32.const 8))) |
1942 | | - (i32.or |
1943 | | - (i32.shl (call $ta_get_ui8 (local.get $data) |
1944 | | - (i32.add (local.get $p) (i32.const 2))) |
1945 | | - (i32.const 16)) |
1946 | | - (i32.shl (call $ta_get_ui8 (local.get $data) |
1947 | | - (i32.add (local.get $p) (i32.const 3))) |
1948 | | - (i32.const 24))))) |
| 1928 | + (return_call $ta_get32_ui8 (local.get $data) (local.get $p))) |
1949 | 1929 |
|
1950 | 1930 | (func (export "caml_ba_uint8_get64") |
1951 | 1931 | (param $vba (ref eq)) (param $i (ref eq)) (result i64) |
|
1963 | 1943 | (i32.const 0))) |
1964 | 1944 | (then (call $caml_bound_error))) |
1965 | 1945 | (i64.or |
1966 | | - (i64.or |
1967 | | - (i64.or |
1968 | | - (i64.extend_i32_u |
1969 | | - (call $ta_get_ui8 (local.get $data) (local.get $p))) |
1970 | | - (i64.shl (i64.extend_i32_u |
1971 | | - (call $ta_get_ui8 (local.get $data) |
1972 | | - (i32.add (local.get $p) (i32.const 1)))) |
1973 | | - (i64.const 8))) |
1974 | | - (i64.or |
1975 | | - (i64.shl (i64.extend_i32_u |
1976 | | - (call $ta_get_ui8 (local.get $data) |
1977 | | - (i32.add (local.get $p) (i32.const 2)))) |
1978 | | - (i64.const 16)) |
1979 | | - (i64.shl (i64.extend_i32_u |
1980 | | - (call $ta_get_ui8 (local.get $data) |
1981 | | - (i32.add (local.get $p) (i32.const 3)))) |
1982 | | - (i64.const 24)))) |
1983 | | - (i64.or |
1984 | | - (i64.or |
1985 | | - (i64.shl (i64.extend_i32_u |
1986 | | - (call $ta_get_ui8 (local.get $data) |
1987 | | - (i32.add (local.get $p) (i32.const 4)))) |
1988 | | - (i64.const 32)) |
1989 | | - (i64.shl (i64.extend_i32_u |
1990 | | - (call $ta_get_ui8 (local.get $data) |
1991 | | - (i32.add (local.get $p) (i32.const 5)))) |
1992 | | - (i64.const 40))) |
1993 | | - (i64.or |
1994 | | - (i64.shl (i64.extend_i32_u |
1995 | | - (call $ta_get_ui8 (local.get $data) |
1996 | | - (i32.add (local.get $p) (i32.const 6)))) |
1997 | | - (i64.const 48)) |
1998 | | - (i64.shl (i64.extend_i32_u |
1999 | | - (call $ta_get_ui8 (local.get $data) |
2000 | | - (i32.add (local.get $p) (i32.const 7)))) |
2001 | | - (i64.const 56)))))) |
| 1946 | + (i64.extend_i32_u |
| 1947 | + (call $ta_get32_ui8 (local.get $data) (local.get $p))) |
| 1948 | + (i64.shl (i64.extend_i32_u |
| 1949 | + (call $ta_get32_ui8 (local.get $data) |
| 1950 | + (i32.add (local.get $p) (i32.const 4)))) |
| 1951 | + (i64.const 32)))) |
2002 | 1952 |
|
2003 | 1953 | (func (export "caml_ba_uint8_set16") |
2004 | 1954 | (param $vba (ref eq)) (param $i (ref eq)) (param $v (ref eq)) |
|
2017 | 1967 | (struct.get $bigarray $ba_dim (local.get $ba)) |
2018 | 1968 | (i32.const 0))) |
2019 | 1969 | (then (call $caml_bound_error))) |
2020 | | - (call $ta_set_ui8 (local.get $data) (local.get $p) (local.get $d)) |
2021 | | - (call $ta_set_ui8 (local.get $data) |
2022 | | - (i32.add (local.get $p) (i32.const 1)) |
2023 | | - (ref.i31 (i32.shr_u (i31.get_s (local.get $d)) (i32.const 8)))) |
| 1970 | + (call $ta_set16_ui8 (local.get $data) (local.get $p) (local.get $d)) |
2024 | 1971 | (ref.i31 (i32.const 0))) |
2025 | 1972 |
|
2026 | 1973 | (func (export "caml_ba_uint8_set32") |
|
2039 | 1986 | (struct.get $bigarray $ba_dim (local.get $ba)) |
2040 | 1987 | (i32.const 0))) |
2041 | 1988 | (then (call $caml_bound_error))) |
2042 | | - (call $ta_set_ui8 (local.get $data) (local.get $p) |
2043 | | - (ref.i31 (local.get $d))) |
2044 | | - (call $ta_set_ui8 (local.get $data) |
2045 | | - (i32.add (local.get $p) (i32.const 1)) |
2046 | | - (ref.i31 (i32.shr_u (local.get $d) (i32.const 8)))) |
2047 | | - (call $ta_set_ui8 (local.get $data) |
2048 | | - (i32.add (local.get $p) (i32.const 2)) |
2049 | | - (ref.i31 (i32.shr_u (local.get $d) (i32.const 16)))) |
2050 | | - (call $ta_set_ui8 (local.get $data) |
2051 | | - (i32.add (local.get $p) (i32.const 3)) |
2052 | | - (ref.i31 (i32.shr_u (local.get $d) (i32.const 24)))) |
| 1989 | + (call $ta_set32_ui8 (local.get $data) (local.get $p) (local.get $d)) |
2053 | 1990 | (ref.i31 (i32.const 0))) |
2054 | 1991 |
|
2055 | 1992 | (func (export "caml_ba_uint8_set64") |
|
2068 | 2005 | (struct.get $bigarray $ba_dim (local.get $ba)) |
2069 | 2006 | (i32.const 0))) |
2070 | 2007 | (then (call $caml_bound_error))) |
2071 | | - (call $ta_set_ui8 (local.get $data) (local.get $p) |
2072 | | - (ref.i31 (i32.wrap_i64 (local.get $d)))) |
2073 | | - (call $ta_set_ui8 (local.get $data) |
2074 | | - (i32.add (local.get $p) (i32.const 1)) |
2075 | | - (ref.i31 (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 8))))) |
2076 | | - (call $ta_set_ui8 (local.get $data) |
2077 | | - (i32.add (local.get $p) (i32.const 2)) |
2078 | | - (ref.i31 (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 16))))) |
2079 | | - (call $ta_set_ui8 (local.get $data) |
2080 | | - (i32.add (local.get $p) (i32.const 3)) |
2081 | | - (ref.i31 (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 24))))) |
2082 | | - (call $ta_set_ui8 (local.get $data) |
| 2008 | + (call $ta_set32_ui8 (local.get $data) (local.get $p) |
| 2009 | + (i32.wrap_i64 (local.get $d))) |
| 2010 | + (call $ta_set32_ui8 (local.get $data) |
2083 | 2011 | (i32.add (local.get $p) (i32.const 4)) |
2084 | | - (ref.i31 (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 32))))) |
2085 | | - (call $ta_set_ui8 (local.get $data) |
2086 | | - (i32.add (local.get $p) (i32.const 5)) |
2087 | | - (ref.i31 (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 40))))) |
2088 | | - (call $ta_set_ui8 (local.get $data) |
2089 | | - (i32.add (local.get $p) (i32.const 6)) |
2090 | | - (ref.i31 (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 48))))) |
2091 | | - (call $ta_set_ui8 (local.get $data) |
2092 | | - (i32.add (local.get $p) (i32.const 7)) |
2093 | | - (ref.i31 (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 56))))) |
| 2012 | + (i32.wrap_i64 (i64.shr_u (local.get $d) (i64.const 32)))) |
2094 | 2013 | (ref.i31 (i32.const 0))) |
2095 | 2014 |
|
2096 | 2015 | (export "caml_bytes_of_array" (func $caml_string_of_array)) |
|
0 commit comments