Movatterモバイル変換


[0]ホーム

URL:


  1. WebAssembly
  2. Reference
  3. WebAssembly memory instructions
  4. fill

fill: Wasm text instruction

Thememory.fillmemory instruction sets all bytes in a memory region to a given byte.

The instruction returns no value.It traps (exception) if the indicated memory region is out of bounds.

Syntax

Fill within default memory

wat
;; Fill region at offset/range in default memory with 255i32.const 200 ;; The pointer to the region to updatei32.const 255 ;; The value to set each byte to (must be < 256)i32.const 100 ;; The number of bytes to updatememory.fill ;; Fill default memory;; Fill default memory using an S-function(memory.fill (i32.const 200) (i32.const 255) (i32.const 100))

Fill specified memory (if multi-memory supported)

wat
;; Fill specific memory referenced by its indexi32.const 200 ;; The pointer to the region to updatei32.const 255 ;; The value to set each byte to (must be < 256)i32.const 100 ;; The number of bytes to updatememory.fill (memory 1) ;; Fill memory with index 1;; Fill memory referenced by its namei32.const 200 ;; The pointer to the region to updatei32.const 255 ;; The value to set each byte to (must be < 256)i32.const 100 ;; The number of bytes to updatememory.fill (memory $memoryName) ;; Fill memory with name "$memoryName";; Fill same memory using an S function(memory.fill (memory $memoryName) (i32.const 200) (i32.const 255) (i32.const 100))

Instructions and opcodes

InstructionBinary opcode
memory.fill0xFC 0x0b

Specifications

Specification
Unknown specification
# syntax-instr-memory

Browser compatibility

webassembly.bulk-memory-operations

webassembly.multiMemory

Note:ThemultiMemory compatibility table indicates versions in whichfill can be used with a specified memory.

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp