我有这样的功能:
uint8_t getULEB128Value(uint8_t *p, uint32_t *to){
unsigned int result;
uint8_t count = 1;
uint8_t cur;
result = *p;
if(result > 0x7F){
count++;
cur = *(++p);
result = (result & 0x7F) | (cur << 7);
if(cur > 0x7F){
count++;
cur = *(++p);
result |= ((cur & 0x7F) << 14);
if(cur > 0x7F){
count++;
cur = *(++p);
result |= ((cur & 0x7F) << 21);
if(cur > 0x7F){
count++;
cur = *(++p);
result |= ((cur & 0x7F) << 28);
}
}
}
}
*to = result;
return count;
}
现在我只想知道长度,我对值并不感兴趣......
是否有可能有一个无关指针?所以那里写的每一个价值都去涅槃?像 /dev/null?
我的意思是我当然可以在某处创建一个指针,然后释放它,但也许已经有这样的东西了?