better set the length of int

This commit is contained in:
2024-04-25 14:11:22 +00:00
parent 97398bfa48
commit a54589add8
2 changed files with 8 additions and 4 deletions

View File

@ -8,10 +8,13 @@ class BPlusTreePage {
typedef std::pair<KeyType, b_plus_tree_value_index_t> value_type;
page_id_t p_n;
page_id_t p_parent;
unsigned char is_leaf;
const static size_t kMaxKeyCount = (kPageSize - sizeof(page_id_t) * 2 - sizeof(unsigned char)) / sizeof(value_type);
uint8_t is_leaf;
uint16_t key_count;
const static size_t kMaxKeyCount =
(kPageSize - sizeof(page_id_t) * 2 - sizeof(uint8_t) - sizeof(uint16_t)) / sizeof(value_type);
value_type p_data[kMaxKeyCount];
char filler[kPageSize - sizeof(page_id_t) * 2 - sizeof(unsigned char) - sizeof(value_type) * kMaxKeyCount];
char filler[kPageSize - sizeof(page_id_t) * 2 - sizeof(uint8_t) - sizeof(uint16_t) -
sizeof(value_type) * kMaxKeyCount];
};
#pragma pack(pop)
#endif // BPT_PAGE_H

View File

@ -1,8 +1,9 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <cstddef>
#include <cstdint>
extern const size_t kPageSize;
typedef unsigned int default_numeric_index_t;
typedef uint32_t default_numeric_index_t;
typedef default_numeric_index_t page_id_t;
typedef default_numeric_index_t block_id_t;
typedef default_numeric_index_t frame_id_t;