Skip to content

Commit

Permalink
Aggregating ring buffer correction to reset cleared buffer to identit…
Browse files Browse the repository at this point in the history
…y value.
  • Loading branch information
lbooker42 committed Oct 21, 2024
1 parent c969c11 commit b3a02fb
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,12 @@ public byte[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,12 @@ public char[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,12 @@ public double[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,12 @@ public float[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,12 @@ public int[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,12 @@ public long[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,12 @@ public T[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,12 @@ public short[] remove(int count) {
* O(size).
*/
public void clear() {
final long prevHead = internalBuffer.head;
final int prevSize = size();

internalBuffer.clear();

calcHead = calcTail = 0;

// Reset the cleared storage entries to the identity value
fillWithIdentityVal(prevHead, prevSize);
Arrays.fill(internalBuffer.storage, identityVal);
// Reset the tree buffer with the identity value
Arrays.fill(treeStorage, identityVal);
}
Expand Down

0 comments on commit b3a02fb

Please sign in to comment.