Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

pow2.h
1 /* ws_pow2.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10 #ifndef __WS_POW2_H__
11 #define __WS_POW2_H__
12
13 /*
14 * Macros to calculate pow2^M, for various power-of-2 values and positive
15 * integer values of M. That's (2^N)^M, i.e. 2^(N*M).
16 *
17 * The first argument is the type of the desired result; the second
18 * argument is M.
19 */
20 #define pow2(type, m) (((type)1U) << (m))
21 #define pow4(type, m) (((type)1U) << (2*(m)))
22 #define pow8(type, m) (((type)1U) << (3*(m)))
23 #define pow16(type, m) (((type)1U) << (4*(m)))
24 #define pow32(type, m) (((type)1U) << (5*(m)))
25 #define pow64(type, m) (((type)1U) << (6*(m)))
26 #define pow128(type, m) (((type)1U) << (7*(m)))
27 #define pow256(type, m) (((type)1U) << (8*(m)))
28
29 #endif /* __WS_POW2_H__ */