dwg_decode_unknown (Bit_Chain *restrict dat, Dwg_Object *restrict obj)
{
  // bitsize does not include the handles size
  int num_bytes;
  unsigned long pos = bit_position (dat);
  long num_bits = (8 * obj->size) - pos;
  if (num_bits < 0)
    return DWG_ERR_VALUEOUTOFBOUNDS;

  //*pre_bits = pos % 8;
  obj->num_unknown_bits = num_bits;
  num_bytes = num_bits / 8;
  if (num_bits % 8)
    {
      num_bytes++;
      dat->size++; // allow overshoot by one byte (for missing bits)
    }

  obj->unknown_bits = bit_read_TF (dat, num_bytes);
  // [num_bits (commonsize, hdlpos, strsize)]
  LOG_TRACE ("unknown_bits [%ld (%lu,%ld,%d) TF]: ", num_bits,
             obj->common_size, obj->bitsize - obj->common_size,
             (int)obj->stringstream_size);
  LOG_TRACE_TF (obj->unknown_bits, num_bytes);
  bit_set_position (dat, pos);
  if (num_bits % 8)
    dat->size--;
  return 0;
}
dwg_decode_unknown (Bit_Chain *restrict dat, Dwg_Object *restrict obj)
{
   
  int num_bytes;
  unsigned long pos = bit_position (dat);
  long num_bits = (8 * obj->size) - pos;
  if (num_bits < 0)
    return DWG_ERR_VALUEOUTOFBOUNDS;

   
  obj->num_unknown_bits = num_bits;
  num_bytes = num_bits / 8;
  if (num_bits % 8)
    {
      num_bytes++;
      dat->size++;  
    }

  obj->unknown_bits = bit_read_TF (dat, num_bytes);
   
  LOG_TRACE ("unknown_bits [%ld (%lu,%ld,%d) TF]: ", num_bits,
             obj->common_size, obj->bitsize - obj->common_size,
             (int)obj->stringstream_size);
  LOG_TRACE_TF (obj->unknown_bits, num_bytes);
  bit_set_position (dat, pos);
  if (num_bits % 8)
    dat->size--;
  return 0;
}