From 235838e1b8ab36e139b190780c2ac5f3e2f86101 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Wed, 25 Mar 2015 13:12:59 +0000 Subject: [PATCH] [Mips] Factor out the code that extracts a relocation 'tag' into the separate function That keeps "extracting" logic into the single place and removes a VC++ compilation warning. llvm-svn: 233186 --- lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h index 7381c7e977bf..0b8df1cc9654 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -101,19 +101,23 @@ public: : ELFReference( &rel, rel.r_offset - symValue, Reference::KindArch::Mips, rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)), - _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {} + _tag(extractTag(rel)) {} MipsELFReference(uint64_t symValue, const Elf_Rel &rel) : ELFReference(rel.r_offset - symValue, Reference::KindArch::Mips, rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)), - _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {} + _tag(extractTag(rel)) {} uint32_t tag() const override { return _tag; } void setTag(uint32_t tag) { _tag = tag; } private: uint32_t _tag; + + template static uint32_t extractTag(const R &rel) { + return (rel.getType(_isMips64EL) & 0xffffff00) >> 8; + } }; template class MipsELFFile : public ELFFile {