19 lines
647 B
C++
19 lines
647 B
C++
/*
|
|
* 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/.
|
|
*
|
|
* Copyright 2011 Danny Robson <danny@nerdcruft.net>
|
|
*/
|
|
|
|
#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; }
|
|
|