Lines Matching refs:T
56 template <typename T>
57 bool ParseUint(const char *in, T* out) { in ParseUint()
63 if (std::numeric_limits<T>::max() < result) { in ParseUint()
66 *out = static_cast<T>(result); in ParseUint()
70 template <typename T>
71 bool ParseInt(const char* in, T* out) { in ParseInt()
77 if (result < std::numeric_limits<T>::min() || std::numeric_limits<T>::max() < result) { in ParseInt()
80 *out = static_cast<T>(result); in ParseInt()
84 template<typename T>
85 static constexpr bool IsPowerOfTwo(T x) { in IsPowerOfTwo()
89 template<int n, typename T>
90 static inline bool IsAligned(T x) { in IsAligned()
95 template<int n, typename T>
96 static inline bool IsAligned(T* x) { in IsAligned()
100 template<typename T>
101 static inline bool IsAlignedParam(T x, int n) { in IsAlignedParam()
165 template <typename T>
167 typedef T type;
171 template <typename T>
173 return sizeof(T) * CHAR_BIT;
177 template <typename T>
178 static constexpr size_t BitSizeOf(T x) {
179 return sizeof(T) * CHAR_BIT;
183 template<typename T>
184 static constexpr T RoundDown(T x, typename TypeIdentity<T>::type n) WARN_UNUSED;
186 template<typename T>
187 static constexpr T RoundDown(T x, typename TypeIdentity<T>::type n) {
189 DCHECK_CONSTEXPR(IsPowerOfTwo(n), , T(0))
193 template<typename T>
194 static constexpr T RoundUp(T x, typename TypeIdentity<T>::type n) WARN_UNUSED;
196 template<typename T>
197 static constexpr T RoundUp(T x, typename TypeIdentity<T>::type n) {
202 template<typename T>
203 static inline T* AlignDown(T* x, uintptr_t n) WARN_UNUSED;
205 template<typename T>
206 static inline T* AlignDown(T* x, uintptr_t n) {
207 return reinterpret_cast<T*>(RoundDown(reinterpret_cast<uintptr_t>(x), n));
210 template<typename T>
211 static inline T* AlignUp(T* x, uintptr_t n) WARN_UNUSED;
213 template<typename T>
214 static inline T* AlignUp(T* x, uintptr_t n) {
215 return reinterpret_cast<T*>(RoundUp(reinterpret_cast<uintptr_t>(x), n));
220 template <typename T>
221 static constexpr inline T RoundUpToPowerOfTwoRecursive(T x, size_t bit) {
222 return bit == (BitSizeOf<T>()) ? x: RoundUpToPowerOfTwoRecursive(x | x >> bit, bit << 1);
229 template <typename T>
230 static constexpr inline T RoundUpToPowerOfTwo(T x) {
247 template <typename T>
248 static constexpr ssize_t MostSignificantBit(T value) {
253 template <typename T>
254 static constexpr size_t MinimumBitsToStore(T value) {
258 template<typename T>
259 static constexpr int CLZ(T x) {
260 …static_assert(sizeof(T) <= sizeof(long long), "T too large, must be smaller than long long"); // …
261 return (sizeof(T) == sizeof(uint32_t))
266 template<typename T>
267 static constexpr int CTZ(T x) {
268 return (sizeof(T) == sizeof(uint32_t))
273 template<typename T>
274 static constexpr int POPCOUNT(T x) {
275 return (sizeof(T) == sizeof(uint32_t))
557 template <typename T>
558 using UniqueCPtr = std::unique_ptr<T, FreeDelete>;