Skip to content

Commit

Permalink
fix ci windows
Browse files Browse the repository at this point in the history
  • Loading branch information
uchenily committed May 16, 2024
1 parent 4dce681 commit 4b2dde5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions benchmark/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## 测试环境

cpu: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
kernel: 6.8.8-arch1-1
gcc: (GCC) 14.1.1 20240507
wrk: 4.2.0 [epoll] Copyright (C) 2012 Will Glozer
- cpu: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
- kernel: 6.8.8-arch1-1
- gcc: (GCC) 14.1.1 20240507
- wrk: 4.2.0 [epoll] Copyright (C) 2012 Will Glozer


```shell
Expand Down
10 changes: 6 additions & 4 deletions uvio/io/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ class StreamBuffer {
}

auto write_to(std::span<char> dst) noexcept -> std::size_t {
auto len = std::min(static_cast<std::size_t>(r_remaining()),
dst.size_bytes());
// MSVC处理\n换行有bug, std::min只能放到同一行
auto n_readable = static_cast<std::size_t>(r_remaining());
auto len = std::min(n_readable, dst.size_bytes());
std::copy_n(r_begin(), len, dst.begin());
r_increase(len);
if (r_pos_ == w_pos_) {
Expand All @@ -73,8 +74,9 @@ class StreamBuffer {
}

auto read_from(std::span<const char> src) noexcept -> std::size_t {
auto len = std::min(static_cast<std::size_t>(w_remaining()),
src.size_bytes());
// MSVC处理\n换行有bug, std::min只能放到同一行
auto n_writable = static_cast<std::size_t>(w_remaining());
auto len = std::min(n_writable, src.size_bytes());
std::copy_n(src.begin(), len, w_begin());
w_increase(len);
return len;
Expand Down

0 comments on commit 4b2dde5

Please sign in to comment.