Chameleon

Chameleon Commit Details

Date:2015-05-22 22:20:24 (5 years 6 months ago)
Author:ErmaC
Commit:2691
Parents: 2690
Message:Timing Functions (Credits to Zenith432)
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/cpu.h

File differences

branches/ErmaC/Enoch/i386/libsaio/cpu.h
283283
284284
285285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
286309
return result;
}
/*
* Timing Functions
*/
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
static inline void CpuPause(void)
{
__asm__ volatile ("rep; nop");
}
static inline uint32_t DivU64x32(uint64_t dividend, uint32_t divisor)
{
__asm__ volatile ("divl %1" : "+A"(dividend) : "r"(divisor));
return (uint32_t) dividend;
}
static inline uint64_t MultU32x32(uint32_t multiplicand, uint32_t multiplier)
{
uint64_t result;
__asm__ volatile ("mull %2" : "=A"(result) : "a"(multiplicand), "r"(multiplier));
return result;
}
#endif /* !__LIBSAIO_CPU_H */

Archive Download the corresponding diff file

Revision: 2691