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 
19 #ifndef MACROS_UNITS_H
20 #define MACROS_UNITS_H
21 
22 #ifdef __cplusplus
23  extern "C" {
24 #endif
25 
29 #define KiB(x) ((unsigned long)(x) << 10)
30 
34 #define MiB(x) (KiB(x) << 10)
35 
39 #define GiB(x) ((unsigned long long)MiB(x) << 10)
40 
44 #define KHZ(x) ((x) * 1000UL)
45 
49 #define MHZ(x) (KHZ(x) * 1000UL)
50 
54 #define GHZ(x) (MHZ(x) * 1000ULL)
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* MACROS_UNITS_H */
61