Skip to content

Commit 20015dc

Browse files
feat: default pad amount parameter to 1
1 parent 26808fb commit 20015dc

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

include/BufferStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class BufferStream {
275275
}
276276

277277
template<BufferStreamPODType T = std::byte>
278-
BufferStream& pad(std::uint64_t n) {
278+
BufferStream& pad(std::uint64_t n = 1) {
279279
for (std::uint64_t i = 0; i < n * sizeof(T); i++) {
280280
this->write<std::byte>({});
281281
}

include/FileStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class FileStream {
236236
}
237237

238238
template<BufferStreamPODType T = std::byte>
239-
FileStream& pad(std::uint64_t n) {
239+
FileStream& pad(std::uint64_t n = 1) {
240240
for (std::uint64_t i = 0; i < n * sizeof(T); i++) {
241241
this->write<std::byte>({});
242242
}

test/BufferStream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ TEST(BufferStream, pad) {
160160

161161
EXPECT_EQ(stream.tell(), 0);
162162

163-
stream.pad(1);
163+
stream.pad();
164164
EXPECT_EQ(stream.tell(), 1);
165165

166166
stream.pad(2);
167167
EXPECT_EQ(stream.tell(), 3);
168168

169-
stream.pad<std::int16_t>(1);
169+
stream.pad<std::int16_t>();
170170
EXPECT_EQ(stream.tell(), 3 + sizeof(std::int16_t));
171171
}
172172

0 commit comments

Comments
 (0)