Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <ctype.h> // isspace. | 5 #include <ctype.h> // isspace. |
| 6 | 6 |
| 7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
| 8 | 8 |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 | 171 |
| 172 if (seed == 0) { | 172 if (seed == 0) { |
| 173 seed = 0x5a17; | 173 seed = 0x5a17; |
| 174 } | 174 } |
| 175 array.SetUint32(0, static_cast<uint32_t>(seed)); | 175 array.SetUint32(0, static_cast<uint32_t>(seed)); |
| 176 array.SetUint32(array.ElementSizeInBytes(), | 176 array.SetUint32(array.ElementSizeInBytes(), |
| 177 static_cast<uint32_t>(seed >> 32)); | 177 static_cast<uint32_t>(seed >> 32)); |
| 178 return Object::null(); | 178 return Object::null(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 | |
| 182 DEFINE_NATIVE_ENTRY(Random_initialSeed, 0) { | |
| 183 Random* rnd = isolate->random(); | |
| 184 int64_t seed = rnd->NextUInt32(); | |
| 185 seed |= (static_cast<int64_t>(rnd->NextUInt32())) << 32; | |
|
siva
2014/03/14 17:27:13
I would prefer
seed |= (static_cast<int64_t>(rnd-
| |
| 186 return Integer::New(seed); | |
| 187 } | |
| 188 | |
| 181 } // namespace dart | 189 } // namespace dart |
| OLD | NEW |