tmemory.nim 301 B

12345678910111213141516
  1. block: # cmpMem
  2. type
  3. SomeHash = array[15, byte]
  4. var
  5. a: SomeHash
  6. b: SomeHash
  7. a[^1] = byte(1)
  8. let c = a
  9. doAssert cmpMem(a.addr, b.addr, sizeof(SomeHash)) > 0
  10. doAssert cmpMem(b.addr, a.addr, sizeof(SomeHash)) < 0
  11. doAssert cmpMem(a.addr, c.unsafeAddr, sizeof(SomeHash)) == 0