AK: Make some Stream::read* functions available inline

These are quite bottlenecky in wasm, the next commit will try to make
use of this by calling them directly instead of doing a vcall, and
having them inlineable helps the compiler a bit.
This commit is contained in:
Ali Mohammad Pur
2025-06-06 14:09:42 +02:00
committed by Ali Mohammad Pur
parent bd7c188b86
commit 834fb0be36
Notes: github-actions[bot] 2025-08-08 10:57:07 +00:00
6 changed files with 33 additions and 39 deletions

View File

@@ -30,7 +30,12 @@ public:
virtual bool is_open() const override;
virtual void close() override;
virtual ErrorOr<void> truncate(size_t) override;
virtual ErrorOr<Bytes> read_some(Bytes bytes) override;
virtual ErrorOr<Bytes> read_some(Bytes bytes) override
{
auto read = m_bytes.slice(m_offset).copy_trimmed_to(bytes);
m_offset += read;
return bytes.trim(read);
}
virtual ErrorOr<void> read_until_filled(Bytes bytes) override;
virtual ErrorOr<size_t> seek(i64 offset, SeekMode seek_mode = SeekMode::SetPosition) override;