diff options
| author | Ingo Molnar <mingo@kernel.org> | 2013-12-17 15:22:35 +0100 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-12-17 15:22:35 +0100 |
| commit | ffe732c2430c55074bebb172d33d909c662cd0e3 (patch) | |
| tree | d39087d7b5d8caa505b23b6ea2abc2e33efa5be5 /include/linux/math64.h | |
| parent | 40ea2b42d7c44386cf81d5636d574193da2c8df2 (diff) | |
| parent | 757dfcaa41844595964f1220f1d33182dae49976 (diff) | |
Merge branch 'sched/urgent' into sched/core
Merge the latest batch of fixes before applying development patches.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/math64.h')
| -rw-r--r-- | include/linux/math64.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/math64.h b/include/linux/math64.h index 69ed5f5e9f6e..c45c089bfdac 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -133,4 +133,34 @@ __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) return ret; } +#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) + +#ifndef mul_u64_u32_shr +static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift) +{ + return (u64)(((unsigned __int128)a * mul) >> shift); +} +#endif /* mul_u64_u32_shr */ + +#else + +#ifndef mul_u64_u32_shr +static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift) +{ + u32 ah, al; + u64 ret; + + al = a; + ah = a >> 32; + + ret = ((u64)al * mul) >> shift; + if (ah) + ret += ((u64)ah * mul) << (32 - shift); + + return ret; +} +#endif /* mul_u64_u32_shr */ + +#endif + #endif /* _LINUX_MATH64_H */ |
