<!doctype html>

<html>

  <head>
    <meta charset="utf-8">
    <title>WASM memory test</title>
  </head>

  <body>
    <script>
      const memory = new WebAssembly.Memory({
        initial: 10,
        maximum: 100,
      });
      WebAssembly.instantiateStreaming(fetch("memory.wasm"), {
        js: { mem: memory },
      }).then((obj) => {
        const summands = new DataView(memory.buffer);
        for (let i = 0; i < 10; i++) {
          summands.setUint32(i * 4, i, true); // WebAssembly is little en