diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2009-10-26 12:10:13 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2009-10-26 12:10:13 (GMT) |
commit | 2b46eff0e7f7d11cf957b9b180177cc4b368c9aa (patch) | |
tree | 03e166e8393e1928ec5ed3c79c96fa0accd11460 /src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp | |
parent | e1f691d84dad17c5ee47c97c31ae743093ad8bc9 (diff) | |
parent | e2ef97128c006ac2a5c99c67bb54eebaa3b45720 (diff) | |
download | Qt-2b46eff0e7f7d11cf957b9b180177cc4b368c9aa.zip Qt-2b46eff0e7f7d11cf957b9b180177cc4b368c9aa.tar.gz Qt-2b46eff0e7f7d11cf957b9b180177cc4b368c9aa.tar.bz2 |
Merge commit 'origin/4.6' into core-4.6
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp index 0e6e208..52fb130 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp @@ -82,6 +82,23 @@ double randomNumber() return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53); #elif PLATFORM(WINCE) return genrand_res53(); +#elif PLATFORM(WIN_OS) + uint32_t part1 = rand() & (RAND_MAX - 1); + uint32_t part2 = rand() & (RAND_MAX - 1); + uint32_t part3 = rand() & (RAND_MAX - 1); + uint32_t part4 = rand() & (RAND_MAX - 1); + // rand only provides 15 bits on Win32 + uint64_t fullRandom = part1; + fullRandom <<= 15; + fullRandom |= part2; + fullRandom <<= 15; + fullRandom |= part3; + fullRandom <<= 15; + fullRandom |= part4; + + // Mask off the low 53bits + fullRandom &= (1LL << 53) - 1; + return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53); #else uint32_t part1 = rand() & (RAND_MAX - 1); uint32_t part2 = rand() & (RAND_MAX - 1); |