| 157 | export class Word extends VariableMixin(View4) {} |
| 158 | |
| 159 | export class LongArray { |
| 160 | constructor(length) { |
| 161 | this.buffer = new DataView(new ArrayBuffer(length * 8)); |
| 162 | } |
| 163 | |
| 164 | get addr() { |
| 165 | return mt.get_view_vector(this.buffer); |
| 166 | } |
| 167 | |
| 168 | addr_at(index) { |
| 169 | return this.addr.add(index * 8); |
| 170 | } |
| 171 | |
| 172 | get length() { |
| 173 | return this.buffer.length / 8; |
| 174 | } |
| 175 | |
| 176 | get size() { |
| 177 | return this.buffer.byteLength; |
| 178 | } |
| 179 | |
| 180 | get byteLength() { |
| 181 | return this.size; |
| 182 | } |
| 183 | |
| 184 | get(index) { |
| 185 | const buffer = this.buffer; |
| 186 | const base = index * 8; |
| 187 | return new Int( |
| 188 | buffer.getUint32(base, true), |
| 189 | buffer.getUint32(base + 4, true), |
| 190 | ); |
| 191 | } |
| 192 | |
| 193 | set(index, value) { |
| 194 | const buffer = this.buffer; |
| 195 | const base = index * 8; |
| 196 | const values = lohi_from_one(value); |
| 197 | |
| 198 | buffer.setUint32(base, values[0], true); |
| 199 | buffer.setUint32(base + 4, values[1], true); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | // mutable Int (we are explicitly using Int's private fields) |
| 204 | const Word64Mixin = superclass => class extends superclass { |
nothing calls this directly
no outgoing calls
no test coverage detected