1 #include <linux/export.h>
7 #define __ll_B ((unsigned long) 1 << (W_TYPE_SIZE / 2))
8 #define __ll_lowpart(t) ((unsigned long) (t) & (__ll_B - 1))
9 #define __ll_highpart(t) ((unsigned long) (t) >> (W_TYPE_SIZE / 2))
11 /* If we still don't have umul_ppmm, define it using plain C. */
12 #if !defined(umul_ppmm)
13 #define umul_ppmm(w1, w0, u, v) \
15 unsigned long __x0, __x1, __x2, __x3; \
16 unsigned short __ul, __vl, __uh, __vh; \
18 __ul = __ll_lowpart(u); \
19 __uh = __ll_highpart(u); \
20 __vl = __ll_lowpart(v); \
21 __vh = __ll_highpart(v); \
23 __x0 = (unsigned long) __ul * __vl; \
24 __x1 = (unsigned long) __ul * __vh; \
25 __x2 = (unsigned long) __uh * __vl; \
26 __x3 = (unsigned long) __uh * __vh; \
28 __x1 += __ll_highpart(__x0); /* this can't give carry */\
29 __x1 += __x2; /* but this indeed can */ \
30 if (__x1 < __x2) /* did we get it? */ \
31 __x3 += __ll_B; /* yes, add it in the proper pos */ \
33 (w1) = __x3 + __ll_highpart(__x1); \
34 (w0) = __ll_lowpart(__x1) * __ll_B + __ll_lowpart(__x0);\
38 #if !defined(__umulsidi3)
39 #define __umulsidi3(u, v) ({ \
41 umul_ppmm(__w.s.high, __w.s.low, u, v); \
46 long long __muldi3(long long u
, long long v
)
48 const DWunion uu
= {.ll
= u
};
49 const DWunion vv
= {.ll
= v
};
50 DWunion w
= {.ll
= __umulsidi3(uu
.s
.low
, vv
.s
.low
)};
52 w
.s
.high
+= ((unsigned long) uu
.s
.low
* (unsigned long) vv
.s
.high
53 + (unsigned long) uu
.s
.high
* (unsigned long) vv
.s
.low
);
57 EXPORT_SYMBOL(__muldi3
);
This page took 0.0345 seconds and 5 git commands to generate.