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