logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0006-Use-static-inline-function-for-cmp_numbers.patch (927B)


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