View difference between Paste ID: wbM5TtaF and 2ecbyf8P
SHOW: | | - or go back to the newest paste.
1
constexpr long positiveElseZero(long value){
2
    return value > 0 ? value : 0;
3
}
4
5
template<long count> __attribute__((always_inline)) inline void nop(){
6
        nop<positiveElseZero(count - 1)>();
7
        __asm__ __volatile__("nop\n\t");
8
}
9
10
template<> __attribute__((always_inline)) inline void nop<0>(){
11
    //nothing so the template recursion ends
12
}
13
14
void main() {
15
    nop<2000>();
16
}