Explorar o código

Add macros for integer tostring output, also make the macro for SQHash independent

mingodad %!s(int64=7) %!d(string=hai) anos
pai
achega
359b935635
Modificáronse 2 ficheiros con 8 adicións e 2 borrados
  1. 7 2
      SquiLu/include/sqconfig.h
  2. 1 0
      SquiLu/include/squirrel.h

+ 7 - 2
SquiLu/include/sqconfig.h

@@ -4,6 +4,7 @@
 #define ABSTRACT_METHOD(m, i) m i
 #endif
 
+typedef uintptr_t SQHash; /*should be the same size of a pointer*/
 typedef float SQFloat32;
 typedef double SQFloat64;
 typedef long long SQInt64;
@@ -34,14 +35,12 @@ typedef unsigned __int64 SQHash; /*should be the same size of a pointer*/
 #define SQ_INT_MIN LLONG_MIN
 typedef long long SQInteger;
 typedef unsigned long long SQUnsignedInteger;
-typedef unsigned long long SQHash; /*should be the same size of a pointer*/
 #endif
 #else
 #define SQ_INT_MAX INT_MAX
 #define SQ_INT_MIN INT_MIN
 typedef int SQInteger;
 typedef unsigned int SQUnsignedInteger;
-typedef unsigned int /*ptrdiff_t*/ SQHash; /*should be the same size of a pointer*/
 #endif
 
 
@@ -226,6 +225,12 @@ typedef unsigned char SQUChar;
 #define _PRINT_INT_FMT _SC("%d")
 #endif
 
+#if defined(SQUSEDOUBLE)
+#define _PRINT_FLOAT_PREC _SC("%.14g")
+#else
+#define _PRINT_FLOAT_PREC _SC("%.7g")
+#endif
+
 #if !defined(SQUILU_MAX_PATH)
 #define SQUILU_MAX_PATH	1024
 #endif

+ 1 - 0
SquiLu/include/squirrel.h

@@ -28,6 +28,7 @@ extern "C" {
 #endif
 
 #include <stdarg.h>
+#include <stdint.h>
 
 #ifndef SQUIRREL_API
 #define SQUIRREL_API extern //__attribute__ ((visibility ("default")))