Skip to content

Commit

Permalink
Enhancement: make alignment easy (oceanbase#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
yinghaoyu authored Mar 11, 2024
1 parent 6b67c11 commit e2165ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/observer/storage/clog/clog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ string CLogRecordData::to_string() const

////////////////////////////////////////////////////////////////////////////////

int _align8(int size) { return size / 8 * 8 + ((size % 8 == 0) ? 0 : 8); }
int _align8(int size) { return (size + 7) & ~7; }

CLogRecord *CLogRecord::build_mtr_record(CLogType type, int32_t trx_id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/observer/storage/record/record_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static constexpr int PAGE_HEADER_SIZE = (sizeof(PageHeader));
*
* @param size 待对齐的字节数
*/
int align8(int size) { return (size + 7) / 8 * 8; }
int align8(int size) { return (size + 7) & ~7; }

/**
* @brief 计算指定大小的页面,可以容纳多少个记录
Expand Down

0 comments on commit e2165ae

Please sign in to comment.