diff options
author | pixel <pixel> | 2008-08-06 11:55:03 +0000 |
---|---|---|
committer | pixel <pixel> | 2008-08-06 11:55:03 +0000 |
commit | ca2adbb95bac54848159bd1289faee7d66012b2b (patch) | |
tree | 3de95e099b997ef522a095df822cb0331eb368ee /src/lua-interface.cpp | |
parent | 805d302b116d4698ac7602a8c65c02cf9cc772ae (diff) |
Last win32 fixups - everything should now be working as intended.
Diffstat (limited to 'src/lua-interface.cpp')
-rw-r--r-- | src/lua-interface.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
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 <windows.h> #include <ctype.h> @@ -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 |