源代码里有一段:
unsigned char map[32];
/* Clear control map */
for (count = 0; count < 32; count++)
map[count] = 0;
/* Set bits in delimiter table */
do {
map[*ctrl >> 3] |= (1 << (*ctrl & 7));
} while (*ctrl++);
这段代码用于计算哪些字符需要分割。map实际上是一个压缩过的哈希表bool flag[255],通过位运算实现的bitset。
浙公网安备 33010602011771号