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: src/IceUtils.h

Issue 874353006: Write out global initializers and data rel directly to ELF file. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: tweak comment Created 5 years, 11 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/IceUtils.h
diff --git a/src/IceUtils.h b/src/IceUtils.h
index 35dd7f75a03b5751cc0815f5e61e57ce3bb989aa..dc3a5ff1d77ef160d2b321038f17db3ed64cdbde 100644
--- a/src/IceUtils.h
+++ b/src/IceUtils.h
@@ -53,6 +53,14 @@ public:
return ((X > 0 && Y > 0 && (X > std::numeric_limits<T>::max() - Y)) ||
(X < 0 && Y < 0 && (X < std::numeric_limits<T>::min() - Y)));
}
+
+ static inline uint64_t OffsetToAlignment(uint64_t Pos, uint64_t Align) {
+ assert(llvm::isPowerOf2_64(Align));
+ uint64_t Mod = Pos & (Align - 1);
+ if (Mod == 0)
+ return 0;
+ return Align - Mod;
+ }
};
// BoundedProducerConsumerQueue is a work queue that allows multiple
« src/IceELFObjectWriter.cpp ('K') | « src/IceTranslator.cpp ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698