message: vertexcodec: Refactor bit encoding
  Extract functions to compute # of bits and encode raw bytes so that we
  can use these later.
diff: @@ -164,7 +164,7 @@ static void traceEncodeVertexBlock(const unsigned char* vertex_data, size_t vert
  }
  #endif
  -static unsigned char* encodeBytes(unsigned char* data, const unsigned char* buffer, size_t buffer_size)
  +static int computeEncodeBits(const unsigned char* buffer, size_t buffer_size)
  {
  unsigned char max = 0;
  @@ -179,7 +179,12 @@ static unsigned char* encodeBytes(unsigned char* data, const unsigned char* buff
  assert(bits <= 8);
  - *data++ = bits;
  + return bits;
  +}
  +
  +static unsigned char* encodeBytesRaw(unsigned char* data, const unsigned char* buffer, size_t buffer_size, int bits)
  +{
  + assert(bits >= 0 && bits <= 8);
  if (bits == 0)
  return data;
  @@ -202,6 +207,17 @@ static unsigned char* encodeBytes(unsigned char* data, const unsigned char* buff
  return data;
  }
  +static unsigned char* encodeBytes(unsigned char* data, const unsigned char* buffer, size_t buffer_size)
  +{
  + int bits = computeEncodeBits(buffer, buffer_size);
  +
  + *data++ = bits;
  +
  + data = encodeBytesRaw(data, buffer, buffer_size, bits);
  +
  + return data;
  +}
  +
  static unsigned char* encodeVertexBlock(unsigned char* data, const unsigned char* vertex_data, size_t vertex_count, size_t vertex_size, const unsigned int* prediction)
  {
  assert(vertex_count > 0 && vertex_count <= 256);
  