如何按位与CFBitVector [英] How to bitwise-and CFBitVector
问题描述
我 CFMutableBitVector
的两个实例,像这样:
I have two instances of CFMutableBitVector
, like so:
CFBitVectorRef ref1, ref2;
我怎样才能做到逐位操作,以这些家伙?对于现在,我只关心和
,但显然 XOR
,或
等将是了解的。
How can I do bit-wise operations to these guys? For right now, I only care about and
, but obviously xor
, or
, etc would be useful to know.
很明显,我可以通过矢量位重复,但似乎傻了,当我在对位电平工作。我觉得有只是一些我缺少核心基础功能,但我无法找到他们。
Obviously I can iterate through the bits in the vector, but that seems silly when I'm working at the bit level. I feel like there are just some Core Foundation functions that I'm missing, but I can't find them.
谢谢,
库尔特
推荐答案
嘛
CFBitVectorRef
是
typedef const struct __CFBitVector *CFBitVectorRef;
其是
struct __CFBitVector {
CFRuntimeBase _base;
CFIndex _count; /* number of bits */
CFIndex _capacity; /* maximum number of bits */
__CFBitVectorBucket *_buckets;
};
其中,
/* The bucket type must be unsigned, at least one byte in size, and
a power of 2 in number of bits; bits are numbered from 0 from left
to right (bit 0 is the most significant) */
typedef uint8_t __CFBitVectorBucket;
所以,你可以在做字节潜水可能加快速度明智的操作。当然,作为不可变可能会阻碍事情有点:D
So you can dive in a do byte wise operations which could speed things up. Of course being non-mutable might hinder things a bit :D
这篇关于如何按位与CFBitVector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!