vpx_timestamp,gcd: assert params are positive
this function is currently only used with range checked timestamp values, but this documents the function's expectations in case it's used elsewhere Change-Id: I9de314fc500a49f34f8a1df3598d64bc5070248e
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
#ifndef VPX_VPX_UTIL_VPX_TIMESTAMP_H_
|
#ifndef VPX_VPX_UTIL_VPX_TIMESTAMP_H_
|
||||||
#define VPX_VPX_UTIL_VPX_TIMESTAMP_H_
|
#define VPX_VPX_UTIL_VPX_TIMESTAMP_H_
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
@@ -23,7 +25,9 @@ typedef struct vpx_rational64 {
|
|||||||
|
|
||||||
static INLINE int gcd(int64_t a, int b) {
|
static INLINE int gcd(int64_t a, int b) {
|
||||||
int r; // remainder
|
int r; // remainder
|
||||||
while (b > 0) {
|
assert(a >= 0);
|
||||||
|
assert(b > 0);
|
||||||
|
while (b != 0) {
|
||||||
r = (int)(a % b);
|
r = (int)(a % b);
|
||||||
a = b;
|
a = b;
|
||||||
b = r;
|
b = r;
|
||||||
|
|||||||
Reference in New Issue
Block a user