Skip to content
Snippets Groups Projects
Commit 8fc97157 authored by akwizgran's avatar akwizgran
Browse files

Fun fact: it's never worth writing a length as an int8.

parent 7a4171f3
No related branches found
No related tags found
No related merge requests found
...@@ -125,12 +125,10 @@ class WriterImpl implements Writer { ...@@ -125,12 +125,10 @@ class WriterImpl implements Writer {
} }
private void writeLength(int i) throws IOException { private void writeLength(int i) throws IOException {
if(i >= 0 && i <= Byte.MAX_VALUE) assert i >= 0;
writeUint7((byte) i); // Fun fact: it's never worth writing a length as an int8
else if(i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) if(i <= Byte.MAX_VALUE) writeUint7((byte) i);
writeInt8((byte) i); else if(i <= Short.MAX_VALUE) writeInt16((short) i);
else if(i >= Short.MIN_VALUE && i <= Short.MAX_VALUE)
writeInt16((short) i);
else writeInt32(i); else writeInt32(i);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment