summaryrefslogtreecommitdiff
path: root/src/lua-interface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua-interface.cpp')
-rw-r--r--src/lua-interface.cpp32
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