From ca2adbb95bac54848159bd1289faee7d66012b2b Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 6 Aug 2008 11:55:03 +0000 Subject: Last win32 fixups - everything should now be working as intended. --- src/lua-interface.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/lua-interface.cpp') diff --git a/src/lua-interface.cpp b/src/lua-interface.cpp index 3958ddb..0649119 100644 --- a/src/lua-interface.cpp +++ b/src/lua-interface.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: lua-interface.cpp,v 1.9 2008-08-05 15:03:54 pixel Exp $ */ +/* $Id: lua-interface.cpp,v 1.10 2008-08-06 11:55:03 pixel Exp $ */ #define WIP @@ -66,6 +66,7 @@ extern void luaosmesa_init(Lua * L) __attribute__ ((weak)); } #ifdef _WIN32 +#define main win32_dll_main #include #include @@ -856,3 +857,32 @@ virtual int startup() throw (GeneralException) { return 0; } CODE_ENDS + +#ifdef _WIN32 +extern "C" { + +int ffs(int i) { + register int bit = 0; + if (i != 0) { + if ((i & 0xffff) == 0) { + bit += 16; + i >>= 16; + } + if ((i & 0xff) == 0) { + bit += 8; + i >>= 8; + } + if ((i & 0xf) == 0) { + bit += 4; + i >>= 4; + } + while ((i & 1) == 0) { + bit++; + i >>= 1; + } + } + return bit; +} + +} +#endif -- cgit v1.2.3