Remove assert(b != 0).
diff --git a/apps/shared/avifutil.c b/apps/shared/avifutil.c
index 3509a42..003fd64 100644
--- a/apps/shared/avifutil.c
+++ b/apps/shared/avifutil.c
@@ -3,7 +3,6 @@
#include "avifutil.h"
-#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -16,22 +15,18 @@
// overflowing int32_t.
static int64_t calcGCD(int64_t a, int64_t b)
{
- assert(b != 0);
if (a < 0) {
a *= -1;
}
if (b < 0) {
b *= -1;
}
- for (;;) {
+ while (b != 0) {
int64_t r = a % b;
- if (r == 0) {
- break;
- }
a = b;
b = r;
}
- return b;
+ return a;
}
static void printClapFraction(const char * name, int32_t n, int32_t d)
diff --git a/src/avif.c b/src/avif.c
index 09f7f17..b17d396 100644
--- a/src/avif.c
+++ b/src/avif.c
@@ -3,7 +3,6 @@
#include "avif/internal.h"
-#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <string.h>
@@ -515,22 +514,18 @@
// overflowing int32_t.
static int64_t calcGCD(int64_t a, int64_t b)
{
- assert(b != 0);
if (a < 0) {
a *= -1;
}
if (b < 0) {
b *= -1;
}
- for (;;) {
+ while (b != 0) {
int64_t r = a % b;
- if (r == 0) {
- break;
- }
a = b;
b = r;
}
- return b;
+ return a;
}
static void clapFractionSimplify(clapFraction * f)