diff options
| author | Olof Johansson <olof@lixom.net> | 2013-12-28 21:37:03 -0800 |
|---|---|---|
| committer | Olof Johansson <olof@lixom.net> | 2013-12-28 21:38:16 -0800 |
| commit | fe5a365cdb9cc925d5ce86a5bb4509dca57f3894 (patch) | |
| tree | 8dd536be0e16e86109295142edd1ef1fd18c2e98 /include/linux/math64.h | |
| parent | 4d77ce6c1fcae189dcd6fb0c7342f1c901b50a70 (diff) | |
| parent | 413541dd66d51f791a0b169d9b9014e4f56be13c (diff) | |
Merge tag 'v3.13-rc5' into next/boards
Need a newer base version to get a regulator fix for Samsung platforms that
they enable building in a defconfig.
Linux 3.13-rc5
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 */ |
