From c3d18f512054d8268d1e1a2e5935167cd3db6480 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 26 Mar 2015 01:12:32 +0000 Subject: Remove implicit constructor and operator int from PowerOf2. This patch is to make instantiation and conversion to an integer explicit, so that we can mechanically replace all occurrences of the class with integer in the next step. Now get() returns an alignment value rather than its log2 value. llvm-svn: 233242 --- lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp') diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp index d34e2d3d63f..024a1c273fe 100644 --- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp @@ -849,10 +849,10 @@ uint64_t AtomChunk::memAlign() const { // the section. We restore that here. if (_atomLayouts.empty()) return _ctx.getPageSize(); - int align = _ctx.getPageSize(); + unsigned align = _ctx.getPageSize(); for (auto atomLayout : _atomLayouts) { auto *atom = cast(atomLayout->_atom); - align = std::max(align, 1 << atom->alignment().powerOf2); + align = std::max(align, (unsigned)atom->alignment().powerOf2.get()); } return align; } @@ -860,7 +860,7 @@ uint64_t AtomChunk::memAlign() const { void AtomChunk::appendAtom(const DefinedAtom *atom) { // Atom may have to be at a proper alignment boundary. If so, move the // pointer to make a room after the last atom before adding new one. - _size = llvm::RoundUpToAlignment(_size, 1 << atom->alignment().powerOf2); + _size = llvm::RoundUpToAlignment(_size, atom->alignment().powerOf2.get()); // Create an AtomLayout and move the current pointer. auto *layout = new (_alloc) AtomLayout(atom, _size, _size); -- cgit v1.2.3