ucmpdi2.c 516 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/module.h>
  3. #include <linux/libgcc.h>
  4. union ull_union {
  5. unsigned long long ull;
  6. struct {
  7. unsigned int high;
  8. unsigned int low;
  9. } ui;
  10. };
  11. word_type __ucmpdi2(unsigned long long a, unsigned long long b)
  12. {
  13. union ull_union au = {.ull = a};
  14. union ull_union bu = {.ull = b};
  15. if (au.ui.high < bu.ui.high)
  16. return 0;
  17. else if (au.ui.high > bu.ui.high)
  18. return 2;
  19. if (au.ui.low < bu.ui.low)
  20. return 0;
  21. else if (au.ui.low > bu.ui.low)
  22. return 2;
  23. return 1;
  24. }