14#ifndef WPIUTIL_WPI_POINTERLIKETYPETRAITS_H
15#define WPIUTIL_WPI_POINTERLIKETYPETRAITS_H
31 : std::integral_constant<size_t, ConstantLog2<N / 2>::value + 1> {};
32template <>
struct ConstantLog2<1> : std::integral_constant<size_t, 0> {};
36 static const bool value =
false;
51 static const bool value =
true;
60 static constexpr int NumLowBitsAvailable =
75 static constexpr int NumLowBitsAvailable = 2;
83 return NonConst::getAsVoidPointer(P);
86 return NonConst::getFromVoidPointer(
const_cast<void *
>(P));
88 static constexpr int NumLowBitsAvailable = NonConst::NumLowBitsAvailable;
96 return NonConst::getAsVoidPointer(
const_cast<T *
>(P));
99 return NonConst::getFromVoidPointer(
const_cast<void *
>(P));
101 static constexpr int NumLowBitsAvailable = NonConst::NumLowBitsAvailable;
107 return reinterpret_cast<void *
>(P);
113 static constexpr int NumLowBitsAvailable = 0;
124template <
int Alignment,
typename FunctionPo
interT>
131 "Alignment not satisfied for an actual function pointer!");
132 return reinterpret_cast<void *
>(P);
135 return reinterpret_cast<FunctionPointerT
>(P);
146template <
typename ReturnT,
typename... ParamTs>
detail namespace with internal helper functions
Definition: xchar.h:20
uint128_t uintptr_t
Definition: format.h:484
Definition: ntcore_cpp.h:26
Provide suitable custom traits struct for function pointers.
Definition: PointerLikeTypeTraits.h:125
static FunctionPointerT getFromVoidPointer(void *P)
Definition: PointerLikeTypeTraits.h:134
static void * getAsVoidPointer(FunctionPointerT P)
Definition: PointerLikeTypeTraits.h:128
static constexpr int NumLowBitsAvailable
Definition: PointerLikeTypeTraits.h:126
Definition: PointerLikeTypeTraits.h:56
static T * getFromVoidPointer(void *P)
Definition: PointerLikeTypeTraits.h:58
static void * getAsVoidPointer(T *P)
Definition: PointerLikeTypeTraits.h:57
PointerLikeTypeTraits< T > NonConst
Definition: PointerLikeTypeTraits.h:80
static const T getFromVoidPointer(const void *P)
Definition: PointerLikeTypeTraits.h:85
static const void * getAsVoidPointer(const T P)
Definition: PointerLikeTypeTraits.h:82
static const void * getAsVoidPointer(const T *P)
Definition: PointerLikeTypeTraits.h:95
static const T * getFromVoidPointer(const void *P)
Definition: PointerLikeTypeTraits.h:98
PointerLikeTypeTraits< T * > NonConst
Definition: PointerLikeTypeTraits.h:93
static void * getAsVoidPointer(uintptr_t P)
Definition: PointerLikeTypeTraits.h:106
static uintptr_t getFromVoidPointer(void *P)
Definition: PointerLikeTypeTraits.h:109
static void * getAsVoidPointer(void *P)
Definition: PointerLikeTypeTraits.h:65
static void * getFromVoidPointer(void *P)
Definition: PointerLikeTypeTraits.h:66
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
Definition: PointerLikeTypeTraits.h:25
A tiny meta function to compute the log2 of a compile time constant.
Definition: PointerLikeTypeTraits.h:31
Definition: PointerLikeTypeTraits.h:35
static const bool value
Definition: PointerLikeTypeTraits.h:36
Definition: PointerLikeTypeTraits.h:46
static const bool value
Definition: PointerLikeTypeTraits.h:47