]> git.lizzy.rs Git - minetest.git/blobdiff - src/hex.h
Do not allow the m_transforming_liquid queue to increase until all RAM is consumed
[minetest.git] / src / hex.h
index e54ef96344bde4f745683eadc3820317cc8ef365..6f00a79bff0a451115f4e1230fc1aa430d71203c 100644 (file)
--- a/src/hex.h
+++ b/src/hex.h
@@ -1,6 +1,6 @@
 /*
-Minetest-c55
-Copyright (C) 2012 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
+Minetest
+Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -46,4 +46,17 @@ static inline std::string hex_encode(const std::string &data)
     return hex_encode(data.c_str(), data.size());
 }
 
+static inline bool hex_digit_decode(char hexdigit, unsigned char &value)
+{
+       if(hexdigit >= '0' && hexdigit <= '9')
+               value = hexdigit - '0';
+       else if(hexdigit >= 'A' && hexdigit <= 'F')
+               value = hexdigit - 'A' + 10;
+       else if(hexdigit >= 'a' && hexdigit <= 'f')
+               value = hexdigit - 'a' + 10;
+       else
+               return false;
+       return true;
+}
+
 #endif