Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The idea of bit flags is that you can cram a bunch of flags into a small number of bytes by adding them together.</p> <p>In this case, they're not saying that each value you see in that list is a separate pair of bytes. They're all crammed into two bytes. If you were writing the file, you would add these values together to get the value to write.</p> <p>For example, suppose we want to say "Archive lock attribute", "New volume naming scheme", and "Block headers encrypted". That means we want to set 0x0004, 0x0010, and 0x0080. So we add these all together, 0x0004 + 0x0010 + 0x0080 = 0x0094, and that's the value we write. For this to work, all values must turn out to be a single bit, or to put it another way, all must be powers of 2.</p> <p>So this documentation doesn't describe 18 bytes. It only describes 2.</p> <p>To read it, you have to perform AND operations (&amp;) with the desired flag value. Life if you want to know if "Block headers encrypted" is set, read the value and AND with 0x0010. As this is a two-byte value, you either want to get it into a short or you have to pick the correct byte. Let's say for the sake of argument that we get it into a short. Then we'd say</p> <pre><code>if ((flags &amp; 0x0010) != 0) </code></pre> <p>If that expression is true, then the bit is set. If it is false, the bit is not set.</p> <p>BTW, if you read it as a stream of bytes, you can put them into a short by writing:</p> <pre><code>short flags = b[0] | b[1]&lt;&lt;8; </code></pre> <p>(You may need a cast in there. I forget.)</p> <p>Or you may have to switch b[0] and b[1], depending on whether the file is written low-hi or hi-low.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload