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

Unified Diff: src/utils.h

Issue 2887053003: MIPS[64]: Reland of `Fix unaligned arguments storage in Wasm-to-interpreter entry` (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: src/utils.h
diff --git a/src/utils.h b/src/utils.h
index 6c8dadbd715f363672bc7a8cf260e3a05b4a327b..d16c345cd2982653e279e34835138b113341d018 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -185,6 +185,11 @@ inline bool IsAddressAligned(Address addr,
return IsAligned(offs, alignment);
}
+template <typename T, typename U>
+inline T RoundUpToMultipleOfPowOf2(T value, U multiple) {
+ DCHECK(multiple && ((multiple & (multiple - 1)) == 0));
Clemens Hammacher 2017/05/18 11:52:05 There is base::bits::IsPowerOfTwo64.
ivica.bogosavljevic 2017/05/18 12:21:43 Acknowledged.
+ return (value + multiple - 1) & ~(multiple - 1);
+}
// Returns the maximum of the two parameters.
template <typename T>

Powered by Google App Engine
This is Rietveld 408576698