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

Unified Diff: cc/base/util.h

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 | « cc/base/switches.cc ('k') | cc/base/util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/util.h
diff --git a/cc/base/util.h b/cc/base/util.h
new file mode 100644
index 0000000000000000000000000000000000000000..a16d4855283f849c0330efcd79a339a2982f0271
--- /dev/null
+++ b/cc/base/util.h
@@ -0,0 +1,31 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_BASE_UTIL_H_
+#define CC_BASE_UTIL_H_
+
+#include <limits>
+
+#include "base/basictypes.h"
+
+namespace cc {
+
+template <typename T> T RoundUp(T n, T mul) {
+ static_assert(std::numeric_limits<T>::is_integer,
+ "T must be an integer type");
+ return (n > 0) ? ((n + mul - 1) / mul) * mul
+ : (n / mul) * mul;
+}
+
+template <typename T> T RoundDown(T n, T mul) {
+ static_assert(std::numeric_limits<T>::is_integer,
+ "T must be an integer type");
+ return (n > 0) ? (n / mul) * mul
+ : (n == 0) ? 0
+ : ((n - mul + 1) / mul) * mul;
+}
+
+} // namespace cc
+
+#endif // CC_BASE_UTIL_H_
« no previous file with comments | « cc/base/switches.cc ('k') | cc/base/util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698