Revision 7a51ad82 host-utils.c

b/host-utils.c
28 28
//#define DEBUG_MULDIV
29 29

  
30 30
/* Long integer helpers */
31
#if !defined(__x86_64__)
31 32
static void add128 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
32 33
{
33 34
    *plow += a;
......
69 70
    *phigh += v;
70 71
}
71 72

  
72

  
73 73
/* Unsigned 64x64 -> 128 multiplication */
74 74
void mulu64 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
75 75
{
76
#if defined(__x86_64__)
77
    __asm__ ("mul %0\n\t"
78
             : "=d" (*phigh), "=a" (*plow)
79
             : "a" (a), "0" (b));
80
#else
81 76
    mul64(plow, phigh, a, b);
82
#endif
83 77
#if defined(DEBUG_MULDIV)
84 78
    printf("mulu64: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n",
85 79
           a, b, *phigh, *plow);
......
89 83
/* Signed 64x64 -> 128 multiplication */
90 84
void muls64 (uint64_t *plow, uint64_t *phigh, int64_t a, int64_t b)
91 85
{
92
#if defined(__x86_64__)
93
    __asm__ ("imul %0\n\t"
94
             : "=d" (*phigh), "=a" (*plow)
95
             : "a" (a), "0" (b));
96
#else
97 86
    int sa, sb;
98 87

  
99 88
    sa = (a < 0);
......
106 95
    if (sa ^ sb) {
107 96
        neg128(plow, phigh);
108 97
    }
109
#endif
110 98
#if defined(DEBUG_MULDIV)
111 99
    printf("muls64: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n",
112 100
           a, b, *phigh, *plow);
113 101
#endif
114 102
}
103
#endif /* !defined(__x86_64__) */

Also available in: Unified diff