Commit ec660c3e authored by Yaowu Xu's avatar Yaowu Xu Committed by Urvang Joshi

Use uint64_t to avoid integer overflow

Fixes the overflow of unsigned int in *state * 1103515245.

Change-Id: Id35b8baa205f1ef8829ae4c8708f0c65edb01ada
parent 93105538
......@@ -42,7 +42,7 @@ void av1_calc_indices(const float *data, const float *centroids,
// Generate a random number in the range [0, 32768).
static unsigned int lcg_rand16(unsigned int *state) {
*state = *state * 1103515245 + 12345;
*state = (unsigned int)(*state * 1103515245ULL + 12345);
return *state / 65536 % 32768;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment