// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

#include "insyde_fdc.h"
#include "../kaitai/exceptions.h"

insyde_fdc_t::insyde_fdc_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, insyde_fdc_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root ? p__root : this;
    f_len_fdc_store_header = false;
    _read();
}

void insyde_fdc_t::_read() {
    m_signature = m__io->read_u4le();
    m_fdc_size = m__io->read_u4le();
    {
        uint32_t _ = m_fdc_size;
        if (!( ((_ > static_cast<uint32_t>(len_fdc_store_header())) && (_ < 4294967295UL)) )) {
            throw kaitai::validation_expr_error<uint32_t>(m_fdc_size, m__io, std::string("/seq/1"));
        }
    }
    m_body = m__io->read_bytes(fdc_size() - len_fdc_store_header());
}

insyde_fdc_t::~insyde_fdc_t() {
    _clean_up();
}

void insyde_fdc_t::_clean_up() {
}

int8_t insyde_fdc_t::len_fdc_store_header() {
    if (f_len_fdc_store_header)
        return m_len_fdc_store_header;
    f_len_fdc_store_header = true;
    m_len_fdc_store_header = 80;
    return m_len_fdc_store_header;
}
