diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-03-28 15:31:23 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-04-05 12:03:31 +0000 |
commit | c3caa80c659cc05aaee277d1384b5f367b49b43c (patch) | |
tree | 0dbe23750808cd350d577e4ec3b745cf222f05f2 /vespalib/src/tests/slime | |
parent | 27bfabe66929330b7ec29f6a8dc492521ff54b44 (diff) |
Avoid INT64_MIN - 1 overflow for max-computation by explicitly using unsigned sub-expression
Also use for min-computation for good measure.
Diffstat (limited to 'vespalib/src/tests/slime')
-rw-r--r-- | vespalib/src/tests/slime/slime_binary_format_test.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vespalib/src/tests/slime/slime_binary_format_test.cpp b/vespalib/src/tests/slime/slime_binary_format_test.cpp index 459826d691e..ba2aacb88b9 100644 --- a/vespalib/src/tests/slime/slime_binary_format_test.cpp +++ b/vespalib/src/tests/slime/slime_binary_format_test.cpp @@ -248,9 +248,9 @@ TEST("testCmprUlong") { for (uint32_t n = 1; n <= MAX_CMPR_SIZE; ++n) { TEST_STATE(vespalib::make_string("n = %d", n).c_str()); uint64_t min = (n == 1) ? 0x00 - : (1L << ((n - 1) * 7)); + : (1ULL << ((n - 1) * 7)); uint64_t max = (n == MAX_CMPR_SIZE) ? 0xffffffffffffffff - : (1L << (n * 7)) - 1; + : (1ULL << (n * 7)) - 1; SimpleBuffer expect_min; SimpleBuffer expect_max; for (uint32_t i = 0; i < n; ++i) { |