vpx_usec_timer_elapsed: use 64-bit math
this prevents a rollover when tv_sec is a long: signed integer overflow: 2776 * 1000000 cannot be represented in type 'long' Change-Id: I03dc4476ee122b02e2856dad28358a20cf16a9f8
This commit is contained in:
parent
c3f095c8b3
commit
943f9c0356
@ -83,7 +83,7 @@ static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) {
|
|||||||
struct timeval diff;
|
struct timeval diff;
|
||||||
|
|
||||||
timersub(&t->end, &t->begin, &diff);
|
timersub(&t->end, &t->begin, &diff);
|
||||||
return diff.tv_sec * 1000000 + diff.tv_usec;
|
return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user