summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2014-01-02 18:49:55 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2014-01-02 18:49:55 +0100
commitea6f94f6cb703f29511a844fc9e14567986e73ee (patch)
tree6b9df61798a94c8e9977deb44de148b76a55d331 /src/StringUtils.cpp
parentadded documentation (diff)
parentMerge remote-tracking branch 'origin/master' (diff)
downloadcuberite-ea6f94f6cb703f29511a844fc9e14567986e73ee.tar
cuberite-ea6f94f6cb703f29511a844fc9e14567986e73ee.tar.gz
cuberite-ea6f94f6cb703f29511a844fc9e14567986e73ee.tar.bz2
cuberite-ea6f94f6cb703f29511a844fc9e14567986e73ee.tar.lz
cuberite-ea6f94f6cb703f29511a844fc9e14567986e73ee.tar.xz
cuberite-ea6f94f6cb703f29511a844fc9e14567986e73ee.tar.zst
cuberite-ea6f94f6cb703f29511a844fc9e14567986e73ee.zip
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index f7aeeed26..5c6b99d88 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -764,3 +764,33 @@ AString Base64Decode(const AString & a_Base64String)
+
+short GetBEShort(const char * a_Mem)
+{
+ return (((short)a_Mem[0]) << 8) | a_Mem[1];
+}
+
+
+
+
+
+int GetBEInt(const char * a_Mem)
+{
+ return (((int)a_Mem[0]) << 24) | (((int)a_Mem[1]) << 16) | (((int)a_Mem[2]) << 8) | a_Mem[3];
+}
+
+
+
+
+
+void SetBEInt(char * a_Mem, Int32 a_Value)
+{
+ a_Mem[0] = a_Value >> 24;
+ a_Mem[1] = (a_Value >> 16) & 0xff;
+ a_Mem[2] = (a_Value >> 8) & 0xff;
+ a_Mem[3] = a_Value & 0xff;
+}
+
+
+
+