/*! \file piliterals_bytes.h
 * \ingroup Core
 * \~\brief
 * \~english Byte-size literal operators
 * \~russian Операторы литералов размера в байтах
 *
 * \~\details
 * \~english
 * Declare suffixes:
 * * _KB, _MB, _GB, _TB, _PB - power of 10
 * * _KiB, _MiB, _GiB, _TiB, _PiB - power of 2
 * \~russian
 * Объявляет суффиксы:
 * * _KB, _MB, _GB, _TB, _PB - степени 10
 * * _KiB, _MiB, _GiB, _TiB, _PiB - степени 2
 */
/*
    PIP - Platform Independent Primitives
	Bytes C++11 literals for bytes
    Ivan Pelipenko peri4ko@yandex.ru

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef PILITERALS_BYTES_H
#define PILITERALS_BYTES_H


//! \~\ingroup Core
//! \~\brief
//! \~english Kilobytes, x1000
//! \~russian Килобайт, x1000
constexpr unsigned long long operator""_KB(long double v) {
	return v * 1000.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Kilobytes, x1000
//! \~russian Килобайт, x1000
constexpr unsigned long long operator""_KB(unsigned long long v) {
	return v * 1000;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Kibibytes, x1024 (2^10)
//! \~russian Кибибайт, x1024 (2^10)
constexpr unsigned long long operator""_KiB(long double v) {
	return v * 1024.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Kibibytes, x1024 (2^10)
//! \~russian Кибибайт, x1024 (2^10)
constexpr unsigned long long operator""_KiB(unsigned long long v) {
	return v * 1024;
}


//! \~\ingroup Core
//! \~\brief
//! \~english Megabytes, x1000.000
//! \~russian Мегабайт, x1000.000
constexpr unsigned long long operator""_MB(long double v) {
	return v * 1000. * 1000.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Megabytes, x1000.000
//! \~russian Мегабайт, x1000.000
constexpr unsigned long long operator""_MB(unsigned long long v) {
	return v * 1000 * 1000;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Mebibytes, x1.048.576 (2^20)
//! \~russian Мебибайт, x1.048.576 (2^20)
constexpr unsigned long long operator""_MiB(long double v) {
	return v * 1024. * 1024.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Mebibytes, x1.048.576 (2^20)
//! \~russian Мебибайт, x1.048.576 (2^20)
constexpr unsigned long long operator""_MiB(unsigned long long v) {
	return v * 1024 * 1024;
}


//! \~\ingroup Core
//! \~\brief
//! \~english Gigabytes, x1000.000.000
//! \~russian Гигабайт, x1000.000.000
constexpr unsigned long long operator""_GB(long double v) {
	return v * 1000. * 1000. * 1000.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Gigabytes, x1000.000.000
//! \~russian Гигабайт, x1000.000.000
constexpr unsigned long long operator""_GB(unsigned long long v) {
	return v * 1000 * 1000 * 1000;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Gibibytes, x1.073.741.824 (2^30)
//! \~russian Гибибайт, x1.073.741.824 (2^30)
constexpr unsigned long long operator""_GiB(long double v) {
	return v * 1024. * 1024. * 1024.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Gibibytes, x1.073.741.824 (2^30)
//! \~russian Гибибайт, x1.073.741.824 (2^30)
constexpr unsigned long long operator""_GiB(unsigned long long v) {
	return v * 1024 * 1024 * 1024;
}


//! \~\ingroup Core
//! \~\brief
//! \~english Terabytes, x1000.000.000.000
//! \~russian Терабайт, x1000.000.000.000
constexpr unsigned long long operator""_TB(long double v) {
	return v * 1000. * 1000. * 1000. * 1000.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Terabytes, x1000.000.000.000
//! \~russian Терабайт, x1000.000.000.000
constexpr unsigned long long operator""_TB(unsigned long long v) {
	return v * 1000 * 1000 * 1000 * 1000;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Tebibytes, x1.099.511.627.776 (2^40)
//! \~russian Тебибайт, x1.099.511.627.776 (2^40)
constexpr unsigned long long operator""_TiB(long double v) {
	return v * 1024. * 1024. * 1024. * 1024.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Tebibytes, x1.099.511.627.776 (2^40)
//! \~russian Тебибайт, x1.099.511.627.776 (2^40)
constexpr unsigned long long operator""_TiB(unsigned long long v) {
	return v * 1024 * 1024 * 1024 * 1024;
}


//! \~\ingroup Core
//! \~\brief
//! \~english Petabytes, x1000.000.000.000.000
//! \~russian Петабайт, x1000.000.000.000.000
constexpr unsigned long long operator""_PB(long double v) {
	return v * 1000. * 1000. * 1000. * 1000. * 1000.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Petabytes, x1000.000.000.000.000
//! \~russian Петабайт, x1000.000.000.000.000
constexpr unsigned long long operator""_PB(unsigned long long v) {
	return v * 1000 * 1000 * 1000 * 1000 * 1000;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Pebibytes, x1.125.899.906.842.624 (2^50)
//! \~russian Пебибайт, x1.125.899.906.842.624 (2^50)
constexpr unsigned long long operator""_PiB(long double v) {
	return v * 1024. * 1024. * 1024. * 1024. * 1024.;
}

//! \~\ingroup Core
//! \~\brief
//! \~english Pebibytes, x1.125.899.906.842.624 (2^50)
//! \~russian Пебибайт, x1.125.899.906.842.624 (2^50)
constexpr unsigned long long operator""_PiB(unsigned long long v) {
	return v * 1024 * 1024 * 1024 * 1024 * 1024;
}


#endif
