Fix booleans initialization

This commit is contained in:
Mamy André-Ratsimbazafy 2019-04-28 14:12:46 +02:00
parent 08e12df4ed
commit 007c5e3071
No known key found for this signature in database
GPG Key ID: 7B88AD1FE79492E1

View File

@ -15,11 +15,11 @@ type
## by conditional branches, we don't use booleans.
## We use an int to prevent compiler "optimization" and introduction of branches
func ctrue*(T: type(Ct)): auto {.inline.}=
(CTBool[T])(true)
func ctrue*(T: typedesc[BaseUint]): auto {.inline.}=
(CTBool[Ct[T]])(true)
func cfalse*(T: type(Ct)): auto {.inline.}=
(CTBool[T])(false)
func cfalse*(T: typedesc[BaseUint]): auto {.inline.}=
(CTBool[Ct[T]])(false)
func ct*[T: BaseUint](x: T): Ct[T] {.inline.}=
(Ct[T])(x)