summaryrefslogtreecommitdiffhomepage
path: root/include/mp-bit.h
blob: 58111a389b50e0bd26f5dd7e7a83e1bbaf317383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Distributed under the Apache Software License, Version 2.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/neboot

#ifndef __BITMANIP_H__
#define __BITMANIP_H__

/// Name: NeBoot Bits API.
/// Purpose: Bit manip helpers.

#define cb_set_bit(X, O) X = (1 << O) | X
#define cb_clear_bit(X, O) X = ~(1 << O) & X
#define cb_toogle(X, O) X = (1 << O) ^ X
#define cb_lsb(X) X = X & -X
#define cb_msb(X) X = -(cb_lsb(X)) & X

#endif  // ifndef __BITMANIP_H__