#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#define ROW_UNIT 512
#define UNIT_LENGTH 500
int charindex[8] = {
0x80, 0x40, 0x20, 0x10,
0x08, 0x04, 0x02, 0x01
};
static inline int strtobit(void *bit, char *str)
{
int pos = 0;
char *bits = bit;
memset(bits, 0, ROW_UNIT >> 3);
while(('0' == *str) || ('1' == *str)) {
if('1' == *str) {
bits[pos>>3] |= charindex[pos&0x7];
}
++str;
++pos;
}
return 0;
}
字符串转位序
最新推荐文章于 2022-12-18 21:55:04 发布