Skip to content

Commit 0276793

Browse files
committed
change getByteSync()
1 parent 6946089 commit 0276793

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/ProcessView.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ class ProcessView {
7373
}
7474

7575
getAddress (x, y) {
76-
x = mod(x, this.world_width)
77-
y = mod(y, this.world_height)
7876
return this.region[0] + x + y * this.world_width
7977
}
8078

8179
getByteSync (x, y, l) {
80+
x = mod(x, this.world_width)
81+
y = mod(y, this.world_height)
8282
try {
83-
if (x + l >= this.world_width) {
83+
if (x + l > this.world_width) {
8484
let leftlength = this.world_width - x
8585
let leftdata = this.mem.read(this.getAddress(x, y), leftlength)
86-
let rightdata = this.mem.read(this.getAddress(x + leftlength, y), l - leftlength)
87-
return leftdata.concat(rightdata)
86+
let rightdata = this.mem.read(this.getAddress(0, y), l - leftlength)
87+
return Array.from(leftdata).concat(Array.from(rightdata))
8888
}
8989
return this.mem.read(this.getAddress(x, y), l)
9090
} catch (e) {

0 commit comments

Comments
 (0)