summaryrefslogtreecommitdiff
path: root/src/utils/TorchUtils.h
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2023-11-21 00:27:23 -0600
committerLywx <kiritodev01@gmail.com>2024-01-31 12:05:40 -0600
commit57f61f8e659196586c0bf33bb00765ece006ef9d (patch)
treea01342fa2f050b624d0848e878755bc3b9e6e15f /src/utils/TorchUtils.h
parent06134be57a88ba1f5297dcedf29094b78aa5d5fc (diff)
Added WIP Geo Layout Exporter and some code cleanups
Diffstat (limited to 'src/utils/TorchUtils.h')
-rw-r--r--src/utils/TorchUtils.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/utils/TorchUtils.h b/src/utils/TorchUtils.h
new file mode 100644
index 0000000..330c7fa
--- /dev/null
+++ b/src/utils/TorchUtils.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <string>
+#include <fstream>
+#include <sstream>
+
+namespace Torch {
+template< typename T >
+std::string to_hex(T number, const bool append0x = true) {
+ std::stringstream stream;
+ if(append0x) {
+ stream << "0x";
+ }
+ stream << std::setfill ('0') << std::setw(sizeof(T)*2)
+ << std::hex << number;
+
+ auto format = stream.str();
+ std::transform(format.begin(), format.end(), format.begin(), ::toupper);
+ return format;
+}
+
+uint32_t translate(uint32_t offset);
+}; \ No newline at end of file