node_modules/iltorb/brotli/enc/encode.c
static size_t WriteMetadataHeader(
    BrotliEncoderState* s, const size_t block_size, uint8_t* header) {
  size_t storage_ix;
  storage_ix = s->last_byte_bits_;
  header[0] = s->last_byte_;
  s->last_byte_ = 0;
  s->last_byte_bits_ = 0;

  BrotliWriteBits(1, 0, &storage_ix, header);
  BrotliWriteBits(2, 3, &storage_ix, header);
  BrotliWriteBits(1, 0, &storage_ix, header);
  if (block_size == 0) {
    BrotliWriteBits(2, 0, &storage_ix, header);
  } else {
    uint32_t nbits = (block_size == 1) ? 0 :
        (Log2FloorNonZero((uint32_t)block_size - 1) + 1);
    uint32_t nbytes = (nbits + 7) / 8;
    BrotliWriteBits(2, nbytes, &storage_ix, header);
    BrotliWriteBits(8 * nbytes, block_size - 1, &storage_ix, header);
  }
  return (storage_ix + 7u) >> 3;
}
/* Dumps remaining output bits and metadata header to |header|.
   Returns number of produced bytes.
   REQUIRED: |header| should be 8-byte aligned and at least 16 bytes long.
   REQUIRED: |block_size| <= (1 << 24). */
Dumps remaining output bits and metadata header to |header|.
Returns number of produced bytes.
REQUIRED: |header| should be 8-byte aligned and at least 16 bytes long.
Dumps remaining output bits and metadata header to |header| . Returns number of produced bytes . REQUIRED : |header| should be 8 - byte aligned and at least 16 bytes long .
static size_t WriteMetadataHeader(
    BrotliEncoderState* s, const size_t block_size, uint8_t* header) {
  size_t storage_ix;
  storage_ix = s->last_byte_bits_;
  header[0] = s->last_byte_;
  s->last_byte_ = 0;
  s->last_byte_bits_ = 0;
  BrotliWriteBits(1, 0, &storage_ix, header);
  BrotliWriteBits(2, 3, &storage_ix, header);
  BrotliWriteBits(1, 0, &storage_ix, header);
  if (block_size == 0) {
    BrotliWriteBits(2, 0, &storage_ix, header);
  } else {
    uint32_t nbits = (block_size == 1) ? 0 :
        (Log2FloorNonZero((uint32_t)block_size - 1) + 1);
    uint32_t nbytes = (nbits + 7) / 8;
    BrotliWriteBits(2, nbytes, &storage_ix, header);
    BrotliWriteBits(8 * nbytes, block_size - 1, &storage_ix, header);
  }
  return (storage_ix + 7u) >> 3;
}
static size_t WriteMetadataHeader ( BrotliEncoderState * s , const size_t block_size , uint8_t * header ) { size_t storage_ix ; storage_ix = s -> last_byte_bits_ ; header [ 0 ] = s -> last_byte_ ; s -> last_byte_ = 0 ; s -> last_byte_bits_ = 0 ; BrotliWriteBits ( 1 , 0 , & storage_ix , header ) ; BrotliWriteBits ( 2 , 3 , & storage_ix , header ) ; BrotliWriteBits ( 1 , 0 , & storage_ix , header ) ; if ( block_size == 0 ) { BrotliWriteBits ( 2 , 0 , & storage_ix , header ) ; } else { uint32_t nbits = ( block_size == 1 ) ? 0 : ( Log2FloorNonZero ( ( uint32_t ) block_size - 1 ) + 1 ) ; uint32_t nbytes = ( nbits + 7 ) / 8 ; BrotliWriteBits ( 2 , nbytes , & storage_ix , header ) ; BrotliWriteBits ( 8 * nbytes , block_size - 1 , & storage_ix , header ) ; } return ( storage_ix + 7u ) >> 3 ; }
Dumps remaining output bits and metadata header to |header|.
Dumps remaining output bits and metadata header to |header| .