From e16795199e1492f6c6f68a728610399ede57d7db Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 25 Mar 2026 21:15:30 +0200 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=86=D0=B8=D0=BA=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D1=80=D0=B5=D0=B7=D0=B5=D1=80=D0=B2=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B9=20=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/io/orprotocol/Stream.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/orprotocol/Stream.java b/src/main/java/io/orprotocol/Stream.java index c1c01c7..08fc0af 100644 --- a/src/main/java/io/orprotocol/Stream.java +++ b/src/main/java/io/orprotocol/Stream.java @@ -28,14 +28,16 @@ public class Stream { public void writeInt8(int value) { int negationBit = value < 0 ? 1 : 0; int int8Value = Math.abs(value) & 0xFF; - - ensureCapacity(writePointer >> 3); + /** + * 1 sign + * 8 bits for value + */ + reserveBits(9); stream[writePointer >> 3] |= (byte) (negationBit << (7 - (writePointer & 7))); writePointer++; for (int i = 0; i < 8; i++) { int bit = (int8Value >> (7 - i)) & 1; - ensureCapacity(writePointer >> 3); stream[writePointer >> 3] |= (byte) (bit << (7 - (writePointer & 7))); writePointer++; }