| 35 | |
| 36 | template<class IntType> |
| 37 | forceinline IntType |
| 38 | ceil_div_pp(IntType x, IntType y) { |
| 39 | assert((x >= 0) && (y >= 0)); |
| 40 | /* |
| 41 | * This is smarter than it looks: for many cpus, % and / are |
| 42 | * implemented by the same instruction and an optimizing compiler |
| 43 | * will generate the instruction only once. |
| 44 | */ |
| 45 | return ((x % y) == 0) ? x/y : (x/y + 1); |
| 46 | } |
| 47 | template<class IntType> |
| 48 | forceinline IntType |
| 49 | floor_div_pp(IntType x, IntType y) { |
no outgoing calls
no test coverage detected