diff options
author | Matt Turner <mattst88@gmail.com> | 2008-02-23 05:31:11 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2008-02-23 05:31:11 +0000 |
commit | 2902668e951a44db215867a2c2d9aa2d899d686b (patch) | |
tree | 0576c35973e8ee393e0c9f7587e7be5cef58602a /glpong.c | |
parent | 01fad53a58f67c948fcf2b5617e9b557f264671c (diff) |
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
Diffstat (limited to 'glpong.c')
-rw-r--r-- | glpong.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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; } |