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

Side by Side Diff: src/base/utils/random-number-generator.cc

Issue 582953002: Revert "Require V8 to be explicitly initialized before an Isolate is created" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/base/utils/random-number-generator.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/utils/random-number-generator.h" 5 #include "src/base/utils/random-number-generator.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <new> 10 #include <new>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Assigning a uint64_t to an int64_t is implementation defined, but this 118 // Assigning a uint64_t to an int64_t is implementation defined, but this
119 // should be OK. Use a static_cast to explicitly state that we know what we're 119 // should be OK. Use a static_cast to explicitly state that we know what we're
120 // doing. (Famous last words...) 120 // doing. (Famous last words...)
121 int64_t seed = static_cast<int64_t>((product + kAddend) & kMask); 121 int64_t seed = static_cast<int64_t>((product + kAddend) & kMask);
122 seed_ = seed; 122 seed_ = seed;
123 return static_cast<int>(seed >> (48 - bits)); 123 return static_cast<int>(seed >> (48 - bits));
124 } 124 }
125 125
126 126
127 void RandomNumberGenerator::SetSeed(int64_t seed) { 127 void RandomNumberGenerator::SetSeed(int64_t seed) {
128 initial_seed_ = seed;
129 seed_ = (seed ^ kMultiplier) & kMask; 128 seed_ = (seed ^ kMultiplier) & kMask;
130 } 129 }
131 130
132 } } // namespace v8::base 131 } } // namespace v8::base
OLDNEW
« no previous file with comments | « src/base/utils/random-number-generator.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698