aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_system_control.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-10 00:02:52 -0700
committerGitHub <noreply@github.com>2021-04-10 00:02:52 -0700
commitb04877dd952d7da11647f16626952d7325e4e900 (patch)
treed097ebea3b24a2c815015c17e6c5fd89c69ce045 /src/core/hle/kernel/k_system_control.cpp
parent31c80b8c6faa7681e7b16a4052403281c7f2b9cd (diff)
parent10d6e9f32bcc102d2fb12ba3e489c9a03d7f220f (diff)
Merge pull request #6099 from bunnei/derive-mem
Kernel Rework: Derive memory regions from board layout.
Diffstat (limited to 'src/core/hle/kernel/k_system_control.cpp')
-rw-r--r--src/core/hle/kernel/k_system_control.cpp42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/core/hle/kernel/k_system_control.cpp b/src/core/hle/kernel/k_system_control.cpp
deleted file mode 100644
index aa1682f69..000000000
--- a/src/core/hle/kernel/k_system_control.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2021 yuzu Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <random>
-
-#include "core/hle/kernel/k_system_control.h"
-
-namespace Kernel {
-
-namespace {
-template <typename F>
-u64 GenerateUniformRange(u64 min, u64 max, F f) {
- // Handle the case where the difference is too large to represent.
- if (max == std::numeric_limits<u64>::max() && min == std::numeric_limits<u64>::min()) {
- return f();
- }
-
- // Iterate until we get a value in range.
- const u64 range_size = ((max + 1) - min);
- const u64 effective_max = (std::numeric_limits<u64>::max() / range_size) * range_size;
- while (true) {
- if (const u64 rnd = f(); rnd < effective_max) {
- return min + (rnd % range_size);
- }
- }
-}
-
-} // Anonymous namespace
-
-u64 KSystemControl::GenerateRandomU64() {
- static std::random_device device;
- static std::mt19937 gen(device());
- static std::uniform_int_distribution<u64> distribution(1, std::numeric_limits<u64>::max());
- return distribution(gen);
-}
-
-u64 KSystemControl::GenerateRandomRange(u64 min, u64 max) {
- return GenerateUniformRange(min, max, GenerateRandomU64);
-}
-
-} // namespace Kernel