Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Unified Diff: src/utils/random-number-generator.cc

Issue 333053002: Untangle RNG from v8 core (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/random-number-generator.h ('k') | test/cctest/test-random-number-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/random-number-generator.cc
diff --git a/src/utils/random-number-generator.cc b/src/utils/random-number-generator.cc
index cf71c6aa66497ad10b4ae7b582c83d6b777c2320..3da6a5aa4ac3e99d786a44a0a3a93580eaa61bbf 100644
--- a/src/utils/random-number-generator.cc
+++ b/src/utils/random-number-generator.cc
@@ -7,10 +7,11 @@
#include <stdio.h>
#include <stdlib.h>
-#include "src/flags.h"
+#include <new>
+
+#include "src/base/macros.h"
#include "src/platform/mutex.h"
#include "src/platform/time.h"
-#include "src/utils.h"
namespace v8 {
namespace internal {
@@ -27,12 +28,6 @@ void RandomNumberGenerator::SetEntropySource(EntropySource source) {
RandomNumberGenerator::RandomNumberGenerator() {
- // Check --random-seed flag first.
- if (FLAG_random_seed != 0) {
- SetSeed(FLAG_random_seed);
- return;
- }
-
// Check if embedder supplied an entropy source.
{ LockGuard<Mutex> lock_guard(entropy_mutex.Pointer());
if (entropy_source != NULL) {
@@ -87,7 +82,7 @@ int RandomNumberGenerator::NextInt(int max) {
ASSERT_LE(0, max);
// Fast path if max is a power of 2.
- if (IsPowerOf2(max)) {
+ if (IS_POWER_OF_TWO(max)) {
return static_cast<int>((max * static_cast<int64_t>(Next(31))) >> 31);
}
« no previous file with comments | « src/utils/random-number-generator.h ('k') | test/cctest/test-random-number-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698