語法
在預設記憶體中複製
wat
;; Copy data in default memory from [100, 125] to [50, 75]
i32.const 50 ;; Destination address to copy to
i32.const 100 ;; Source address to copy from
i32.const 25 ;; Number of bytes to copy
memory.copy ;; Copy memory
;; Copy in default memory using an S-function
(memory.copy (i32.const 50) (i32.const 100) (i32.const 25))
複製指定記憶體(如果支援多記憶體)
wat
;; Copy data in specific memory [100, 125] to [50, 75]
i32.const 50 ;; Destination address to copy to
i32.const 100 ;; Source address to copy from
i32.const 25 ;; Number of bytes to copy
memory.copy (memory 2) ;; Copy memory within memory with index 2
;; Copy within memory referenced by its name
i32.const 50 ;; Destination address to copy to
i32.const 100 ;; Source address to copy from
i32.const 25 ;; Number of bytes to copy
memory.copy (memory $memoryName) ;; Copy memory with memory named "$memoryName"
;; Copy same memory using an S function
(memory.copy (memory $memoryName) (i32.const 50) (i32.const 100) (i32.const 25))
指令和操作碼
| 指令 | 二進位制操作碼 |
|---|---|
memory.copy |
0xFC 0x0a |
規範
| 規範 |
|---|
| 未知規範 # syntax-instr-memory |
瀏覽器相容性
webassembly.bulk-memory-operations
載入中…
webassembly.multiMemory
載入中…
注意: multiMemory 相容性表顯示了 copy 可用於指定記憶體的版本。