diff --git a/libc/src/__support/CPP/limits.h b/libc/src/__support/CPP/limits.h --- a/libc/src/__support/CPP/limits.h +++ b/libc/src/__support/CPP/limits.h @@ -14,6 +14,14 @@ namespace __llvm_libc { namespace cpp { +// Some older gcc distributions don't define these for 32 bit targets. +#ifndef LLONG_MAX +constexpr size_t LLONG_BIT_WIDTH = sizeof(long long) * 8; +constexpr long long LLONG_MAX = ~0LL ^ (1LL << LLONG_BIT_WIDTH - 1); +constexpr long long LLONG_MIN = 1LL << LLONG_BIT_WIDTH - 1; +constexpr unsigned long long ULLONG_MAX = ~0ULL; +#endif + template class numeric_limits { public: static constexpr T max();