summaryrefslogtreecommitdiff
path: root/glpong3d.c
diff options
context:
space:
mode:
Diffstat (limited to 'glpong3d.c')
-rw-r--r--glpong3d.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/glpong3d.c b/glpong3d.c
index a02a17f..c4739a8 100644
--- a/glpong3d.c
+++ b/glpong3d.c
@@ -451,18 +451,23 @@ void GLPong_CleanUp() {
}
-__inline__ unsigned int NextPow2(unsigned int value) {
+static __inline__ unsigned int
+NextPow2(unsigned int value) {
+#if (defined __i386__ || defined __amd64__ || defined __x86_64__) \
+ && (defined __GNUC__)
unsigned int x;
-#ifdef __i386__
- __asm("dec %1\n\t"
- "movl $2,%0\n\t"
- "bsr %1,%1\n\t"
- "shl %b1,%0\n\t"
+ __asm(
+ "dec %1 \n\t" /* so that if the number is a power of
+ * two we don't change it
+ */
+ "movl $2,%0 \n\t"
+ "bsr %1,%1 \n\t"
+ "shl %b1,%0 \n\t"
: "=r" (x)
: "c" (value)
);
#else
- x = 1;
+ unsigned int x = 0;
while (x < value) {
x *= 2;
}