diff options
author | Ben Smith <binjimin@gmail.com> | 2017-05-15 10:07:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-15 10:07:21 -0700 |
commit | f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0 (patch) | |
tree | 1c2144a7c8acadf0850ad183920d0b247ddc501c /src/binary-writer-spec.cc | |
parent | 5d10e89b5d796edc62cfb6bc3f806d8a1b1272c0 (diff) | |
download | wabt-f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0.tar.gz wabt-f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0.tar.bz2 wabt-f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0.zip |
Use Index/Address/Offset instead of uint32_t (#433)
An `Index` is an index into one of the WebAssembly index spaces. It also
is used for counts for these spaces, as well as parameter counts and
result counts.
An `Address` is an index into linear memory, or the size of a data
region in linear memory.
An `Offset` is an offset into the host's file or memory buffer.
This fixes issue #322.
Diffstat (limited to 'src/binary-writer-spec.cc')
-rw-r--r-- | src/binary-writer-spec.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc index def1862d..aed14870 100644 --- a/src/binary-writer-spec.cc +++ b/src/binary-writer-spec.cc @@ -198,7 +198,7 @@ void BinaryWriterSpec::WriteLocation(const Location* loc) { void BinaryWriterSpec::WriteVar(const Var* var) { if (var->type == VarType::Index) - json_stream_.Writef("\"%" PRIu64 "\"", var->index); + json_stream_.Writef("\"%" PRIindex "\"", var->index); else WriteEscapedStringSlice(var->name); } @@ -365,7 +365,7 @@ void BinaryWriterSpec::WriteCommands(Script* script) { json_stream_.Writef("{\"source_filename\": "); WriteEscapedStringSlice(source_filename_); json_stream_.Writef(",\n \"commands\": [\n"); - int last_module_index = -1; + Index last_module_index = kInvalidIndex; for (size_t i = 0; i < script->commands.size(); ++i) { const Command& command = *script->commands[i].get(); @@ -396,7 +396,7 @@ void BinaryWriterSpec::WriteCommands(Script* script) { WriteModule(filename, module); delete [] filename; num_modules_++; - last_module_index = static_cast<int>(i); + last_module_index = i; break; } |