From 54581b30a8ca8f04e34869160f185d2bfa1c8205 Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Wed, 25 Sep 2024 17:08:59 +0200 Subject: [PATCH] fix: template typechecking is more stringent --- constantine/ciphers/chacha20.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/constantine/ciphers/chacha20.nim b/constantine/ciphers/chacha20.nim index 80f8ee0a..42600799 100644 --- a/constantine/ciphers/chacha20.nim +++ b/constantine/ciphers/chacha20.nim @@ -28,7 +28,7 @@ template rotl(x, n: uint32): uint32 = # We always use it with constants in 0 ..< 32 # so no undefined behaviour. (x shl n) or (x shr (32 - n)) -template `^=`(x: var uint32, y: uint32) = +template `^=`[T: uint32|byte](x: var T, y: T) = x = x xor y template `<<<=`(x: var uint32, n: uint32) = x = x.rotl(n) @@ -126,4 +126,4 @@ func chacha20_cipher*( eaten += 64 counter += 1 - return counter \ No newline at end of file + return counter