From 83794c7531769fc89d9267ca5cc5b0a5b4b06969 Mon Sep 17 00:00:00 2001 From: kj16609 Date: Mon, 28 Jul 2025 15:44:34 -0400 Subject: [PATCH] Fixes type warning --- include/fgl/size.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/fgl/size.hpp b/include/fgl/size.hpp index af18357..82634ec 100644 --- a/include/fgl/size.hpp +++ b/include/fgl/size.hpp @@ -3,8 +3,6 @@ // #pragma once -#include -#include #include #include @@ -15,9 +13,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, 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 ) ) ); + if ( size < mod * mod ) return std::format( "{}KiB", static_cast< int >( size / mod ) ); + if ( size < mod * mod * mod ) return std::format( "{}MiB", static_cast< int >( size / ( mod * mod ) ) ); + if ( size < mod * mod * mod * mod ) return std::format( "{}GiB", static_cast< int >( size / ( mod * mod * mod ) ) ); + return std::format( "{}TiB", static_cast< int >( size / ( mod * mod * mod * mod ) ) ); } } // namespace fgl::size \ No newline at end of file