76
77
public removeValues(startIndex: number, count: number): boolean {
79
>
count = toUint32(count);
80
>
81
>
const oldValues = this.values;
82
>
const oldPrefixSum = this.prefixSum;
83
>
84
>
if (startIndex >= oldValues.length) {
85
return false;
86
}
88
>
const maxCount = oldValues.length - startIndex;
89
>
if (count >= maxCount) {
90
count = maxCount;
91
}
93
>
if (count === 0) {
94
return false;
95
}
97
>
this.values = new Uint32Array(oldValues.length - count);
98
>
this.values.set(oldValues.subarray(0, startIndex), 0);
99
>
this.values.set(oldValues.subarray(startIndex + count), startIndex);
100
>
101
>
this.prefixSum = new Uint32Array(this.values.length);
102
>
if (startIndex - 1 < this.prefixSumValidIndex[0]) {
103
this.prefixSumValidIndex[0] = startIndex - 1;
104
}
106
this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));
107
}
109
>
}
110
111
public getTotalSum(): number {