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

Unified Diff: third_party/re2/util/random.cc

Issue 1544433002: Replace RE2 import with a dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-Added LICENSE and OWNERS file Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/re2/util/random.h ('k') | third_party/re2/util/rune.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/util/random.cc
diff --git a/third_party/re2/util/random.cc b/third_party/re2/util/random.cc
deleted file mode 100644
index 49d6195876a31aaf5e3a0c7b0f2d16bbba7c64a1..0000000000000000000000000000000000000000
--- a/third_party/re2/util/random.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2005-2009 The RE2 Authors. All Rights Reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Modified from Google perftools's tcmalloc_unittest.cc.
-
-#include "util/random.h"
-
-namespace re2 {
-
-int32 ACMRandom::Next() {
- const int32 M = 2147483647L; // 2^31-1
- const int32 A = 16807;
- // In effect, we are computing seed_ = (seed_ * A) % M, where M = 2^31-1
- uint32 lo = A * (int32)(seed_ & 0xFFFF);
- uint32 hi = A * (int32)((uint32)seed_ >> 16);
- lo += (hi & 0x7FFF) << 16;
- if (lo > M) {
- lo &= M;
- ++lo;
- }
- lo += hi >> 15;
- if (lo > M) {
- lo &= M;
- ++lo;
- }
- return (seed_ = (int32) lo);
-}
-
-int32 ACMRandom::Uniform(int32 n) {
- return Next() % n;
-}
-
-} // namespace re2
« no previous file with comments | « third_party/re2/util/random.h ('k') | third_party/re2/util/rune.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698