Skip to content

Commit

Permalink
Align the block_size to a power of 2 on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
estraier committed Oct 26, 2024
1 parent ba89aa1 commit c884c8d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tkrzw_sys_file_pos_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ Status PositionalParallelFileImpl::SetAccessStrategy(int64_t block_size, int32_t
if (file_handle_ != nullptr) {
return Status(Status::PRECONDITION_ERROR, "alread opened file");
}
block_size_ = block_size;
block_size_ = block_size > 1 ?
AlignNumberPowTwo(std::max<int64_t>(sizeof(void*), block_size)) : 1;
access_options_ = options;
return Status(Status::SUCCESS);
}
Expand Down Expand Up @@ -1112,7 +1113,8 @@ Status PositionalAtomicFileImpl::SetAccessStrategy(int64_t block_size, int32_t o
if (file_handle_ != nullptr) {
return Status(Status::PRECONDITION_ERROR, "alread opened file");
}
block_size_ = block_size;
block_size_ = block_size > 1 ?
AlignNumberPowTwo(std::max<int64_t>(sizeof(void*), block_size)) : 1;
access_options_ = options;
return Status(Status::SUCCESS);
}
Expand Down

0 comments on commit c884c8d

Please sign in to comment.