]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/unsafe.qh
Reimplement ftos_mindecimals in a simpler and more correct way
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / unsafe.qh
index b218b660a534f1468bc84f8e7a51c9f89aea7ed0..97e1c7958493f1c5ba6caa3403c7b9ea9e84020d 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef UNSAFE_H
-#define UNSAFE_H
+#pragma once
 
 #define reinterpret_cast(T, it) _unsafe_cast_##T(0, it)
 #define X(T) T _unsafe_cast_##T(int dummy, ...) { return ...(0, T); }
@@ -8,11 +7,12 @@ X(int)
 X(float)
 X(entity)
 X(string)
-typedef float(...) rawfunc;
+USING(rawfunc, float(...));
 X(rawfunc)
 #undef X
 
-#define strid(s) ITOF(reinterpret_cast(int, s))
+#define _strid(s) ITOF(reinterpret_cast(int, s))
+#define strid(s) stof(sprintf("%i", s))
 
 .int _unsafe_fld1, _unsafe_fld2;
 int INTEGER_ONE;
@@ -24,5 +24,3 @@ STATIC_INIT(INTEGER_ONE)
 {
     INTEGER_ONE = reinterpret_cast(int, _unsafe_fld2) - reinterpret_cast(int, _unsafe_fld1);
 }
-
-#endif