[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] strto[u]ll: Do you allow me to apply this patch?

From: Christian Jullien
Subject: [Tinycc-devel] strto[u]ll: Do you allow me to apply this patch?
Date: Sun, 6 Nov 2022 09:43:29 +0100

As _strto[u]ll exists in msvcrt.dll and works well for either –m32|-m64 tcc.h can just test for _WIN32.

I also define those macros in the win32§include/stdlib.h



jullien@sims4:~/tinycc $ git diff

diff --git a/tcc.h b/tcc.h

index aa04404..1756831 100644

--- a/tcc.h

+++ b/tcc.h

@@ -65,7 +65,7 @@ extern long double strtold (const char *__nptr, char **__endptr);

# ifndef __GNUC__

#  define strtold (long double)strtod

#  define strtof (float)strtod

-#  ifdef _WIN64

+#  ifdef _WIN32

#   define strtoll _strtoi64

#   define strtoull _strtoui64

#  else

diff --git a/win32/include/stdlib.h b/win32/include/stdlib.h

index 033c0fd..671772c 100644

--- a/win32/include/stdlib.h

+++ b/win32/include/stdlib.h

@@ -544,8 +544,18 @@ extern "C" {


   __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); }


+  /* stro[u]ll do not properly map in Windows; use macros as with VC++ does */

+#if !defined(strtoll)

+#define strtoll _strtoi64


+#if !defined(strtoull)

+#define strtoull _strtoui64




   long long  __cdecl strtoll(const char* __restrict__, char** __restrict, int);

   unsigned long long  __cdecl strtoull(const char* __restrict__, char** __restrict__, int);



   /* these are stubs for MS _i64 versions */

   long long  __cdecl atoll (const char *);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]