regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / wsutil / pow2.h
blob1555f3c45b959767b7b60fc207dbff7b869be42b
1 /** @file
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #ifndef __WS_POW2_H__
11 #define __WS_POW2_H__
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).
17 * The first argument is the type of the desired result; the second
18 * argument is M.
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)))
29 #endif /* __WS_POW2_H__ */