@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2017 , Adriaan de Groot < groot @ kde . org >
* Copyright 2019 , Collabora Ltd < arnaud . ferraris @ collabora . com >
*
* Calamares is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
@ -24,10 +25,16 @@
namespace CalamaresUtils
{
/** User defined literals, 1_KiB is 1 KibiByte (= 2^10 bytes) */
constexpr qint64 operator " " _KiB ( unsigned long long m )
{
return qint64 ( m ) * 1024 ;
}
/** User defined literals, 1_MiB is 1 MibiByte (= 2^20 bytes) */
constexpr qint64 operator " " _MiB ( unsigned long long m )
{
return qint64 ( m ) * 1024 * 1024 ;
return operator " " _KiB ( m ) * 1024 ;
}
/** User defined literals, 1_GiB is 1 GibiByte (= 2^30 bytes) */
@ -36,6 +43,11 @@ constexpr qint64 operator ""_GiB( unsigned long long m )
return operator " " _MiB ( m ) * 1024 ;
}
constexpr qint64 KiBtoBytes ( unsigned long long m )
{
return operator " " _KiB ( m ) ;
}
constexpr qint64 MiBtoBytes ( unsigned long long m )
{
return operator " " _MiB ( m ) ;
@ -46,7 +58,12 @@ constexpr qint64 GiBtoBytes( unsigned long long m )
return operator " " _GiB ( m ) ;
}
constexpr qint64 MiBToBytes ( double m )
constexpr qint64 KiBtoBytes ( double m )
{
return qint64 ( m * 1024 ) ;
}
constexpr qint64 MiBtoBytes ( double m )
{
return qint64 ( m * 1024 * 1024 ) ;
}