Skip to content

Commit

Permalink
improve performence
Browse files Browse the repository at this point in the history
  • Loading branch information
poorbarcode committed Dec 1, 2023
1 parent 8a4c558 commit e197574
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.scurrilous.circe.checksum;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.CompositeByteBuf;
import io.netty.util.concurrent.FastThreadLocal;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -106,6 +107,12 @@ public int resume(int current, ByteBuf buffer, int offset, int len) {
} else if (buffer.hasArray()) {
int arrayOffset = buffer.arrayOffset() + offset;
negCrc = resume(negCrc, buffer.array(), arrayOffset, len);
} else if (buffer instanceof CompositeByteBuf) {
CompositeByteBuf compositeByteBuf = (CompositeByteBuf) buffer;
for (int i = 0; i < compositeByteBuf.numComponents(); i ++) {
negCrc = resume(~negCrc, compositeByteBuf.component(i));
}
return ~negCrc;
} else {
byte[] b = TL_BUFFER.get();
int toRead = len;
Expand Down

0 comments on commit e197574

Please sign in to comment.