blob: 7c28278c747974247123b5a5dd41879644d4277c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
#ifndef __BITMANIP_H__
#define __BITMANIP_H__
/// File: BitManip.h
/// Purpose: Bit manipulation helpers, based on neboot-dev.
#define bk_set_bit(X, O) X = (1 << O) | X
#define bk_clear_bit(X, O) X = ~(1 << O) & X
#define bk_toogle(X, O) X = (1 << O) ^ X
#define bk_lsb(X) X = X & -X
#define bk_msb(X) X = -(mp_lsb(X)) & X
#define bk_look_for_bit(X, O) (1 << O) | X
#endif // ifndef __BITMANIP_H__
|