bit_read_TU (Bit_Chain *restrict dat)
{
  unsigned int i;
  unsigned int length;
  BITCODE_TU chain;

  length = bit_read_BS (dat);
  if (dat->byte + (length * 2) >= dat->size)
    {
      loglevel = dat->opts & DWG_OPTS_LOGLEVEL;
      LOG_ERROR ("%s buffer overflow at %lu, length %u", __FUNCTION__,
                 dat->byte, length)
      return NULL;
    }
  chain = (BITCODE_TU)malloc ((length + 1) * 2);
  for (i = 0; i < length; i++)
    {
      chain[i] = bit_read_RS (dat); // probably without byte swapping
    }
  chain[length] = 0;

  return chain;
}
bit_read_TU (Bit_Chain *restrict dat)
{
  unsigned int i;
  unsigned int length;
  BITCODE_TU chain;

  length = bit_read_BS (dat);
  if (dat->byte + (length * 2) >= dat->size)
    {
      loglevel = dat->opts & DWG_OPTS_LOGLEVEL;
      LOG_ERROR ("%s buffer overflow at %lu, length %u", __FUNCTION__,
                 dat->byte, length)
      return NULL;
    }
  chain = (BITCODE_TU)malloc ((length + 1) * 2);
  for (i = 0; i < length; i++)
    {
      chain[i] = bit_read_RS (dat);  
    }
  chain[length] = 0;

  return chain;
}