mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-03 18:34:43 +00:00
Added cmpMem export (#16484)
* added cmpMem export * updates * fix test * Tiny changelog change * Add a dot. Co-authored-by: Clyybber <darkmine956@gmail.com>
This commit is contained in:
15
tests/stdlib/tmemory.nim
Normal file
15
tests/stdlib/tmemory.nim
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
block: # cmpMem
|
||||
type
|
||||
SomeHash = array[15, byte]
|
||||
|
||||
var
|
||||
a: SomeHash
|
||||
b: SomeHash
|
||||
|
||||
a[^1] = byte(1)
|
||||
let c = a
|
||||
|
||||
doAssert cmpMem(a.addr, b.addr, sizeof(SomeHash)) > 0
|
||||
doAssert cmpMem(b.addr, a.addr, sizeof(SomeHash)) < 0
|
||||
doAssert cmpMem(a.addr, c.unsafeAddr, sizeof(SomeHash)) == 0
|
||||
Reference in New Issue
Block a user