diff options
author | clyne <clyne@bitgloo.com> | 2020-12-28 21:09:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-28 21:09:36 -0500 |
commit | d405af197f1df84389afdcd1a340839dabe4b642 (patch) | |
tree | 565d92a11dbb676b08b73370ef03dfcd8986bc49 /README.md | |
parent | 3d514db570e955de3d294dd906777e672353c5d0 (diff) |
Update README.md
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -8,25 +8,20 @@ Compression is achieved using [Huffman coding](https://en.wikipedia.org/wiki/Huf **1. Text configurations (e.g. JSON)** -A ~3.5kB string of JSON can be compressed down ~2.5kB ([see it on Godbolt](https://godbolt.org/z/1MzG1v)). +A ~3.5kB string of JSON can be compressed down ~2.5kB ([see it on Godbolt](https://godbolt.org/z/rqWf4v)). **2. Scripts (e.g. Lisp)** -A ~40 line comment-including sample of Lisp can be reduced from 1,662 bytes to 1,244 (418 bytes saved) ([Godbolt](https://godbolt.org/z/jcnKza)). +A ~40 line comment-including sample of Lisp can be reduced from 1,662 bytes to 1,244 (418 bytes saved) ([Godbolt](https://godbolt.org/z/Kbenbh)). ## How to Use ```cpp #include "consteval_huffman.hpp" -constexpr static const char some_data_raw[] = /* insert text here */; - -// Creates an object with the compressed data -// If data is not smaller after compression, huffman_compress will keep the data uncompressed -constinit static const auto some_data = huffman_compress<some_data_raw>(); - -// Or, with a set data length: -// ... some_data = huffman_compress<some_data_raw, 1500>(); +// Using the _huffman suffix creates an object with the compressed data. +// If data is not smaller after compression, the object will keep the data uncompressed. +constinit auto some_data = "This is my string of data"_huffman; int main() { |