diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2022-07-22 14:07:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 16:37:35 +0530 |
commit | 244c00d95b7ec8f30a5e81b743b4b618049b6c37 (patch) | |
tree | e32602ab92d4c117dbbd72ea9c7436964466187d /ext/ffi/00_ffi.js | |
parent | 4e71a9424e12a9711b41edce049ee026f0a904b4 (diff) |
perf(ext/ffi): Optimise common pointer related APIs (#15144)
Diffstat (limited to 'ext/ffi/00_ffi.js')
-rw-r--r-- | ext/ffi/00_ffi.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js index 22e442e51..cdaf69e0d 100644 --- a/ext/ffi/00_ffi.js +++ b/ext/ffi/00_ffi.js @@ -32,77 +32,77 @@ getUint8(offset = 0) { return core.opSync( "op_ffi_read_u8", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getInt8(offset = 0) { return core.opSync( "op_ffi_read_i8", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getUint16(offset = 0) { return core.opSync( "op_ffi_read_u16", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getInt16(offset = 0) { return core.opSync( "op_ffi_read_i16", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getUint32(offset = 0) { return core.opSync( "op_ffi_read_u32", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getInt32(offset = 0) { return core.opSync( "op_ffi_read_i32", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getBigUint64(offset = 0) { return core.opSync( "op_ffi_read_u64", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getBigInt64(offset = 0) { return core.opSync( "op_ffi_read_u64", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getFloat32(offset = 0) { return core.opSync( "op_ffi_read_f32", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getFloat64(offset = 0) { return core.opSync( "op_ffi_read_f64", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } getCString(offset = 0) { return core.opSync( "op_ffi_cstr_read", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, ); } @@ -115,7 +115,7 @@ copyInto(destination, offset = 0) { core.opSync( "op_ffi_buf_copy_into", - this.pointer + BigInt(offset), + offset ? this.pointer + BigInt(offset) : this.pointer, destination, destination.byteLength, ); |