ucmpdi2.c 448 B

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