Ken Liu | 24dffb2 | 2021-02-10 11:03:58 +0800 | [diff] [blame^] | 1 | /* |
2 | * Copyright (c) 2021, Arm Limited. All rights reserved. | ||||
3 | * | ||||
4 | * SPDX-License-Identifier: BSD-3-Clause | ||||
5 | * | ||||
6 | */ | ||||
7 | #ifndef __BITOPS_H__ | ||||
8 | #define __BITOPS_H__ | ||||
9 | |||||
10 | #include <stdint.h> | ||||
11 | |||||
12 | /* Check if there is only one bit availiable in a 32bit number */ | ||||
13 | #define IS_ONLY_ONE_BIT_IN_UINT32(n) \ | ||||
14 | ((uint32_t)(n) && !((uint32_t)(n) & ((uint32_t)(n)-1))) | ||||
15 | #endif /* __BITOPS_H__ */ |