1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(C) 2021 Marvell. 3 */ 4 5 #ifndef _ROC_BITS_H_ 6 #define _ROC_BITS_H_ 7 8 #ifndef BIT_ULL 9 #define BIT_ULL(nr) (1ULL << (nr)) 10 #endif 11 12 #ifndef BIT 13 #define BIT(nr) (1UL << (nr)) 14 #endif 15 16 #ifndef BITS_PER_LONG 17 #define BITS_PER_LONG (__SIZEOF_LONG__ * 8) 18 #endif 19 #ifndef BITS_PER_LONG_LONG 20 #define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) 21 #endif 22 23 #ifndef GENMASK 24 #define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) 25 #endif 26 #ifndef GENMASK_ULL 27 #define GENMASK_ULL(h, l) \ 28 (((~0ULL) - (1ULL << (l)) + 1) & \ 29 (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) 30 #endif 31 32 #endif /* _ROC_BITS_H_ */ 33