Skip to content

Instantly share code, notes, and snippets.

@brentp
Last active November 14, 2018 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentp/e45ab693d4c25881172d2066d63b8717 to your computer and use it in GitHub Desktop.
Save brentp/e45ab693d4c25881172d2066d63b8717 to your computer and use it in GitHub Desktop.
type Signal* = object
left*: uint32
right*: uint32
left_exact* {.bitsize: 1.}: uint32
right_exact* {.bitsize: 1.}: uint32
when defined(debug):
name*: string
proc makeSignal(): Signal =
result.left_exact = 1'u32
doAssert makeSignal().left_exact == 1
var b = makeSignal()
#OK
doAssert b.left_exact == 1
var c = b
# FAIL.
doAssert c.left_exact == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment