Lines Matching defs:m_y
40 // fmod = m_x * 2^e_x - tquot * m_y * 2^e_y
41 // = 2^e_y * (m_x * 2^(e_x - e^y) - tquot * m_y).
46 // and m_y*2^e_y. This is an ambiguous number representation. For example:
53 // a = m_x * 2^e_x, b = m_y * 2^e_y, N = 2^k
54 // r(k) = a % b = (m_x * 2^e_x) % (2^k * m_y * 2^e_y)
55 // = 2^(e_y + k) * (m_x * 2^(e_x - e_y - k) % m_y)
56 // r(k) = m_r * 2^e_r = (m_x % m_y) * 2^(m_y + k)
57 // = (2^p * (m_x % m_y) * 2^(e_y + k - p))
58 // m_r = 2^p * (m_x % m_y), e_r = m_y + k - p
61 // First, let write x = m_x * 2^e_x and y = m_y * 2^e_y with m_x, m_y, e_x, e_y
62 // are integers (m_x amd m_y positive).
67 // m_x %= m_y;
69 // On the other hand, the algorithm exploits the fact that m_x, m_y are the
77 // m_x %= m_y;
80 // 1) Shift m_y maximum to the right, which can significantly improve
90 // m_y = 0b00101100 e_y = 20 after shift m_y = 0b00001011 e_y = 22.
91 // 2) m_x = m_x % m_y.
92 // 3) Move m_x maximum to left. Note that after (m_x = m_x % m_y) CLZ in m_x
93 // is not lower than CLZ in m_y. m_x=0b00001001 e_x = 100, m_x=0b10010000,
98 // Converting x,y to (m_x,e_x),(m_y, e_y): CTZ/shift/AND/OR/if. Loop count:
99 // (m_x - m_y) / (64 - "length of m_y").
100 // max("length of m_y") = 53,
106 // special processing is implemented. No m_y alignment, no loop:
107 // result = (m_x * 2^(e_x - e_y)) % m_y.
109 // result = m_x % m_y.
122 T m_x, T m_y) {
126 m_x %= m_y;
129 m_x %= m_y;
136 T m_x, T m_y) {
139 T inv_hy = (cpp::numeric_limits<T>::max() / m_y);
144 m_x -= hd * m_y;
145 while (LIBC_UNLIKELY(m_x > m_y))
146 m_x -= m_y;
150 m_x -= hd * m_y;
151 while (LIBC_UNLIKELY(m_x > m_y))
152 m_x -= m_y;
155 m_x %= m_y;
214 StorageType m_y = sy.get_explicit_mantissa();
216 ? (m_x - m_y)
217 : static_cast<StorageType>(m_x << (e_x - e_y)) % m_y;
234 U m_y = static_cast<U>(sy.get_explicit_mantissa());
241 m_y = static_cast<U>(sy.get_mantissa());
242 lead_zeros_m_y = cpp::countl_zero(m_y);
246 int tail_zeros_m_y = cpp::countr_zero(m_y);
253 m_y >>= right_shift;
266 m_x %= m_y;
274 m_x = DivisionHelper::execute(exp_diff, sides_zeroes_count, m_x, m_y);