1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18:
19:
20: #ifndef _LONGLONG_
21: #define _LONGLONG_
22:
23: #if TK_HAS_DOUBLEWORD
24:
25: #define ltoll(a) ( (D)(a) )
26: #define ultoll(a) ( (D)(a) )
27: #define uitoll(a) ( (D)(a) )
28: #define lltol(a) ( (long)(a) )
29: #define lltoul(a) ( (unsigned long)(a) )
30: #define ll_add(a,b) ( (a) + (b) )
31: #define ll_sub(a,b) ( (a) - (b) )
32: #define ll_mul(a,b) ( (a) * (b) )
33: #define li_mul(a,b) ( (a) * (b) )
34: #define lui_mul(a,b) ( (a) * (b) )
35: #define ll_div(a,b) ( (a) / (b) )
36: #define li_div(a,b) ( (a) / (b) )
37: #define lui_div(a,b) ( (a) / (b) )
38: #define ll_mod(a,b) ( (a) % (b) )
39: #define li_mod(a,b) ( (a) % (b) )
40: #define lui_mod(a,b) ( (a) % (b) )
41: #define ll_cmp(a,b) ( (a) - (b) )
42: #define ll_sign(a) ( (a) )
43: #define ll_neg(a) ( -(a) )
44: #define ll_inc(a) ( (*(a))++ )
45: #define ll_dec(a) ( (*(a))-- )
46:
47: #define hilo_ll(ll, h, l) ( (ll) = ((D)(h) << 32) | (l) )
48: #define ll_hilo(h, l, ll) ( (h) = (W)((ll) >> 32), \
49: (l) = (UW)(ll) )
50:
51: #else
52:
53: typedef struct {
54: long hi;
55: unsigned long lo;
56: } longlong;
57:
58: extern longlong ltoll( long a );
59: extern longlong ultoll( unsigned long a );
60: extern longlong uitoll( UINT a );
61: extern long lltol( longlong a );
62: extern unsigned long lltoul( longlong a );
63: extern longlong ll_add( longlong a, longlong b );
64: extern longlong ll_sub( longlong a, longlong b );
65: extern longlong ll_mul( longlong a, longlong b );
66: extern longlong li_mul( longlong a, long b );
67: extern longlong lui_mul( longlong a, UINT b );
68: extern longlong ll_div( longlong a, longlong b );
69: extern longlong li_div( longlong a, long b );
70: extern longlong lui_div( longlong a, UINT b );
71: extern longlong ll_mod( longlong a, longlong b );
72: extern long li_mod( longlong a, long b );
73: extern long lui_mod( longlong a, UINT b );
74: extern int ll_cmp( longlong a, longlong b );
75: extern int ll_sign( longlong a );
76: extern longlong ll_neg( longlong a );
77: extern void ll_inc( longlong *a );
78: extern void ll_dec( longlong *a );
79:
80: #define hilo_ll(ll, h, l) ( (ll).hi = (h), (ll).lo = (l) )
81: #define ll_hilo(h, l, ll) ( (h) = (ll).hi, (l) = (ll).lo )
82:
83: #endif
84:
85: #endif