Rev 1179 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1179 | Rev 1221 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | typedef signed short __s16; |
33 | typedef signed short __s16; |
34 | typedef signed int __s32; |
34 | typedef signed int __s32; |
35 | typedef signed long long __s64; |
35 | typedef signed long long __s64; |
36 | 36 | ||
Line -... | Line 37... | ||
- | 37 | typedef __u32 __be32; |
|
Line 37... | Line 38... | ||
37 | 38 | ||
38 | typedef unsigned char uint8_t; |
39 | typedef unsigned char uint8_t; |
39 | typedef unsigned short uint16_t; |
40 | typedef unsigned short uint16_t; |
40 | typedef unsigned int uint32_t; |
41 | typedef unsigned int uint32_t; |
Line 198... | Line 199... | ||
198 | typeof(y) _y = (y); \ |
199 | typeof(y) _y = (y); \ |
199 | (void) (&_x == &_y); \ |
200 | (void) (&_x == &_y); \ |
200 | _x > _y ? _x : _y; }) |
201 | _x > _y ? _x : _y; }) |
201 | 202 | ||
Line 202... | Line -... | ||
202 | - | ||
203 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); |
203 | #define do_div(n, base) \ |
204 | - | ||
205 | # define do_div(n,base) ({ \ |
204 | ({ \ |
- | 205 | unsigned long __upper, __low, __high, __mod, __base; \ |
|
206 | uint32_t __base = (base); \ |
206 | __base = (base); \ |
207 | uint32_t __rem; \ |
207 | asm("":"=a" (__low), "=d" (__high) : "A" (n)); \ |
208 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ |
208 | __upper = __high; \ |
209 | if (likely(((n) >> 32) == 0)) { \ |
209 | if (__high) { \ |
210 | __rem = (uint32_t)(n) % __base; \ |
210 | __upper = __high % (__base); \ |
211 | (n) = (uint32_t)(n) / __base; \ |
211 | __high = __high / (__base); \ |
212 | } else \ |
212 | } \ |
- | 213 | asm("divl %2":"=a" (__low), "=d" (__mod) \ |
|
213 | __rem = __div64_32(&(n), __base); \ |
214 | : "rm" (__base), "0" (__low), "1" (__upper)); \ |
- | 215 | asm("":"=A" (n) : "a" (__low), "d" (__high)); \ |
|
214 | __rem; \ |
216 | __mod; \ |
215 | }) |
217 | }) |
Line -... | Line 218... | ||
- | 218 | ||
216 | 219 | ||
Line 217... | Line 220... | ||
217 | #define lower_32_bits(n) ((u32)(n)) |
220 | #define lower_32_bits(n) ((u32)(n)) |
218 | 221 | ||
219 | #define INT_MAX ((int)(~0U>>1)) |
222 | #define INT_MAX ((int)(~0U>>1)) |