units.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 ML!PA Consulting GmbH
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
28 #define KiB(x) ((unsigned long)(x) << 10)
29 
33 #define MiB(x) (KiB(x) << 10)
34 
38 #define GiB(x) ((unsigned long long)MiB(x) << 10)
39 
43 #define KHZ(x) ((x) * 1000UL)
44 
48 #define MHZ(x) (KHZ(x) * 1000UL)
49 
53 #define GHZ(x) (MHZ(x) * 1000ULL)
54 
55 #ifdef __cplusplus
56 }
57 #endif
58