Tag | compiler

  1. Count Trailing Zeros

    How to count the number of trailing zeros of an integer? The simplest way is to use the built-in function __builtin_ctz():

    uint64_t count(uint64_t n) {
      return __builtin_ctz(n);
    }
    

    What will happen if we don't have __builtin_ctz()? If we have another built-in function __popcount(), which can …

    More

  2. RISC-V Microprocessor

    RISC-V is an instruction set architecture (ISA) released by UC Berkeley. Besides, a high performance, power efficient, and royalty-free open source implementation Rocket Chip is available.

    RISC-V was developed by Krste Asanović and David A. Patterson. In their technical report, they claimed that an open instruction set can benefit both …

    More