PointerArithmetic extension

An extension implementing pointer arithmetic on native pointers.

This extension allows to obtain a new native pointer by shifting an existing pointer by a specified byte offset.

Example:

Pointer<Uint8> buf = mem.alloc(128);
// data points to the part of buf starting at offset 16
// the calculated pointer is cast to the valid type
// so that it can be assigned to data, which is a pointer
// of a different type
Pointer<Int64> data = (buf+16).cast();
on

Operators

operator +(int byteOffset) → Pointer<NativeType>

Available on Pointer<NativeType>, provided by the PointerArithmetic extension

Returns a pointer shifted right (increased) by a specified offset.
operator -(int byteOffset) → Pointer<NativeType>

Available on Pointer<NativeType>, provided by the PointerArithmetic extension

Returns a pointer shifted left (decreased) by a specified offset.