diff options
author | Yury Melnichek <melnichek@gmail.com> | 2011-05-17 01:55:40 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:17:31 +0300 |
commit | 61ae0cd39f361e9e5c10b073190f773b46886c04 (patch) | |
tree | 5242e31db47d63974b2f500c9ef2876175610664 /coding/write_to_sink.hpp | |
parent | 70294b4efaea6eb96c27108306300c7c33549ee1 (diff) |
Add WriteZeroesToSink() to write_to_sink.hpp
Diffstat (limited to 'coding/write_to_sink.hpp')
-rw-r--r-- | coding/write_to_sink.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/coding/write_to_sink.hpp b/coding/write_to_sink.hpp index 1f291d9c8b..8d1adf5faa 100644 --- a/coding/write_to_sink.hpp +++ b/coding/write_to_sink.hpp @@ -55,6 +55,14 @@ template <class TSink> void WriteToSink(TSink & sink, uint64_t v) sink.Write(&t, 8); } +template <class TSink> void WriteZeroesToSink(TSink & sink, uint64_t size) +{ + uint8_t const zeroes[256] = { 0 }; + for (uint64_t i = 0; i < (size >> 8); ++i) + sink.Write(zeroes, 256); + sink.Write(zeroes, size & 255); +} + template <typename SinkT> struct WriterFunctor { |