summaryrefslogtreecommitdiffstats
path: root/src/ByteBuffer.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu22@users.noreply.github.com>2016-05-14 21:12:42 +0200
committerAlexander Harkness <me@bearbin.net>2016-05-14 21:12:42 +0200
commita4f327118b06ced1cd4510b7d20d34da83aa78a3 (patch)
treed6dbd41cfbec99f2598fb51907b86d9cbe0e8a05 /src/ByteBuffer.cpp
parentFixed death on teleportation or leaving Minecart (#3181) (diff)
downloadcuberite-a4f327118b06ced1cd4510b7d20d34da83aa78a3.tar
cuberite-a4f327118b06ced1cd4510b7d20d34da83aa78a3.tar.gz
cuberite-a4f327118b06ced1cd4510b7d20d34da83aa78a3.tar.bz2
cuberite-a4f327118b06ced1cd4510b7d20d34da83aa78a3.tar.lz
cuberite-a4f327118b06ced1cd4510b7d20d34da83aa78a3.tar.xz
cuberite-a4f327118b06ced1cd4510b7d20d34da83aa78a3.tar.zst
cuberite-a4f327118b06ced1cd4510b7d20d34da83aa78a3.zip
Diffstat (limited to '')
-rw-r--r--src/ByteBuffer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index 526b8b754..16620becd 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -1034,3 +1034,21 @@ void cByteBuffer::CheckValid(void) const
+size_t cByteBuffer::GetVarIntSize(UInt32 a_Value)
+{
+ size_t Count = 0;
+
+ do
+ {
+ // If the value cannot be expressed in 7 bits, it needs to take up another byte
+ Count++;
+ a_Value >>= 7;
+ } while (a_Value != 0);
+
+ return Count;
+}
+
+
+
+
+