Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / compiler / translator / Common.h
index f1a67fe..1e4503e 100644 (file)
 #include <sstream>
 #include <string>
 #include <vector>
+#include <limits>
+#include <stdio.h>
 
 #include "compiler/translator/PoolAlloc.h"
+#include "compiler/translator/compilerdebug.h"
+#include "common/angleutils.h"
 
 struct TSourceLoc {
     int first_file;
@@ -74,4 +78,15 @@ public:
     TMap(const tAllocator& a) : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a) {}
 };
 
+// Integer to TString conversion
+template <typename T>
+inline TString str(T i)
+{
+    ASSERT(std::numeric_limits<T>::is_integer);
+    char buffer[((8 * sizeof(T)) / 3) + 3];
+    const char *formatStr = std::numeric_limits<T>::is_signed ? "%d" : "%u";
+    snprintf(buffer, sizeof(buffer), formatStr, i);
+    return buffer;
+}
+
 #endif // _COMMON_INCLUDED_