summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-02 17:33:18 +0100
committermadmaxoft <github@xoft.cz>2014-01-02 17:33:18 +0100
commitc510683d2a64e75a667134ef0b63e9638c474c28 (patch)
treeefbd4b1ee8205bf02bfe705b18647626745438a9 /src/StringUtils.cpp
parentMerge pull request #484 from worktycho/cmake-fixes (diff)
downloadcuberite-c510683d2a64e75a667134ef0b63e9638c474c28.tar
cuberite-c510683d2a64e75a667134ef0b63e9638c474c28.tar.gz
cuberite-c510683d2a64e75a667134ef0b63e9638c474c28.tar.bz2
cuberite-c510683d2a64e75a667134ef0b63e9638c474c28.tar.lz
cuberite-c510683d2a64e75a667134ef0b63e9638c474c28.tar.xz
cuberite-c510683d2a64e75a667134ef0b63e9638c474c28.tar.zst
cuberite-c510683d2a64e75a667134ef0b63e9638c474c28.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;
+}
+
+
+
+