summaryrefslogtreecommitdiff
path: root/include/lld/ReaderWriter/RelocationHelperFunctions.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
commit5a5c549fe9a3fef595297bd21d36bed8409dc37d (patch)
treea964c8f5ac85b7b641cac022c5f9bf4eed3d2b9b /include/lld/ReaderWriter/RelocationHelperFunctions.h
parentfb911942f1434f3d1750f83f25f5e42c80e60638 (diff)
Notes
Diffstat (limited to 'include/lld/ReaderWriter/RelocationHelperFunctions.h')
-rw-r--r--include/lld/ReaderWriter/RelocationHelperFunctions.h57
1 files changed, 0 insertions, 57 deletions
diff --git a/include/lld/ReaderWriter/RelocationHelperFunctions.h b/include/lld/ReaderWriter/RelocationHelperFunctions.h
deleted file mode 100644
index 8738e91ebabc..000000000000
--- a/include/lld/ReaderWriter/RelocationHelperFunctions.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//===- lld/ReaderWriter/RelocationHelperFunctions.h------------------------===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_READER_WRITER_RELOCATION_HELPER_FUNCTIONS_H
-#define LLD_READER_WRITER_RELOCATION_HELPER_FUNCTIONS_H
-
-namespace lld {
-
-/// Gather val's bits as specified by the mask. Example:
-///
-/// Val: 0bABCDEFGHIJKLMN
-/// Mask: 0b10111100001011
-/// Output: 0b000000ACDEFKMN
-template <typename T> T gatherBits(T val, T mask) {
- T result = 0;
- size_t off = 0;
-
- for (size_t bit = 0; bit < sizeof(T) * 8; ++bit) {
- bool maskBit = (mask >> bit) & 1;
- if (maskBit) {
- bool valBit = (val >> bit) & 1;
- result |= static_cast<T>(valBit) << off;
- ++off;
- }
- }
- return result;
-}
-
-/// Scatter val's bits as specified by the mask. Example:
-///
-/// Val: 0bABCDEFG
-/// Mask: 0b10111100001011
-/// Output: 0b00ABCD0000E0FG
-template <typename T> T scatterBits(T val, T mask) {
- T result = 0;
- size_t off = 0;
-
- for (size_t bit = 0; bit < sizeof(T) * 8; ++bit) {
- bool maskBit = (mask >> bit) & 1;
- if (maskBit) {
- bool valBit = (val >> off) & 1;
- result |= static_cast<T>(valBit) << bit;
- ++off;
- }
- }
- return result;
-}
-
-} // namespace lld
-
-#endif // LLD_READER_WRITER_RELOCATION_HELPER_FUNCTIONS_H