]> code.bitgloo.com Git - clyne/consteval-huffman.git/commitdiff
fixed bytes_saved for reporting negative values
authorclyne <clyne@bitgloo.com>
Sun, 15 Nov 2020 02:00:09 +0000 (21:00 -0500)
committerGitHub <noreply@github.com>
Sun, 15 Nov 2020 02:00:09 +0000 (21:00 -0500)
consteval_huffman.hpp

index 82a39c0f416e0e4cb3efa8b2ad47f648b8f2020e..6061764caf5eb09421c12548741ddbcdc719b0ab 100644 (file)
  * @tparam data The string of data to be compressed.
  * @tparam data_length The size in bytes of the data, defaults to using strlen().
  */
-template<const char *data, std::size_t data_length = std::char_traits<char>::length(data)>
+template<const char *data, auto data_length = std::char_traits<char>::length(data)>
 class huffman_compress
 {
-    using size_t = unsigned long int;
+    using size_t = long int;
 
     // Jump to the bottom of this header for the public-facing features of this
     // class.
@@ -274,7 +274,7 @@ public:
     consteval static auto uncompressed_size() {
         return data_length;
     }
-    consteval static auto bytes_saved() {
+    consteval static size_t bytes_saved() {
         return uncompressed_size() - compressed_size();
     }