Hello,
The HFS+ specs mention: " UInt32 attributes; The following constants define the various bits that may be set in the attributes field of the header record.
enum{ kBTBadCloseMask = 0x00000001, kBTBigKeysMask=0x00000002, kBTVariableIndexKeysMask=0x00000004 } "
In my case I need to set both kBTBigkeysMask and kBTVariableIndexKeysMask. What is meant by bits 1,2 and 4?
Do I set attributes = 6 (assuming 2 and 4 refer to positions 1(2^1) and 2(2^2))
OR
attributes = 20 (binary 10100) starting to count from 0 (LSB) ?
OR attributes = 10 (binary 1010) starting to count from 1 (LSB) ?
Can somebody please tell me how this is to be interpreted? Regards, Nandini Hengen
On Thursday, January 24, 2002, at 02:28 AM, Entwicklung wrote:
enum{ kBTBadCloseMask = 0x00000001, kBTBigKeysMask=0x00000002, kBTVariableIndexKeysMask=0x00000004 } " In my case I need to set both kBTBigkeysMask and kBTVariableIndexKeysMask. What is meant by bits 1,2 and 4? Do I set attributes = 6 (assuming 2 and 4 refer to positions 1(2^1) and 2(2^2))
Yes. The numbers above are masks, not bit numbers.
Apple typically names constants ending in "Mask" for the value you would logically OR in to produce the composite value. Constants for bit numbers often end in "Bit"; those would be used to determine how many places to shift to get to the correct bit. So, kBTVariableIndexKeysBit would be 2. (The above constants are bits 0, 1 and 2.)
-Mark
Hi,
In most of Apple's code (and specs), "xxxBit" would refer to a bit position. Far more common is "xxxMask", which is the value for the field with the bit in question set. In this case you'll notice the masks (specifeid as hexadecimal constants) represent values with successive bits set, starting from the LSB. If you need to set more than one, just OR together or add the masks specified for each one.
Hope that helps, -Pat Dirks.
On Thursday, January 24, 2002, at 02:28 AM, Entwicklung wrote:
Hello, The HFS+ specs mention: " UInt32 attributes; The following constants define the various bits that may be set in the attributes field of the header record. enum{ kBTBadCloseMask = 0x00000001, kBTBigKeysMask=0x00000002, kBTVariableIndexKeysMask=0x00000004 } " In my case I need to set both kBTBigkeysMask and kBTVariableIndexKeysMask. What is meant by bits 1,2 and 4? Do I set attributes = 6 (assuming 2 and 4 refer to positions 1(2^1) and 2(2^2)) OR attributes = 20 (binary 10100) starting to count from 0 (LSB) ? OR attributes = 10 (binary 1010) starting to count from 1 (LSB) ? Can somebody please tell me how this is to be interpreted? Regards, Nandini Hengen