Skip to content

Instantly share code, notes, and snippets.

@travisdowns
Created May 3, 2019 03:31
Show Gist options
  • Save travisdowns/eb1287406ddd6fb30073c339838537fc to your computer and use it in GitHub Desktop.
Save travisdowns/eb1287406ddd6fb30073c339838537fc to your computer and use it in GitHub Desktop.

Revisions

  1. travisdowns created this gist May 3, 2019.
    8 changes: 8 additions & 0 deletions nop-helper.h
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    // if NOPCOUNT is not defined, use 0 which makes NOPS a no-op
    #ifndef NOPCOUNT
    #define NOPCOUNT 0
    #endif

    #define NOPS_HELPER2(N) asm(".rept " #N ";nop;.endr");
    #define NOPS_HELPER1(N) NOPS_HELPER2(N)
    #define NOPS NOPS_HELPER1(NOPCOUNT)