mirror of
https://github.com/google/googletest.git
synced 2024-12-26 17:41:03 +08:00
Fix sign conversion warning from clang:
googletest/samples/prime_tables.h:81:57: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion] : is_prime_size_(max + 1), is_prime_(new bool[max + 1]) { ~~~ ~~~~^~~ PiperOrigin-RevId: 506065360 Change-Id: Ida4550562531012c089e2f9fcf530b3a78889fa3
This commit is contained in:
parent
4fb7039fda
commit
d9251171f5
@ -78,8 +78,9 @@ class PreCalculatedPrimeTable : public PrimeTable {
|
||||
public:
|
||||
// 'max' specifies the maximum number the prime table holds.
|
||||
explicit PreCalculatedPrimeTable(int max)
|
||||
: is_prime_size_(max + 1), is_prime_(new bool[max + 1]) {
|
||||
CalculatePrimesUpTo(max);
|
||||
: is_prime_size_(std::max(1, max + 1)),
|
||||
is_prime_(new bool[static_cast<size_t>(is_prime_size_)]) {
|
||||
CalculatePrimesUpTo(is_prime_size_ - 1);
|
||||
}
|
||||
~PreCalculatedPrimeTable() override { delete[] is_prime_; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user