[algs] Use __builtin_mul_overflow Compiles to smaller binary.
diff --git a/src/hb-algs.hh b/src/hb-algs.hh index bcd7ad0..9659d63 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh
@@ -853,10 +853,14 @@ * Overflow checking. */ -/* Consider __builtin_mul_overflow use here also */ static inline bool hb_unsigned_mul_overflows (unsigned int count, unsigned int size) { +#if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) + unsigned result; + return __builtin_mul_overflow (count, size, &result); +#endif + return (size > 0) && (count >= ((unsigned int) -1) / size); }