aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Execution/MemInst.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Execution/MemInst.php')
-rw-r--r--src/Execution/MemInst.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Execution/MemInst.php b/src/Execution/MemInst.php
index ae3809d..20a0e29 100644
--- a/src/Execution/MemInst.php
+++ b/src/Execution/MemInst.php
@@ -30,6 +30,21 @@ final class MemInst
}
/**
+ * @param list<int> $data
+ */
+ public function copyData(array $data, int $src, int $dst, int $len): void
+ {
+ assert(0 <= $len);
+ assert(0 <= $src);
+ assert(0 <= $dst);
+ assert($src + $len <= count($data));
+ assert($dst + $len <= $this->size());
+ for ($i = 0; $i < $len; $i++) {
+ $this->storeByte($dst + $i, $data[$src + $i]);
+ }
+ }
+
+ /**
* @return ?S32
*/
public function loadI32(int $ptr, int $n, bool $signed): ?int