Windows file system block size is typically 4096 bytes, not 1024.
-// Copyright (C) 2019-2022 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2023 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
#include <core/wincompat.hpp>
#include <util/TimePoint.hpp>
+#include <util/file.hpp>
#include <sys/stat.h>
#include <sys/types.h>
Stat::size_on_disk() const
{
#ifdef _WIN32
- return (size() + 1023) & ~1023;
+ return util::likely_size_on_disk(size());
#else
return m_stat.st_blocks * 512;
#endif
-// Copyright (C) 2019-2022 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2023 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
CHECK(stat.mtime().sec() == last_write_time.tv_sec);
CHECK(stat.mtime().nsec_decimal_part() == last_write_time.tv_nsec);
- CHECK(stat.size_on_disk() == ((stat.size() + 1023) & ~1023));
+ CHECK(stat.size_on_disk() == ((stat.size() + 4095) & ~4095));
CHECK(stat.file_attributes() == info.dwFileAttributes);
CHECK(stat.reparse_tag() == 0);