asm: Avoid ALU instructions on busy wait cycles

This commit is contained in:
kd-11 2022-09-08 18:03:26 +03:00 committed by kd-11
parent 940e726754
commit 0d9b1654ec

View File

@ -358,9 +358,9 @@ namespace utils
// Synchronization helper (cache-friendly busy waiting)
inline void busy_wait(usz cycles = 3000)
{
const u64 start = get_tsc();
const u64 stop = get_tsc() + cycles;
do pause();
while (get_tsc() - start < cycles);
while (get_tsc() < stop);
}
// Align to power of 2