|
Hi Ross,
Essentially, yes.
It's a two-bit field by the look of it, using bits
1 and 2 of the word (numbering from bit 0 = least significant to 31 = most
significant).
6 (bit pattern 110) is the mask, ie it's used with
a bitwise AND to select just those two bits from the word.
the four values of the two-bit field are
apparently:
0 = Text UTF8
1 = binary
2 = External Info
3 - reserved
So not just a simple 1-bit flag like I thought from
what you posted in the first message.
With the various values of that field the whole
word might look like:
0000 0000 = Text UTF8
0000 0002 = binary
0000 0004 = External Info
0000 0006 - reserved
Except, we don't know what might be in the rest of
the word. Probably not zeroes, so the values you are interested in will be
combined with other fields. Possibly even, that 3-bit field is repeated several
times in the word, with additional masking and shifting being used to pick
fields out. In your first message, you also showed:
#define
APE_TAG_FLAG_CONTAINS_FOOTER
(1 << 30)
which suggests bit 30 is also used as a one-bit
flag. But whether this is in the same word or not can't necessarily be
determined from the #defines. You'll probably need to find the code that masks,
sets and tests these fields to be sure how they're used, for example look for
something like:
value = (word &
TAG_FIELD_FLAG_DATA_TYPE_MASK) >> 1;
to extract the value of the field from the
word;
or, to set the value to, say "External
Info":
word &=
~TAG_FIELD_FLAG_DATA_TYPE_MASK;
word |=
TAG_FIELD_FLAG_DATA_TYPE_EXTERNAL_INFO;
To achieve the same operations in Delphi, use the
bitwise logical operators not, and, or, xor, shl and shr. Snipped from the help
screen:
Z := X or Y;
assigns the value 101101 to Z.
The following rules apply to bitwise operators. The result of a not operation is of the same type
as the operand.
If the operands of an and, or, or xor operation are both integers, the result is of the predefined integer type with the smallest range that includes all possible values of both types. The operations x shl y and x shr y shift the value of x to the left or right by y bits, which is equivalent to multiplying or dividing x by 2^y; the result is of the same type as x . For example, if N stores the value 01101 (decimal 13), then N shl 1 returns 11010 (decimal 26).
Hope some of this helps clarify things a bit and doesn't just muddy it further, Brian |
_______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
