1From 8dc8b17a429e26984936fb04b21a62a857c433bf Mon Sep 17 00:00:00 2001
2From: Michael Forney <mforney@mforney.org>
3Date: Tue, 25 Jun 2019 00:13:43 -0700
4Subject: [PATCH] Use static inline function for cmp_numbers
5
6All callers use it with an unsigned type, so just specialize for
7uintmax_t.
8---
9 include/c.h | 12 +++++-------
10 1 file changed, 5 insertions(+), 7 deletions(-)
11
12diff --git a/include/c.h b/include/c.h
13index 1ba8c2beb..0c923112d 100644
14--- a/include/c.h
15+++ b/include/c.h
16@@ -165,13 +165,11 @@ umin(uintmax_t x, uintmax_t y)
17 _a > _b ? _a - _b : _b - _a; })
18 #endif
19
20-#ifndef cmp_numbers
21-# define cmp_numbers(x, y) __extension__ ({ \
22- __typeof__(x) _a = (x); \
23- __typeof__(y) _b = (y); \
24- (void) (&_a == &_b); \
25- _a == _b ? 0 : _a > _b ? 1 : -1; })
26-#endif
27+static inline uintmax_t
28+cmp_numbers(uintmax_t x, uintmax_t y)
29+{
30+ return x == y ? 0 : x > y ? 1 : -1;
31+}
32
33
34 #ifndef cmp_timespec
35--
362.49.0
37