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

Side by Side Diff: src/IceRNG.h

Issue 1202253002: Includes module header first. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Changes All Subzero includes to match LLVM style guide. Created 5 years, 5 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
OLDNEW
1 //===- subzero/src/IceRNG.h - Random number generator -----------*- C++ -*-===// 1 //===- subzero/src/IceRNG.h - Random number generator -----------*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file declares a random number generator. 10 // This file declares a random number generator.
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 #ifndef SUBZERO_SRC_ICERNG_H 14 #ifndef SUBZERO_SRC_ICERNG_H
15 #define SUBZERO_SRC_ICERNG_H 15 #define SUBZERO_SRC_ICERNG_H
16 16
17 #include <cstdint>
18
19 #include "llvm/ADT/StringRef.h" 17 #include "llvm/ADT/StringRef.h"
20 #include "llvm/Support/Compiler.h" 18 #include "llvm/Support/Compiler.h"
19 #include <cstdint>
21 20
22 namespace Ice { 21 namespace Ice {
23 22
24 class RandomNumberGenerator { 23 class RandomNumberGenerator {
25 RandomNumberGenerator() = delete; 24 RandomNumberGenerator() = delete;
26 RandomNumberGenerator(const RandomNumberGenerator &) = delete; 25 RandomNumberGenerator(const RandomNumberGenerator &) = delete;
27 RandomNumberGenerator &operator=(const RandomNumberGenerator &) = delete; 26 RandomNumberGenerator &operator=(const RandomNumberGenerator &) = delete;
28 27
29 public: 28 public:
30 explicit RandomNumberGenerator(uint64_t Seed, llvm::StringRef Salt = ""); 29 explicit RandomNumberGenerator(uint64_t Seed, llvm::StringRef Salt = "");
(...skipping 27 matching lines...) Expand all
58 // sample implementation at cppreference.com. 57 // sample implementation at cppreference.com.
59 template <class RandomIt, class RandomFunc> 58 template <class RandomIt, class RandomFunc>
60 void RandomShuffle(RandomIt First, RandomIt Last, RandomFunc &&RNG) { 59 void RandomShuffle(RandomIt First, RandomIt Last, RandomFunc &&RNG) {
61 for (auto i = Last - First - 1; i > 0; --i) 60 for (auto i = Last - First - 1; i > 0; --i)
62 std::swap(First[i], First[RNG(i + 1)]); 61 std::swap(First[i], First[RNG(i + 1)]);
63 } 62 }
64 63
65 } // end of namespace Ice 64 } // end of namespace Ice
66 65
67 #endif // SUBZERO_SRC_ICERNG_H 66 #endif // SUBZERO_SRC_ICERNG_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698