This repository has been archived on 2024-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
kernel-dev-old/include/utils.h

17 lines
536 B
C
Raw Normal View History

#ifndef UTILS_H
#define UTILS_H 1
#include <types.h>
#define UTILS_BIT_GET(byte, bit) ((byte) & (1 << (bit)))
#define UTILS_BIT_SET(byte, bit) ((byte) |= (1 << (bit)));
#define UTILS_BIT_RESET(byte, bit) ((byte) &= ~(1 << (bit)));
#define UTILS_BITMAP_GET(map, bit) (((u8 *)(map))[bit / 8] & (1 << ((bit) % 8)))
#define UTILS_BITMAP_SET(map, bit) (((u8 *)(map))[bit / 8] |= (1 << ((bit) % 8)));
#define UTILS_BITMAP_RESET(map, bit) (((u8 *)(map))[bit / 8] &= ~(1 << ((bit) % 8)));
#define DISALIGNED __attribute__((packed))
#endif