2011-08-29 14:37:47 +10:00
|
|
|
/*
|
2018-08-04 15:14:06 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2011-08-29 14:37:47 +10:00
|
|
|
*
|
2012-04-23 13:06:41 +10:00
|
|
|
* Copyright 2011 Danny Robson <danny@nerdcruft.net>
|
2011-08-29 14:37:47 +10:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "si.hpp"
|
|
|
|
|
|
|
|
uintmax_t to_KiB (uintmax_t bytes) { return bytes >> 10; }
|
|
|
|
uintmax_t to_MiB (uintmax_t bytes) { return bytes >> 20; }
|
|
|
|
uintmax_t to_GiB (uintmax_t bytes) { return bytes >> 30; }
|
|
|
|
|
|
|
|
uintmax_t from_KiB (uintmax_t bytes) { return bytes << 10; }
|
|
|
|
uintmax_t from_MiB (uintmax_t bytes) { return bytes << 20; }
|
|
|
|
uintmax_t from_GiB (uintmax_t bytes) { return bytes << 30; }
|
|
|
|
|