summaryrefslogtreecommitdiff
path: root/test/acm_random.h
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2016-05-27 10:33:56 -0700
committerJames Zern <jzern@google.com>2016-05-27 10:33:56 -0700
commit13d48c4267b4de83048602d6a8c2c30db51cf13c (patch)
tree404a4b8d8c77cc63ebeb7850ccc4e15268dd1b10 /test/acm_random.h
parent0ba9b299e957d4ecb476386fa9b9f1624fd83ab7 (diff)
downloadlibvpx-13d48c4267b4de83048602d6a8c2c30db51cf13c.tar
libvpx-13d48c4267b4de83048602d6a8c2c30db51cf13c.tar.gz
libvpx-13d48c4267b4de83048602d6a8c2c30db51cf13c.tar.bz2
libvpx-13d48c4267b4de83048602d6a8c2c30db51cf13c.zip
acm_random,Rand9Signed: correct cast
convert the random value to int16 before subtracting 256 from it; quiets a ubsan (sanitize=integer) warning BUG=webm:1225 Change-Id: Ibc2c5a21f30e112bd6c180f7d6a033327c38d0df
Diffstat (limited to 'test/acm_random.h')
-rw-r--r--test/acm_random.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/acm_random.h b/test/acm_random.h
index a29ced2f7..b94b6e195 100644
--- a/test/acm_random.h
+++ b/test/acm_random.h
@@ -35,7 +35,7 @@ class ACMRandom {
int16_t Rand9Signed(void) {
// Use 9 bits: values between 255 (0x0FF) and -256 (0x100).
const uint32_t value = random_.Generate(512);
- return static_cast<int16_t>(value - 256);
+ return static_cast<int16_t>(value) - 256;
}
uint8_t Rand8(void) {