We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b27f5e2 commit 8bdd010Copy full SHA for 8bdd010
library/data_structures/uncommon/linear_rmq.hpp
@@ -24,8 +24,7 @@ template<class T, class F> struct linear_rmq {
24
while (st.back() != -1 &&
25
(i == sz(a) || !cmp(a[st.back()], a[i]))) {
26
if (prev != -1) head[prev] = st.back();
27
- int pw2 =
28
- bit_floor(unsigned((end(st)[-2] + 1) ^ i));
+ int pw2 = 1 << __lg((end(st)[-2] + 1) ^ i);
29
t[st.back()][0] = prev = i & -pw2;
30
st.pop_back();
31
t[st.back() + 1][1] |= pw2;
0 commit comments