1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Index: fixp_math.c
===================================================================
--- fixp_math.c	(revision 22307)
+++ fixp_math.c	(working copy)
@@ -1,8 +1,33 @@
 #include "fixp_math.h"
+#ifdef ROCKBOX
+#include "config.h"
+#endif
+#ifdef CPU_ARM
+inline int32_t fixmul16(int32_t x, int32_t y) {
+  int lo,hi;
+  asm volatile("smull\t%0, %1, %2, %3\n\t"
+               "movs\t%0, %0, lsr #16\n\t"
+               "movs\t%1, %1, lsl #16\n\t"
+               "orr\t%0, %0, %1"
+               : "=&r"(lo),"=&r"(hi)
+               : "%r"(x),"r"(y)
+	       : "cc");
+  return(lo);
+}

+inline int32_t fixmul31(int32_t x, int32_t y) {
+  int lo,hi;
+  asm volatile("smull\t%0, %1, %2, %3"
+               : "=&r"(lo),"=&r"(hi)
+               : "%r"(x),"r"(y)
+	       : "cc");
+  return(hi<<1);
+}
+#else
 inline int32_t fixmul31(int32_t x, int32_t y)
 {
     int64_t temp;
+
     temp = x;
     temp *= y;

@@ -11,6 +36,20 @@
     return (int32_t)temp;
 }

+inline int32_t fixmul16(int32_t x, int32_t y)
+{
+    int64_t temp;
+    temp = x;
+    temp *= y;
+
+    temp >>= 16;
+
+    return (int32_t)temp;
+}
+
+#endif
+
+
 /*
  * Fast integer square root adapted from algorithm, 
  * Martin Guy @ UKC, June 1985.
@@ -44,18 +83,6 @@
     }
     return(res << 8);
 }
-
-inline int32_t fixmul16(int32_t x, int32_t y)
-{
-    int64_t temp;
-    temp = x;
-    temp *= y;
-
-    temp >>= 16;
-
-    return (int32_t)temp;
-}
-
 inline int32_t fixdiv16(int32_t x, int32_t y)
 {
     int64_t temp;