AlexanderSaydakov commented on a change in pull request #209:
URL: https://github.com/apache/datasketches-cpp/pull/209#discussion_r616139150



##########
File path: cpc/include/cpc_compressor_impl.hpp
##########
@@ -64,17 +64,17 @@ uint8_t* cpc_compressor<A>::make_inverse_permutation(const 
uint8_t* permu, int l
    of length at most 12, this builds a size-4096 decoding table */
 // The second argument is typically 256, but can be other values such as 65.
 template<typename A>
-uint16_t* cpc_compressor<A>::make_decoding_table(const uint16_t* 
encoding_table, int num_byte_values) {
+uint16_t* cpc_compressor<A>::make_decoding_table(const uint16_t* 
encoding_table, unsigned num_byte_values) {
   uint16_t* decoding_table = new uint16_t[4096]; // use new for global 
initialization
-  for (int byte_value = 0; byte_value < num_byte_values; byte_value++) {
-    const int encoding_entry = encoding_table[byte_value];
-    const int code_value = encoding_entry & 0xfff;
-    const int code_length = encoding_entry >> 12;
-    const int decoding_entry = (code_length << 8) | byte_value;
-    const int garbage_length = 12 - code_length;
-    const int num_copies = 1 << garbage_length;
-    for (int garbage_bits = 0; garbage_bits < num_copies; garbage_bits++) {
-      const int extended_code_value = code_value | (garbage_bits << 
code_length);
+  for (unsigned byte_value = 0; byte_value < num_byte_values; byte_value++) {
+    const uint16_t encoding_entry = encoding_table[byte_value];
+    const uint16_t code_value = encoding_entry & 0xfff;
+    const uint8_t code_length = encoding_entry >> 12;
+    const uint16_t decoding_entry = static_cast<uint16_t>((code_length << 8) | 
byte_value);
+    const uint8_t garbage_length = 12 - code_length;
+    const unsigned num_copies = 1 << garbage_length;

Review comment:
       not sure what was I thinking. perhaps we should be more specific and 
more consistent




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to