mirror of
https://github.com/zeldaret/st
synced 2026-05-23 15:01:41 -04:00
9f1695dc6a
Co-authored-by: NEPETAISCUTE <58563578+NEPETAISCUTE@users.noreply.github.com>
17 lines
631 B
C
17 lines
631 B
C
#pragma once
|
|
|
|
#include "types.h"
|
|
|
|
/**
|
|
* Flags value format:
|
|
* - 0x001F: 0000 0000 0001 1111 -> the shift value to read or write the flag's bit
|
|
* - 0xFFE0: 1111 1111 1110 0000 -> index of the value in the array
|
|
*
|
|
* `FLAG` is a macro that allows you to get the final value from the index and the slot number.
|
|
*/
|
|
|
|
#define GET_FLAG(arr, pos) (((arr)[((u32) (pos)) >> 5] & (1 << ((pos) & 0x1F))) != 0)
|
|
#define SET_FLAG(arr, pos) ((arr)[((u32) (pos)) >> 5] |= 1 << ((pos) & 0x1F))
|
|
#define UNSET_FLAG(arr, pos) ((arr)[((u32) (pos)) >> 5] &= ~(1 << ((pos) & 0x1F)))
|
|
#define FLAG(index, pos) (((index) << 5) | ((pos) & 0x1F))
|