| 202 | |
| 203 | // mutable Int (we are explicitly using Int's private fields) |
| 204 | const Word64Mixin = superclass => class extends superclass { |
| 205 | constructor(...args) { |
| 206 | if (!args.length) { |
| 207 | return super(0); |
| 208 | } |
| 209 | super(...args); |
| 210 | } |
| 211 | |
| 212 | get addr() { |
| 213 | // assume this is safe to cache |
| 214 | return mt.get_view_vector(this._u32); |
| 215 | } |
| 216 | |
| 217 | get length() { |
| 218 | return 1; |
| 219 | } |
| 220 | |
| 221 | get size() { |
| 222 | return 8; |
| 223 | } |
| 224 | |
| 225 | get byteLength() { |
| 226 | return 8; |
| 227 | } |
| 228 | |
| 229 | // no setters for top and bot since low/high can accept negative integers |
| 230 | |
| 231 | get lo() { |
| 232 | return super.lo; |
| 233 | } |
| 234 | |
| 235 | set lo(value) { |
| 236 | this._u32[0] = value; |
| 237 | } |
| 238 | |
| 239 | get hi() { |
| 240 | return super.hi; |
| 241 | } |
| 242 | |
| 243 | set hi(value) { |
| 244 | this._u32[1] = value; |
| 245 | } |
| 246 | |
| 247 | set(value) { |
| 248 | const buffer = this._u32; |
| 249 | const values = lohi_from_one(value); |
| 250 | |
| 251 | buffer[0] = values[0]; |
| 252 | buffer[1] = values[1]; |
| 253 | } |
| 254 | }; |
| 255 | |
| 256 | export class Long extends Word64Mixin(Int) { |
| 257 | as_addr() { |