NewTableType creates a new `TableType` with the `element` type provided as well as limits on its size. The `min` value is the minimum size, in elements, of this table. The `has_max` boolean indicates whether a maximum size is present, and if so `max` is used as the maximum size of the table, in ele
(element *ValType, min uint32, has_max bool, max uint32)
| 17 | // `has_max` boolean indicates whether a maximum size is present, and if so |
| 18 | // `max` is used as the maximum size of the table, in elements. |
| 19 | func NewTableType(element *ValType, min uint32, has_max bool, max uint32) *TableType { |
| 20 | valptr := C.wasm_valtype_new(C.wasm_valtype_kind(element.ptr())) |
| 21 | runtime.KeepAlive(element) |
| 22 | if !has_max { |
| 23 | max = 0xffffffff |
| 24 | } |
| 25 | limitsFFI := C.wasm_limits_t{ |
| 26 | min: C.uint32_t(min), |
| 27 | max: C.uint32_t(max), |
| 28 | } |
| 29 | ptr := C.wasm_tabletype_new(valptr, &limitsFFI) |
| 30 | |
| 31 | return mkTableType(ptr, nil) |
| 32 | } |
| 33 | |
| 34 | func mkTableType(ptr *C.wasm_tabletype_t, owner interface{}) *TableType { |
| 35 | tabletype := &TableType{_ptr: ptr, _owner: owner} |
searching dependent graphs…