#ifndef INCLUDE_CPPGC_SENTINEL_POINTER_H_
#define INCLUDE_CPPGC_SENTINEL_POINTER_H_
#include <cstdint>
#include "cppgc/internal/api-constants.h"
namespace cppgc {
namespace internal {
struct SentinelPointer {
#if defined(CPPGC_POINTER_COMPRESSION)
static constexpr intptr_t kSentinelValue =
1 << api_constants::kPointerCompressionShift;
#else
static constexpr intptr_t kSentinelValue = 0b10;
#endif
template <typename T>
operator T*() const {
return reinterpret_cast<T*>(kSentinelValue);
}
friend bool operator==(SentinelPointer, SentinelPointer) { return true; }
friend bool operator!=(SentinelPointer, SentinelPointer) { return false; }
};
}
constexpr internal::SentinelPointer kSentinelPointer;
}
#endif