ref: 70041462c8a667b0ffda1328f4eb9e0770aed20a
parent: 1d66ec91dac54dac4809f9c56e0b6572c2675dc7
parent: ebadd5287a4456541daf36a6a718ea2467bb8c7e
author: Hien Ho <[email protected]>
date: Tue Aug 27 15:05:19 EDT 2019
Merge "test/acm_random.h: int sanitizer warning"
--- a/test/acm_random.h
+++ b/test/acm_random.h
@@ -42,8 +42,7 @@
int16_t Rand16Signed(void) {
// Use 16 bits: values between 32767 and -32768.
- const uint32_t value = random_.Generate(65536);
- return static_cast<int16_t>(value) - 32768;
+ return static_cast<int16_t>(random_.Generate(65536));
}
int16_t Rand13Signed(void) {
@@ -69,7 +68,7 @@
// Returns a random value near 0 or near 255, to better exercise
// saturation behavior.
const uint8_t r = Rand8();
- return r < 128 ? r << 4 : r >> 4;
+ return static_cast<uint8_t>((r < 128) ? r << 4 : r >> 4);
}
uint32_t RandRange(const uint32_t range) {
--- a/test/avg_test.cc
+++ b/test/avg_test.cc
@@ -425,10 +425,10 @@
TEST_P(SatdLowbdTest, Random) {
int expected;
switch (satd_size_) {
- case 16: expected = 263252; break;
- case 64: expected = 1105420; break;
- case 256: expected = 4252250; break;
- case 1024: expected = 16876840; break;
+ case 16: expected = 261036; break;
+ case 64: expected = 991732; break;
+ case 256: expected = 4136358; break;
+ case 1024: expected = 16677592; break;
default:
FAIL() << "Invalid satd size (" << satd_size_
<< ") valid: 16/64/256/1024";