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

Function MinInt

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

Source from the content-addressed store, hash-verified

314
315template <typename T>
316constexpr T MinInt(size_t bits) {
317 DCHECK(std::is_unsigned<T>::value || bits > 0) << "bits cannot be zero for signed.";
318 DCHECK_LE(bits, BitSizeOf<T>());
319 return bits == BitSizeOf<T>()
320 ? std::numeric_limits<T>::min()
321 : std::is_signed<T>::value
322 ? ((bits == 1u) ? -1 : static_cast<T>(-1) - MaxInt<T>(bits))
323 : static_cast<T>(0);
324}
325
326// Returns value with bit set in lowest one-bit position or 0 if 0. (java.lang.X.lowestOneBit).
327template <typename kind>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected