From 2902668e951a44db215867a2c2d9aa2d899d686b Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sat, 23 Feb 2008 05:31:11 +0000 Subject: Only use inline-asm with gcc. Add fallback for other compilers git-svn-id: svn://mattst88.com/svn/glpong/trunk@10 449aeecc-241a-0410-943f-e2f883e2d7a2 --- glpong.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'glpong.c') diff --git a/glpong.c b/glpong.c index b5ad25c..6642f3b 100644 --- a/glpong.c +++ b/glpong.c @@ -168,6 +168,8 @@ GLPong_HandleEvents() { static INLINE unsigned int NextPow2(unsigned int value) { +#if (defined __i386__ || defined __amd64__ || defined __x86_64__) \ + && (defined __GNUC__) unsigned int x; __asm( "dec %1 \n\t" /* so that if the number is a power of @@ -179,6 +181,12 @@ NextPow2(unsigned int value) { : "=r" (x) : "c" (value) ); +#else + unsigned int x = 0; + while (x < value) { + x *= 2; + } +#endif return x; } -- cgit v1.2.3