public function appendBits(array $bits, Buffer $buffer)
    {
        $value = 0;
        foreach ($bits as $n => $bit) {
            $bit = $bit ? 1 : 0;
            $value |= $bit << $n;
        }
        $buffer->appendUint8($value);
    }