Add WriteZeroesToSink() to write_to_sink.hpp

This commit is contained in:
Yury Melnichek 2011-05-16 23:55:40 +02:00 committed by Alex Zolotarev
parent 70294b4efa
commit 61ae0cd39f

View file

@ -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
{