1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| uint_32 am_RandomU32 (void) {
if (!isInitialized) { am_RandomInitialize(0); }
__asm__ (
"movl %[rv], %%eax\n\t" // eax = r_value
"mull %[mu]\n\t" // edx:eax = r_value * multiplier
"divl %[mo]\n\t" // eax/edx contiennent (r_value * multiplier)/modulus
// eax = quotient, edx = reste (que l'on cherche)
"movl %%edx, %[rv]\n\t" // on met r_value à jour
"movl %%edx, %%eax\n\t" // et retourne r_value
: [rv] "=m" (r_value)
: [mo] "m" (modulus) , [mu] "m" (multiplier)
: "%eax", "%ebx", "%edx"
);
} |
Partager