に
バイト配列を渡すCFBitVectorように見える があり、これには this からの値が含まれます。この呼び出しの後、次のようになります。'100000000000000'CFBitVectorGetBitsCFBitVectorbytes[2]
bytes[0] == '0x80'
bytes[1] == '0x00'
これはまさに私が期待するものです。bytes[2]ただし、 の内容をunsigned int bytesValue,値にコピーするとき128は、32768. 10 進値は 16 進値128で表されます0x0080。本質的には、実行中にバイト順が逆になっているようですmemcpy。ここで何が起こっているのですか?これはエンディアンの問題だけですか?
ありがとう
CFMutableBitVectorRef bitVector = CFBitVectorCreateMutable(kCFAllocatorDefault, 16);
CFBitVectorSetCount(bitVector, 16);
CFBitVectorSetBitAtIndex(bitVector, 0, 1);
CFRange range = CFRangeMake(0, 16);
Byte bytes[2] = {0,0};
unsigned int bytesValue = 0;
CFBitVectorGetBits(bitVector, range, bytes);
memcpy(&bytesValue, bytes, sizeof(bytes));
return bytesValue;