blob: ed3ddd9e5e6d9cf6df8f7c33a07ffe51d8fb629c [file] [log] [blame]
Ken Liu24dffb22021-02-10 11:03:58 +08001/*
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__ */