Clean up untag_address.
We had two copies of this function, one (not quite correct) in tests/utils.h
and another in bionic/macros.h. Delete the former and have the users include
the latter.
Also, create an overload of the function that takes a uintptr_t, which will
be useful for out-of-process scenarios such as the MTE support in debuggerd.
Bug: 135772972
Change-Id: Ia3c2652c97797663146b3f05fa786afe09f7ea97
diff --git a/tests/utils.h b/tests/utils.h
index 5014ef7..5085a7a 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -25,6 +25,8 @@
#include <sys/wait.h>
#include <unistd.h>
+#include <bionic/macros.h>
+
#include <atomic>
#include <string>
#include <regex>
@@ -66,14 +68,6 @@
#define SKIP_WITH_HWASAN if (running_with_hwasan()) GTEST_SKIP()
-static inline void* untag_address(void* addr) {
-#if defined(__LP64__)
- constexpr uintptr_t mask = (static_cast<uintptr_t>(1) << 56) - 1;
- addr = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) & mask);
-#endif
- return addr;
-}
-
#if defined(__linux__)
#include <sys/sysmacros.h>