fix #17078 csources generation (#17079)

* fix #17078 csources generation

* fixup
This commit is contained in:
Timothee Cour 2021-02-17 22:00:51 -08:00 • committed by GitHub
commit f455e03028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -15,7 +15,7 @@ runnableExamples:
include "system/inclrtl" include "system/inclrtl"
when defined(linux): when defined(posix) and not (defined(macosx) or defined(bsd)):
import posix import posix
when defined(freebsd) or defined(macosx): when defined(freebsd) or defined(macosx):

View file

@ -53,11 +53,11 @@ when not defined(js):
when defined(posix): when defined(posix):
import std/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: when batchImplOS:
const batchSize = 256
template batchImpl(result: var int, dest: var openArray[byte], getRandomImpl) = template batchImpl(result: var int, dest: var openArray[byte], getRandomImpl) =
let size = dest.len let size = dest.len
if size == 0: if size == 0:
@ -94,8 +94,6 @@ when defined(js):
dest[i] = src[i] dest[i] = src[i]
else: else:
const batchSize = 256
proc getRandomValues(p: Uint8Array) {.importjs: "window.crypto.getRandomValues(#)".} proc getRandomValues(p: Uint8Array) {.importjs: "window.crypto.getRandomValues(#)".}
# The requested length of `p` must not be more than 65536. # The requested length of `p` must not be more than 65536.