MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / IsInt

Function IsInt

Bcore/src/main/cpp/base/bit_utils.h:245–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243// Check whether an N-bit two's-complement representation can hold value.
244template <typename T>
245inline bool IsInt(size_t N, T value) {
246 if (N == BitSizeOf<T>()) {
247 return true;
248 } else {
249 CHECK_LT(0u, N);
250 CHECK_LT(N, BitSizeOf<T>());
251 T limit = static_cast<T>(1) << (N - 1u);
252 return (-limit <= value) && (value < limit);
253 }
254}
255
256template <typename T>
257constexpr T GetIntLimit(size_t bits) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected