Index: src/wasm/encoder.cc |
diff --git a/src/wasm/encoder.cc b/src/wasm/encoder.cc |
index 4ed8e896b6252481db9f731268118deca0bfc995..b3b2a36c7f8108da9b0621f6b72f0727c35bde7a 100644 |
--- a/src/wasm/encoder.cc |
+++ b/src/wasm/encoder.cc |
@@ -369,14 +369,11 @@ uint32_t WasmDataSegmentEncoder::BodySize() const { |
void WasmDataSegmentEncoder::Serialize(byte* buffer, byte** header, |
byte** body) const { |
- uint32_t body_offset = static_cast<uint32_t>(*body - buffer); |
- EmitUint32(header, dest_); |
- EmitUint32(header, body_offset); |
- EmitUint32(header, static_cast<uint32_t>(data_.size())); |
- EmitUint8(header, 1); // init |
- |
- std::memcpy(*body, &data_[0], data_.size()); |
- (*body) += data_.size(); |
+ EmitVarInt(header, dest_); |
+ EmitVarInt(header, static_cast<uint32_t>(data_.size())); |
+ |
+ std::memcpy(*header, &data_[0], data_.size()); |
+ (*header) += data_.size(); |
} |
WasmModuleBuilder::WasmModuleBuilder(Zone* zone) |