[llvm] r306285 - [llvm-stress] Remove Rand32 helper function

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 06:17:36 PDT 2017


Author: rksimon
Date: Mon Jun 26 06:17:36 2017
New Revision: 306285

URL: http://llvm.org/viewvc/llvm-project?rev=306285&view=rev
Log:
[llvm-stress] Remove Rand32 helper function

To try and help avoid repeats of PR32585, remove Rand32 which is only called by Rand64

Modified:
    llvm/trunk/tools/llvm-stress/llvm-stress.cpp

Modified: llvm/trunk/tools/llvm-stress/llvm-stress.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-stress/llvm-stress.cpp?rev=306285&r1=306284&r2=306285&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-stress/llvm-stress.cpp (original)
+++ llvm/trunk/tools/llvm-stress/llvm-stress.cpp Mon Jun 26 06:17:36 2017
@@ -96,17 +96,13 @@ public:
     return Seed & 0x7ffff;
   }
 
-  /// Return a random 32 bit integer.
-  uint32_t Rand32() {
-    uint32_t Val = Rand();
-    Val &= 0xffff;
-    return Val | (Rand() << 16);
-  }
-
   /// Return a random 64 bit integer.
   uint64_t Rand64() {
-    uint64_t Val = Rand32();
-    return Val | (uint64_t(Rand32()) << 32);
+    uint64_t Val = Rand() & 0xffff;
+    Val |= uint64_t(Rand() & 0xffff) << 16;
+    Val |= uint64_t(Rand() & 0xffff) << 32;
+    Val |= uint64_t(Rand() & 0xffff) << 48;
+    return Val;
   }
 
   /// Rand operator for STL algorithms.




More information about the llvm-commits mailing list