From e60dd3dc953c8663703b3fedd535feace8f35e9b Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Mon, 19 Jul 2021 11:40:27 +0100 Subject: [PATCH] Don't depend on if we don't need it. (#350) Including brings in , which breaks the in-libc build. --- src/mem/entropy.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mem/entropy.h b/src/mem/entropy.h index fa1b4ec..329e102 100644 --- a/src/mem/entropy.h +++ b/src/mem/entropy.h @@ -2,8 +2,10 @@ #include "../pal/pal.h" #include -#include #include +#ifndef SNMALLOC_PLATFORM_HAS_GETENTROPY +# include +#endif namespace snmalloc { @@ -16,9 +18,13 @@ namespace snmalloc template std::enable_if_t, uint64_t> get_entropy64() { +#ifdef SNMALLOC_PLATFORM_HAS_GETENTROPY + return DefaultPal::get_entropy64(); +#else std::random_device rd; uint64_t a = rd(); return (a << 32) ^ rd(); +#endif } class LocalEntropy @@ -135,4 +141,4 @@ namespace snmalloc return result; } }; -} // namespace snmalloc \ No newline at end of file +} // namespace snmalloc