File: spin_delay.c

package info (click to toggle)
chibicc 1.0.23.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,832 kB
  • sloc: ansic: 62,911; sh: 275; makefile: 92
file content (14 lines) | stat: -rw-r--r-- 282 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "test.h"

static inline void pg_spin_delay_impl(void) {
    __asm__ __volatile__("rep; nop");
}

int main() {
    printf("Before spin delay.\n");
    for (int i = 0; i < 1000000; i++) {
        pg_spin_delay_impl();
    }
    printf("After spin delay.\n");
    return 0;
}