Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Unified Diff: unit_test/unit_test.h

Issue 1662453003: fix for ubsan on unittest.h fastrand() (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: fix lint warning: Weird number of spaces at line-start. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/libyuv/version.h ('k') | unit_test/unit_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unit_test/unit_test.h
diff --git a/unit_test/unit_test.h b/unit_test/unit_test.h
index f816ec711ac4dc51be3937ff832f0faaf39840e0..009ff62abf682218f4ecf7bed49e2d3d4435a87f 100644
--- a/unit_test/unit_test.h
+++ b/unit_test/unit_test.h
@@ -55,10 +55,10 @@ static inline double get_time() {
}
#endif
-extern int fastrand_seed;
+extern unsigned int fastrand_seed;
inline int fastrand() {
- fastrand_seed = fastrand_seed * 214013 + 2531011;
- return (fastrand_seed >> 16) & 0xffff;
+ fastrand_seed = fastrand_seed * 214013u + 2531011u;
+ return static_cast<int>((fastrand_seed >> 16) & 0xffff);
}
static inline void MemRandomize(uint8* dst, int64 len) {
« no previous file with comments | « include/libyuv/version.h ('k') | unit_test/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698