Rev 4538 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4538 | Rev 5056 | ||
---|---|---|---|
Line 131... | Line 131... | ||
131 | *remainder = dividend; |
131 | *remainder = dividend; |
Line 132... | Line 132... | ||
132 | 132 | ||
133 | return ret; |
133 | return ret; |
Line -... | Line 134... | ||
- | 134 | } |
|
- | 135 | ||
- | 136 | #if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) |
|
- | 137 | ||
- | 138 | #ifndef mul_u64_u32_shr |
|
- | 139 | static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift) |
|
- | 140 | { |
|
- | 141 | return (u64)(((unsigned __int128)a * mul) >> shift); |
|
- | 142 | } |
|
- | 143 | #endif /* mul_u64_u32_shr */ |
|
- | 144 | ||
- | 145 | #else |
|
- | 146 | ||
- | 147 | #ifndef mul_u64_u32_shr |
|
- | 148 | static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift) |
|
- | 149 | { |
|
- | 150 | u32 ah, al; |
|
- | 151 | u64 ret; |
|
- | 152 | ||
- | 153 | al = a; |
|
- | 154 | ah = a >> 32; |
|
- | 155 | ||
- | 156 | ret = ((u64)al * mul) >> shift; |
|
- | 157 | if (ah) |
|
- | 158 | ret += ((u64)ah * mul) << (32 - shift); |
|
- | 159 | ||
- | 160 | return ret; |
|
- | 161 | } |
|
- | 162 | #endif /* mul_u64_u32_shr */ |
|
- | 163 | ||
134 | } |
164 | #endif |