12 lines
320 B
Nim
12 lines
320 B
Nim
|
|
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)
|
|
|
|
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) |