From 909c317b2deb184d95c7d289cbe6603e209ed72d Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Tue, 31 Oct 2023 14:57:04 +0800 Subject: commonlib: Add GCD function Implement a simple GCD function. BUG=b:307790895 TEST=emerge-geralt coreboot TEST=make tests/commonlib/bsd/gcd-test Change-Id: I21819cda4299b3809b8ca7a95cbdc6a87e4b3481 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/78798 Reviewed-by: Martin L Roth Reviewed-by: Julius Werner Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/commonlib/bsd/include/commonlib/bsd/gcd.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/commonlib/bsd/include/commonlib/bsd/gcd.h (limited to 'src/commonlib/bsd/include') diff --git a/src/commonlib/bsd/include/commonlib/bsd/gcd.h b/src/commonlib/bsd/include/commonlib/bsd/gcd.h new file mode 100644 index 0000000000..20949ded09 --- /dev/null +++ b/src/commonlib/bsd/include/commonlib/bsd/gcd.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +#ifndef _COMMONLIB_BSD_GCD_H_ +#define _COMMONLIB_BSD_GCD_H_ + +#include + +uint32_t gcd32(uint32_t a, uint32_t b); + +#endif /* _COMMONLIB_BSD_GCD_H_ */ -- cgit v1.2.3