unit PtrMath;

interface

function PtrAdd(Ptr: Pointer; Offset: NativeUInt): Pointer;
function PtrDiff(Ptr1, Ptr2: Pointer): NativeInt;

implementation

function PtrAdd(Ptr: Pointer; Offset: NativeUInt): Pointer;
begin
  Result := Pointer(NativeUInt(Ptr) + Offset);
end;

function PtrDiff(Ptr1, Ptr2: Pointer): NativeInt;
begin
  Result := NativeUInt(Ptr1) - NativeUInt(Ptr2);
end;

end.
