Linux 4.19.133
[linux/fpc-iii.git] / fs / btrfs / math.h
blob75246f2f56baf32473ab992982923f678f3f229d
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2012 Fujitsu. All rights reserved.
4 * Written by Miao Xie <miaox@cn.fujitsu.com>
5 */
7 #ifndef BTRFS_MATH_H
8 #define BTRFS_MATH_H
10 #include <asm/div64.h>
12 static inline u64 div_factor(u64 num, int factor)
14 if (factor == 10)
15 return num;
16 num *= factor;
17 return div_u64(num, 10);
20 static inline u64 div_factor_fine(u64 num, int factor)
22 if (factor == 100)
23 return num;
24 num *= factor;
25 return div_u64(num, 100);
28 #endif