blob: ea64ece7e0e8956cf523236519ec72983d3a95f8 (
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)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/nekernel-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__
|