summaryrefslogtreecommitdiff
path: root/glpong.c
diff options
context:
space:
mode:
Diffstat (limited to 'glpong.c')
-rw-r--r--glpong.c8
1 files changed, 8 insertions, 0 deletions
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;
}