mirror of
https://github.com/oasislinux/oasis.git
synced 2026-03-23 11:32:48 +01:00
38 lines
927 B
Diff
38 lines
927 B
Diff
From 8dc8b17a429e26984936fb04b21a62a857c433bf Mon Sep 17 00:00:00 2001
|
|
From: Michael Forney <mforney@mforney.org>
|
|
Date: Tue, 25 Jun 2019 00:13:43 -0700
|
|
Subject: [PATCH] Use static inline function for cmp_numbers
|
|
|
|
All callers use it with an unsigned type, so just specialize for
|
|
uintmax_t.
|
|
---
|
|
include/c.h | 12 +++++-------
|
|
1 file changed, 5 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/include/c.h b/include/c.h
|
|
index 1ba8c2beb..0c923112d 100644
|
|
--- a/include/c.h
|
|
+++ b/include/c.h
|
|
@@ -165,13 +165,11 @@ umin(uintmax_t x, uintmax_t y)
|
|
_a > _b ? _a - _b : _b - _a; })
|
|
#endif
|
|
|
|
-#ifndef cmp_numbers
|
|
-# define cmp_numbers(x, y) __extension__ ({ \
|
|
- __typeof__(x) _a = (x); \
|
|
- __typeof__(y) _b = (y); \
|
|
- (void) (&_a == &_b); \
|
|
- _a == _b ? 0 : _a > _b ? 1 : -1; })
|
|
-#endif
|
|
+static inline uintmax_t
|
|
+cmp_numbers(uintmax_t x, uintmax_t y)
|
|
+{
|
|
+ return x == y ? 0 : x > y ? 1 : -1;
|
|
+}
|
|
|
|
|
|
#ifndef cmp_timespec
|
|
--
|
|
2.49.0
|
|
|