aboutsummaryrefslogtreecommitdiff
path: root/src/hex_functions.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2019-01-02 09:40:38 -0600
committerGitHub <noreply@github.com>2019-01-02 09:40:38 -0600
commit4d93f059c01664ad074cf467e79a63b85e86beb0 (patch)
tree57b8a9760796937e66e393b3bc00f4bee4337bdf /src/hex_functions.cpp
parent6f1bce5882676ea7affe717a2f5a00b8c3b7fe12 (diff)
parentec1057b5d7e1d39963275bc2cbd79a53cf6f3f5c (diff)
Merge pull request #54 from OmniTroid/master
Restructuring + better cross-platform support
Diffstat (limited to 'src/hex_functions.cpp')
-rw-r--r--src/hex_functions.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp
new file mode 100644
index 00000000..4a58d2b4
--- /dev/null
+++ b/src/hex_functions.cpp
@@ -0,0 +1,18 @@
+#include "hex_functions.h"
+
+namespace omni
+{
+ std::string int_to_hex(unsigned int input)
+ {
+ if (input > 255)
+ return "FF";
+
+ std::stringstream stream;
+ stream << std::setfill('0') << std::setw(sizeof(char)*2)
+ << std::hex << input;
+ std::string result(stream.str());
+ std::transform(result.begin(), result.end(), result.begin(), ::toupper);
+
+ return result;
+ }
+}