2022-01-22 04:46:53 +01:00
|
|
|
|
|
|
|
template padd*[T](x: ptr T, num: int): ptr T =
|
|
|
|
cast[ptr T](cast[int](x) + num)
|
|
|
|
|
|
|
|
template psub*[T](x: ptr T, num: int): ptr T =
|
|
|
|
cast[ptr T](cast[int](x) - num)
|
|
|
|
|
2022-01-27 18:54:02 +01:00
|
|
|
template pdiff*[T](x: ptr T, y: ptr T): int =
|
|
|
|
cast[int](x) - cast[int](y)
|
|
|
|
|
|
|
|
template pless*[T](x: ptr T, y: ptr T): bool =
|
|
|
|
cast[uint](x) < cast[uint](y)
|