Skip to content

Commit

Permalink
removed CalcTotalLength function (4paradigm#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
PrajwalBorkar authored Jul 8, 2022
1 parent 7d00ca9 commit a04ae0d
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/codec/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,27 +193,6 @@ class RowView {

namespace v1 {

static constexpr uint8_t VERSION_LENGTH = 2;
static constexpr uint8_t SIZE_LENGTH = 4;
// calc the total row size with primary_size, str field count and str_size
inline uint32_t CalcTotalLength(uint32_t primary_size, uint32_t str_field_cnt, uint32_t str_size,
uint32_t* str_addr_space) {
uint32_t total_size = primary_size + str_size;
if (total_size + str_field_cnt <= UINT8_MAX) {
*str_addr_space = 1;
return total_size + str_field_cnt;
} else if (total_size + str_field_cnt * 2 <= UINT16_MAX) {
*str_addr_space = 2;
return total_size + str_field_cnt * 2;
} else if (total_size + str_field_cnt * 3 <= 1 << 24) {
*str_addr_space = 3;
return total_size + str_field_cnt * 3;
} else {
*str_addr_space = 4;
return total_size + str_field_cnt * 4;
}
}

inline int8_t GetAddrSpace(uint32_t size) {
if (size <= UINT8_MAX) {
return 1;
Expand Down

0 comments on commit a04ae0d

Please sign in to comment.