Fixes warning in toHuman

This commit is contained in:
2025-07-16 02:25:12 -04:00
parent 1ce9f47c59
commit b663c74706

View File

@@ -15,9 +15,9 @@ std::string toHuman( std::size_t size )
{
constexpr std::size_t mod { 1024 };
if ( size < mod ) return std::format( "{}B", size );
if ( size < std::pow( mod, 2 ) ) return std::format( "{}KiB", static_cast< int >( size / mod ) );
if ( size < std::pow( mod, 3 ) ) return std::format( "{}MiB", static_cast< int >( size / std::pow( mod, 2 ) ) );
if ( size < std::pow( mod, 4 ) ) return std::format( "{}GiB", static_cast< int >( size / std::pow( mod, 3 ) ) );
if ( size < std::pow( mod, 2ul ) ) return std::format( "{}KiB", static_cast< int >( size / mod ) );
if ( size < std::pow( mod, 3ul ) ) return std::format( "{}MiB", static_cast< int >( size / std::pow( mod, 2 ) ) );
if ( size < std::pow( mod, 4ul ) ) return std::format( "{}GiB", static_cast< int >( size / std::pow( mod, 3 ) ) );
return std::format( "{}TiB", static_cast< int >( size / std::pow( mod, 4 ) ) );
}
} // namespace fgl::size