units.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 ML!PA Consulting GmbH
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
25 #define KiB(x) ((unsigned long)(x) << 10)
26 
30 #define MiB(x) (KiB(x) << 10)
31 
35 #define GiB(x) ((unsigned long long)MiB(x) << 10)
36 
40 #define KHZ(x) ((x) * 1000UL)
41 
45 #define MHZ(x) (KHZ(x) * 1000UL)
46 
50 #define GHZ(x) (MHZ(x) * 1000ULL)
51 
52 #ifdef __cplusplus
53 }
54 #endif
55