Ignore:
Timestamp:
May 7, 2018, 1:15:37 PM (12 months ago)
Author:
xwa163
Message:
  1. New version of lz4_swizzled_match_copy kernel with higher performance
  2. Adjust related pipeline code
  3. Remove legacy comments
File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/lz4FrameDecoder.cpp

    r5706 r6020  
    1111
    1212namespace {
    13 const size_t minFilesize =
    14     4 +         // Magic number
    15     3 +         // Frame descriptor (3-11 bytes)
    16     4;          // End mark
     13
    1714
    1815// Little-endian.
     
    2017}
    2118
     19LZ4FrameDecoder::LZ4FrameDecoder() {
     20
     21}
     22
    2223LZ4FrameDecoder::LZ4FrameDecoder(const std::string & filename) {
     24    this->init(filename);
     25}
     26
     27void LZ4FrameDecoder::init(const std::string &filename) {
     28    const size_t minFilesize = this->getMinFileSize();
     29
    2330    std::ifstream f(filename, std::ios::binary | std::ios::ate);
    2431    if (f.fail()) {
     
    4451
    4552    mBlocksStart = 4 + mFDLength;       // MagicNb & FD
    46     long long blocksEnd = mFilesize - 4 - (mHasContentChecksum ? 4 : 0);      // EndMark & checksum
     53    long long blocksEnd = mFilesize - this->endMarkSize() - (mHasContentChecksum ? this->contentChecksumSize() : 0);      // EndMark & checksum
    4754    if (blocksEnd > 0 && mBlocksStart <= static_cast<size_t>(blocksEnd)) {
    4855        mBlocksLength = blocksEnd - mBlocksStart;
     
    5259
    5360bool LZ4FrameDecoder::decodeFrameDescriptor(std::ifstream & f) {
     61    const size_t minFilesize = this->getMinFileSize();
     62
    5463    char flag, blockDescriptor, headerChecksum;
    5564    f.get(flag);
     
    6574
    6675    if (mFilesize < minFilesize +
    67             (mHasContentChecksum ? 4 : 0) +
     76            (mHasContentChecksum ? this->contentChecksumSize() : 0) +
    6877            (hasContentSize ? 8 : 0)
    6978       ) {
     
    8190    return true;
    8291}
     92
     93size_t LZ4FrameDecoder::endMarkSize() const {
     94    return 4;
     95}
     96
     97size_t LZ4FrameDecoder::contentChecksumSize() const {
     98    return 4;
     99}
     100
Note: See TracChangeset for help on using the changeset viewer.