summaryrefslogtreecommitdiff
path: root/datastructures/fenwickTree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'datastructures/fenwickTree.cpp')
-rw-r--r--datastructures/fenwickTree.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/datastructures/fenwickTree.cpp b/datastructures/fenwickTree.cpp
index 8c73b78..7013613 100644
--- a/datastructures/fenwickTree.cpp
+++ b/datastructures/fenwickTree.cpp
@@ -10,6 +10,6 @@ void init(int n) {
ll prefix_sum(int i) {
ll sum = 0;
- for (; i > 0; i -= i & -i) sum += tree[i];
+ for (; i > 0; i &= i-1) sum += tree[i];
return sum;
}