MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / rounding_shift_right_upward

Function rounding_shift_right_upward

src/opr/test/basic_arith/elemwise.cpp:119–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117
118template <typename T>
119T rounding_shift_right_upward(T x, int k) {
120 T mask = (T(1) << k) - 1;
121 T threshold = mask >> 1;
122 return (x >> k) + ((x & mask) > threshold);
123}
124
125template <typename T>
126T do_round_mulh_saturate(T a, T b) {

Callers

nothing calls this directly

Calls 1

TClass · 0.85

Tested by

no test coverage detected