Reorder members of the Command struct plus fix some warnings.

This may save 8 bytes of padding per Command (32 -> 24 bytes).
This commit is contained in:
Zoltan Szabadka 2016-01-26 11:25:53 +01:00
parent 6c98f033e0
commit 14d6ae74a9
3 changed files with 6 additions and 5 deletions

View File

@ -655,8 +655,8 @@ void StoreTrivialContextMap(size_t num_types,
uint8_t* storage) { uint8_t* storage) {
StoreVarLenUint8(num_types - 1, storage_ix, storage); StoreVarLenUint8(num_types - 1, storage_ix, storage);
if (num_types > 1) { if (num_types > 1) {
size_t repeat_code = context_bits - 1; size_t repeat_code = context_bits - 1u;
uint64_t repeat_bits = (1 << repeat_code) - 1; size_t repeat_bits = (1u << repeat_code) - 1u;
size_t alphabet_size = num_types + repeat_code; size_t alphabet_size = num_types + repeat_code;
std::vector<uint32_t> histogram(alphabet_size); std::vector<uint32_t> histogram(alphabet_size);
std::vector<uint8_t> depths(alphabet_size); std::vector<uint8_t> depths(alphabet_size);

View File

@ -100,7 +100,7 @@ struct Command {
explicit Command(size_t insertlen) explicit Command(size_t insertlen)
: insert_len_(static_cast<uint32_t>(insertlen)) : insert_len_(static_cast<uint32_t>(insertlen))
, copy_len_(0), dist_prefix_(16), dist_extra_(0) { , copy_len_(0), dist_extra_(0), dist_prefix_(16) {
GetLengthCode(insertlen, 4, dist_prefix_ == 0, &cmd_prefix_, &cmd_extra_); GetLengthCode(insertlen, 4, dist_prefix_ == 0, &cmd_prefix_, &cmd_extra_);
} }
@ -125,10 +125,10 @@ struct Command {
uint32_t insert_len_; uint32_t insert_len_;
uint32_t copy_len_; uint32_t copy_len_;
uint16_t cmd_prefix_;
uint16_t dist_prefix_;
uint64_t cmd_extra_; uint64_t cmd_extra_;
uint32_t dist_extra_; uint32_t dist_extra_;
uint16_t cmd_prefix_;
uint16_t dist_prefix_;
}; };
} // namespace brotli } // namespace brotli

View File

@ -193,6 +193,7 @@ BrotliCompressor::BrotliCompressor(BrotliParams params)
storage_size_(0), storage_size_(0),
storage_(0), storage_(0),
large_table_(NULL), large_table_(NULL),
cmd_code_numbits_(0),
command_buf_(NULL), command_buf_(NULL),
literal_buf_(NULL) { literal_buf_(NULL) {
// Sanitize params. // Sanitize params.