cmpdi2.c 501 B

123456789101112131415161718192021222324252627282930
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. */
  4. #include <linux/export.h>
  5. #include <linux/libgcc.h>
  6. word_type notrace __cmpdi2(long long a, long long b)
  7. {
  8. const DWunion au = {
  9. .ll = a
  10. };
  11. const DWunion bu = {
  12. .ll = b
  13. };
  14. if (au.s.high < bu.s.high)
  15. return 0;
  16. else if (au.s.high > bu.s.high)
  17. return 2;
  18. if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
  19. return 0;
  20. else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
  21. return 2;
  22. return 1;
  23. }
  24. EXPORT_SYMBOL(__cmpdi2);