ucmpdi2.c 484 B

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