summary refs log tree commit diff stats
path: root/lib/std
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-02-17 22:00:51 -0800
committerGitHub <noreply@github.com>2021-02-18 07:00:51 +0100
commitf455e03028850d45aebca5396189b1a498f9af95 (patch)
tree82199563f083ca90087e339cf3a9b5a1672862df /lib/std
parent8873ec60843c4c0e8ff5aa1fc25b225dc5f24b43 (diff)
downloadNim-f455e03028850d45aebca5396189b1a498f9af95.tar.gz
fix #17078 csources generation (#17079)
* fix #17078 csources generation

* fixup
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/sysrand.nim8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/std/sysrand.nim b/lib/std/sysrand.nim
index 75a1af5a9..5ccbd21be 100644
--- a/lib/std/sysrand.nim
+++ b/lib/std/sysrand.nim
@@ -53,11 +53,11 @@ when not defined(js):
 when defined(posix):
   import std/posix
 
-const batchImplOS = defined(freebsd) or defined(openbsd) or (defined(macosx) and not defined(ios))
+const
+  batchImplOS = defined(freebsd) or defined(openbsd) or (defined(macosx) and not defined(ios))
+  batchSize {.used.} = 256
 
 when batchImplOS:
-  const batchSize = 256
-
   template batchImpl(result: var int, dest: var openArray[byte], getRandomImpl) =
     let size = dest.len
     if size == 0:
@@ -94,8 +94,6 @@ when defined(js):
         dest[i] = src[i]
 
   else:
-    const batchSize = 256
-
     proc getRandomValues(p: Uint8Array) {.importjs: "window.crypto.getRandomValues(#)".}
       # The requested length of `p` must not be more than 65536.