BIT-VECTOR is a raw bit sequence with a stated length. It is the Value direct code 0x080L, family BINARY. The first 2 Payload WORDs are the unsigned 32-bit bit count N, followed by ceil(N/16) WORDs.

ItemValue
NameBIT-VECTOR (spec document BIND BIT-VECTOR)
TAG ID0x080L
Codec ID0x00000800
Spec document0x00000000/codecs/0x00000800/ (DECLARE target 0800)
Section4 0100 (Value), offset within section C = 0
KindValue · family: BINARY
TAG WORD0000 1000 0000 LLLL (000K KKKC CCCC LLLL)
Index descriptionN bits stored MSB-first after the bit count
Hugo pathvalue/binary/bit-vector.md

Fields (spec document)

The order of FIELDs in the document is the order of Payload fields (Codec spec document).

OrderField (BIND)FIELDWidthAccepted format (CODEC)ENUM
1bit-count#2raw 2 WORDs
2bits#3remaining raw bytes (0xFFFF)

Layout

TAG WORD          0000 1000 0000 LLLL      Codec 0x080L
[Length extension TAG] when the total is 15 WORDs or more
Payload WORD 1st–2nd       Bit Count N (upper 16 bits │ lower 16 bits)
Payload WORD 3rd ... Nth   Payload bits, MSB-first

Interpretation and validity

  • N is the value of the first 2 Payload WORDs read as a big-endian unsigned 32-bit integer.
  • Payload bits are filled in order starting from the most significant bit of each WORD.
  • The payload WORD count is exactly ceil(N/16), and the unused lower bits of the last WORD must all be 0.
  • If N=0, there are no payload WORDs. The two count WORDs already make up the Payload, so this does not conflict with the rule of a minimum of 1 Payload WORD.

Format status

  • The unsigned 32-bit bit count, the MSB-first arrangement, and the zero padding of the last WORD do not cite an external industry standard; they are GEUL’s own framing.
  • This page defines the representation, including the GEUL TAG, Length, and 16-bit WORD rules.

Length

  • The total is the WORD count of the TAG 1 WORD, the Length extension TAG (if present), and the Payload added together. 14 WORDs or fewer use a direct length; 15 WORDs or more use the 1110·1111 extended length, and the extension TAG is also included in the total (Record and TAG WORD).

Examples

  • The empty bit vector has count 0000 0000, no payload, 3 WORDs in total, LLLL=0010. The whole is 0802 0000 0000.
  • The bit sequence 101 has count 0000 0003, payload A000, 4 WORDs in total, LLLL=0011. The whole is 0803 0000 0003 A000.

Spec document source

This is the spec document 0x00000000/codecs/0x00000800/latest.geul as read with geul show (hex in uppercase).

SPEC-VERSION 0x0001
DOC-ID 0x0426000000000000080000000000
BODY
#1 DECLARE 0x0800
#2 FIELD #1 0x0002
#3 FIELD #1 rest
#4 BIND #1 "BIT-VECTOR"
#5 BIND #2 "bit-count"
#6 BIND #3 "bits"