From 10c47465e2505ddfee4e62a2ab2e535abea3ec56 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Thu, 1 Dec 2022 12:34:21 +0000 Subject: [Alignment] Use Align for ObjectFile::getSectionAlignment Differential Revision: https://reviews.llvm.org/D139098 --- llvm/lib/Object/MachOObjectFile.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 39e84ff..7f90284 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -1990,17 +1990,10 @@ MachOObjectFile::getSectionContents(DataRefImpl Sec) const { return getSectionContents(Offset, Size); } -uint64_t MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const { - uint32_t Align; - if (is64Bit()) { - MachO::section_64 Sect = getSection64(Sec); - Align = Sect.align; - } else { - MachO::section Sect = getSection(Sec); - Align = Sect.align; - } +Align MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const { - return uint64_t(1) << Align; + return is64Bit() ? Align(1ULL << getSection64(Sec).align) + : Align(1ULL << getSection(Sec).align); } Expected MachOObjectFile::getSection(unsigned SectionIndex) const { -- cgit v1.1