counting the number of 1-bits
Chapter 5. Counting Bits - Hacker’s Delight, Second Edition [Book] (oreilly.com)
The IBM Stretch computer (about 1960) had a means of counting the number of 1-bits in a word... sometimes called population count
去掉查表法和用VPOPCNTDQ指令,还有n种方法:
Population Count - Chessprogramming wiki
单周期指令... _mm_popcnt_u32(num)... __builtin_popcountll()... 在 ARM 中,也有类似的指令... 经典的面试题目,在实际中也有应用,详情请看:
Population Count算法 · 大专栏 (dazhuanlan.com)
-msse3和__builtin_popcount编译通过了。ll是long long的缩写,SSE 4比SSE 3支持更长的寄存器。
bss segmentUsually refers to a memory area used to store uninitialized (or initialized to 0) global variables in the program.
The size of the BSS segment required for operation is recorded in the target file, but the BSS segment does not occupy any space in the target file.
The term BSS (Block Started by Symbol) was originally a pseudo-instruction in the UA-SAP assembler (United Aircraft Symbolic Assembly Program) to reserve a memory space for symbols. The assembler was developed by United Airlines for the IBM 704 mainframe in the mid-1950s.