decode_entity_preR13 (Bit_Chain *restrict dat, Dwg_Object *restrict obj,
                      Dwg_Object_Entity *ent)
{
  Dwg_Object_Entity *_obj = ent;

  obj->type = bit_read_RC (dat);
  _obj->flag_r11 = bit_read_RC (dat); // dxf 70
  obj->size = bit_read_RS (dat);
  LOG_INFO ("\n===========================\n"
            "Entity number: %d, Type: %d, Size: %d\n",
            obj->index, obj->type, obj->size);
  LOG_TRACE ("flag_r11: " FORMAT_RC "\n", _obj->flag_r11);
  FIELD_RS (layer_r11, 8);
  FIELD_RS (opts_r11, 0);
  // LOG_TRACE("Layer: %d, Opts: 0x%x\n", ent->layer_r11, ent->opts_r11)
  if (ent->flag_r11 & 1)
    {
      FIELD_RC (color_r11, 0);
    }
  if (ent->flag_r11 & 0x40)
    {
      FIELD_RC (extra_r11, 0);
    }
  /* Common entity preR13 header: */
  if (ent->extra_r11 & 2)
    {
      int error = dwg_decode_eed (dat, (Dwg_Object_Object *)ent);
      if (error & (DWG_ERR_INVALIDEED | DWG_ERR_VALUEOUTOFBOUNDS))
        return error;
    }
  if (FIELD_VALUE (flag_r11) & 2)
    FIELD_RS (kind_r11, 0);

  return 0;
}
decode_entity_preR13 (Bit_Chain *restrict dat, Dwg_Object *restrict obj,
                      Dwg_Object_Entity *ent)
{
  Dwg_Object_Entity *_obj = ent;

  obj->type = bit_read_RC (dat);
  _obj->flag_r11 = bit_read_RC (dat);  
  obj->size = bit_read_RS (dat);
  LOG_INFO ("\n===========================\n"
            "Entity number: %d, Type: %d, Size: %d\n",
            obj->index, obj->type, obj->size);
  LOG_TRACE ("flag_r11: " FORMAT_RC "\n", _obj->flag_r11);
  FIELD_RS (layer_r11, 8);
  FIELD_RS (opts_r11, 0);
   
  if (ent->flag_r11 & 1)
    {
      FIELD_RC (color_r11, 0);
    }
  if (ent->flag_r11 & 0x40)
    {
      FIELD_RC (extra_r11, 0);
    }
   
  if (ent->extra_r11 & 2)
    {
      int error = dwg_decode_eed (dat, (Dwg_Object_Object *)ent);
      if (error & (DWG_ERR_INVALIDEED | DWG_ERR_VALUEOUTOFBOUNDS))
        return error;
    }
  if (FIELD_VALUE (flag_r11) & 2)
    FIELD_RS (kind_r11, 0);

  return 0;
}