mb/starlabs/{lite_adl,byte_adl}: Don't select MAINBOARD_HAS_TPM2
[coreboot2.git] / src / commonlib / bsd / gcd.c
blobfbc8103a32eecf99d80192b75f2f634dd89ae7ee
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #include <commonlib/bsd/gcd.h>
4 #include <commonlib/bsd/helpers.h>
5 #include <stdint.h>
7 uint64_t gcd(uint64_t a, uint64_t b)
9 uint64_t c;
11 if (a == 0 || b == 0)
12 return MAX(a, b);
14 c = a % b;
16 while (c > 0) {
17 a = b;
18 b = c;
19 c = a % b;
22 return b;