GNU Linux-libre 6.5.10-gnu
[releases.git] / arch / parisc / lib / ucmpdi2.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/module.h>
3 #include <linux/libgcc.h>
4
5 union ull_union {
6         unsigned long long ull;
7         struct {
8                 unsigned int high;
9                 unsigned int low;
10         } ui;
11 };
12
13 word_type __ucmpdi2(unsigned long long a, unsigned long long b)
14 {
15         union ull_union au = {.ull = a};
16         union ull_union bu = {.ull = b};
17
18         if (au.ui.high < bu.ui.high)
19                 return 0;
20         else if (au.ui.high > bu.ui.high)
21                 return 2;
22         if (au.ui.low < bu.ui.low)
23                 return 0;
24         else if (au.ui.low > bu.ui.low)
25                 return 2;
26         return 1;
27 }