27 #include <type_traits> 40 return (num / denom) +
41 ((num % denom) != 0 ? 1 : 0) *
52 ? (num + (num > 0 ? -1 : 1)) / denom - 1
62 return (num / denom) +
63 ((num % denom) != 0 ? 1 : 0) *
76 : (num + (num > 0 ? -1 : 1)) / denom + 1;
85 return (num / denom) +
86 ((num % denom) != 0 ? 1 : 0) *
97 : (num + (num > 0 ? -1 : 1)) / denom +
101 template <
typename N,
typename D>
108 #if defined(__arm__) && !FOLLY_AARCH64 111 constexpr
auto kIntegerDivisionGivesRemainder =
true;
131 template <
typename N,
typename D>
133 using R = decltype(num / denom);
136 ? detail::divFloorBranchless<R>(num, denom)
137 : detail::divFloorBranchful<R>(num, denom));
151 template <
typename N,
typename D>
153 using R = decltype(num / denom);
156 ? detail::divCeilBranchless<R>(num, denom)
157 : detail::divCeilBranchful<R>(num, denom));
177 template <
typename N,
typename D>
194 template <
typename N,
typename D>
196 using R = decltype(num / denom);
199 ? detail::divRoundAwayBranchless<R>(num, denom)
200 : detail::divRoundAwayBranchful<R>(num, denom));
typename std::enable_if< std::is_integral< N >::value &&std::is_integral< D >::value &&!std::is_same< N, bool >::value &&!std::is_same< D, bool >::value, decltype(N{1}/D{1})>::type IdivResultType
constexpr T divRoundAwayBranchless(T num, T denom)
constexpr T divFloorBranchful(T num, T denom)
constexpr T divCeilBranchful(T num, T denom)
constexpr detail::IdivResultType< N, D > divTrunc(N num, D denom)
—— Concurrent Priority Queue Implementation ——
constexpr detail::IdivResultType< N, D > divRoundAway(N num, D denom)
constexpr detail::IdivResultType< N, D > divFloor(N num, D denom)
constexpr detail::IdivResultType< N, D > divCeil(N num, D denom)
constexpr auto kIntegerDivisionGivesRemainder
static const char *const value
constexpr T divRoundAwayBranchful(T num, T denom)
constexpr T divCeilBranchless(T num, T denom)
constexpr T divFloorBranchless(T num, T denom)