Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

construct huffman table from symbol spans #97

Merged
merged 1 commit into from
Oct 22, 2023

Commits on Oct 22, 2023

  1. construct huffman table from symbol spans

    Define class template `symbol_span` that represents an inclusive range
    from first to last. The `symbol_bitsize` constructor of `huffman::table`
    now takes a range of pair-likes of `symbol_span` and bitsize, allowin
    gthe same bitsize to be associated with a contiguous range of symbols.
    
    For example, the static Huffman tree corresponding to the literal/length
    alphabet in section 3.2.6 of the DEFLATE RFC can be defined as:
    
     constexpr auto table =
      huffman::table<std::uint16_t, 288>{
        huffman::symbol_bitsize,
        {{{  0, 143}, 8},
         {{144, 255}, 9},
         {{256, 279}, 7},
         {{280, 287}, 8}}};
    
    resolves #91
    
    Change-Id: I50f7ea63561de0bb785c85467cdb943829b65edf
    Co-Authored-By: Gary Miguel <[email protected]>
    oliverlee and garymm committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    ac578ee View commit details
    Browse the repository at this point in the history