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