Description

Package gcprog implements an encoder for packed GC pointer bitmaps, known as GC programs.

Program Format

The GC program encodes a sequence of 0 and 1 bits indicating scalar or pointer words in an object. The encoding is a simple Lempel-Ziv program, with codes to emit literal bits and to repeat the last n bits c times.

The possible codes are:

00000000: stop
0nnnnnnn: emit n bits copied from the next (n+7)/8 bytes, least significant bit first
10000000 n c: repeat the previous n bits c times; n, c are varints
1nnnnnnn c: repeat the previous n bits c times; c is a varint

The numbers n and c, when they follow a code, are encoded as varints using the same encoding as encoding/binary's Uvarint.