News for hackers. Stuff that matters.
Re:8-bit number to binary string by seiji on Thursday November 05, 2015 @08:44AM (#10513219)
Here's a fancier, slightly less-magic, version. How to compile is left as an exercise for the reader (hint: Haswell or newer, requires BMI2 instruction set):

    void toBinary(uint8_t byte) {
        uint64_t zeroes = *(uint64_t *)"00000000";
        uint64_t resultStr =
            zeroes | __builtin_bswap64(_pdep_u64(byte, 0x0101010101010101ULL));
    
        printf("hello: %.*s\n", 8, (char *)&resultStr);
    }
Re:8-bit number to binary string by acz on Thursday November 05, 2015 @10:07AM (#10513683)
This really reminds me of the old demoscene diskmag Hugi article about adding 16 bit colors (without MMX).

http://www.hugi.scene.org/online/hugi18/cobrad.htm