summaryrefslogtreecommitdiffstats
path: root/src/ByteBuffer.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2022-11-08 23:14:45 +0100
committerGitHub <noreply@github.com>2022-11-08 23:14:45 +0100
commit7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34 (patch)
tree49fd84a2dee2a1feeeb88565350fb3a55627dda5 /src/ByteBuffer.h
parentChunk: Optimise idle ticking (diff)
downloadcuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.gz
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.bz2
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.lz
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.xz
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.tar.zst
cuberite-7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34.zip
Diffstat (limited to 'src/ByteBuffer.h')
-rw-r--r--src/ByteBuffer.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index 1d108fca2..664887132 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -31,6 +31,7 @@ their own synchronization.
class cByteBuffer
{
public:
+
cByteBuffer(size_t a_BufferSize);
~cByteBuffer();
@@ -47,7 +48,13 @@ public:
size_t GetReadableSpace(void) const;
/** Returns the current data start index. For debugging purposes. */
- size_t GetDataStart(void) const { return m_DataStart; }
+ size_t GetDataStart(void) const { return m_DataStart; }
+
+ /** Returns if the given value can fit in a protocol big-endian 8 bit integer. */
+ static bool CanBEInt8Represent(int a_Value);
+
+ /** Returns if the given value can fit in a protocol big-endian 16 bit integer. */
+ static bool CanBEInt16Represent(int a_Value);
/** Returns true if the specified amount of bytes are available for reading */
bool CanReadBytes(size_t a_Count) const;