diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 09:45:59 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 09:45:59 +0100 |
| commit | 226bf12ca084705f47ed6aa66932f5efb4a7796b (patch) | |
| tree | a79b07ff95e40ccd3174318e7a53b5f45082b25c /dev | |
| parent | 3c5f5b01ba02974b172e6180aeda6eb7cdf0f91e (diff) | |
feat: chunk_string: `str()` performance improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/lib/core/chunk_string.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dev/lib/core/chunk_string.hpp b/dev/lib/core/chunk_string.hpp index c99bfc8..77e6864 100644 --- a/dev/lib/core/chunk_string.hpp +++ b/dev/lib/core/chunk_string.hpp @@ -79,11 +79,14 @@ namespace ocl std::basic_string<char_type> str() const noexcept { static std::basic_string<char_type> ret; + const auto& sz = ret.size(); - if (ret.size() > 0) + if (chunk_total_ > sz) ret.clear(); + else + return ret; - ret += packed_chunks_; + ret = packed_chunks_; return ret; } |
