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

Unified Diff: base/bits.h

Issue 11413005: YUV software decode path stride fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc LGTM'ed. Created 8 years, 1 month 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 | « no previous file | cc/texture_uploader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bits.h
diff --git a/base/bits.h b/base/bits.h
index b2209e8ed7934a6dfc918c3d7d12b9c455f594e1..9383f8832408c7da40fa47ec49a4325c778f89ac 100644
--- a/base/bits.h
+++ b/base/bits.h
@@ -41,6 +41,16 @@ inline int Log2Ceiling(uint32 n) {
}
}
+// Returns the largest i such as i <= n and i == k * mul for some integer k
+inline uint32 RoundDown(uint32 n, uint32 mul) {
+ return (n / mul) * mul;
+}
+
+// Returns the smallest i such as i >= n and i == k * mul for some integer k
+inline uint32 RoundUp(uint32 n, uint32 mul) {
+ return (n + (mul - 1)) / mul * mul;
jar (doing other things) 2012/11/20 22:54:35 Does this do what you want when: n + mul - 1 > UIN
sheu 2012/11/20 23:13:50 It doesn't but I don't really have other suggestio
+}
+
} // namespace bits
} // namespace base
« no previous file with comments | « no previous file | cc/texture_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698