Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int main(int argc, const char* argv[]) {
// Create stand-alone memory.
// TODO(wasm+): Once Wasm allows multiple memories, turn this into import.
printf("Creating stand-alone memory...\n");
wasm_limits_t limits = {5, 5};
wasm_limits_t limits = {5, 5, false};
own wasm_memorytype_t* memorytype = wasm_memorytype_new(&limits);
own wasm_memory_t* memory2 = wasm_memory_new(store, memorytype);
check(wasm_memory_size(memory2) == 5);
Expand Down
1 change: 1 addition & 0 deletions example/reflect.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void print_mutability(wasm_mutability_t mut) {
void print_limits(const wasm_limits_t* limits) {
printf("%ud", limits->min);
if (limits->max < wasm_limits_max_default) printf(" %ud", limits->max);
if (limits->shared) printf(" shared");
}

void print_valtype(const wasm_valtype_t* type) {
Expand Down
2 changes: 1 addition & 1 deletion example/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int main(int argc, const char* argv[]) {
// Create stand-alone table.
// TODO(wasm+): Once Wasm allows multiple tables, turn this into import.
printf("Creating stand-alone table...\n");
wasm_limits_t limits = {5, 5};
wasm_limits_t limits = {5, 5, false};
own wasm_tabletype_t* tabletype =
wasm_tabletype_new(wasm_valtype_new(WASM_FUNCREF), &limits);
own wasm_table_t* table2 = wasm_table_new(store, tabletype, NULL);
Expand Down
1 change: 1 addition & 0 deletions include/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ enum wasm_mutability_enum {
typedef struct wasm_limits_t {
uint32_t min;
uint32_t max;
bool shared;
} wasm_limits_t;

static const uint32_t wasm_limits_max_default = 0xffffffff;
Expand Down
5 changes: 3 additions & 2 deletions include/wasm.hh
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ enum class Mutability : uint8_t { CONST, VAR };
struct Limits {
uint32_t min;
uint32_t max;
bool shared;

Limits(uint32_t min, uint32_t max = std::numeric_limits<uint32_t>::max()) :
min(min), max(max) {}
Limits(uint32_t min, uint32_t max = std::numeric_limits<uint32_t>::max(), bool shared = false) :
min(min), max(max), shared(shared) {}
};


Expand Down