Specify the ProcessState enum to be one byte in size, with static assert

This commit is contained in:
Imbus 2026-01-03 19:03:03 +01:00
parent 4760e1f742
commit a16f9a4900

View file

@ -5,7 +5,7 @@
#include <riscv.h> #include <riscv.h>
#include <stdint.h> #include <stdint.h>
typedef enum { typedef enum : uint8_t {
UNUSED, UNUSED,
USED, USED,
SLEEPING, SLEEPING,
@ -14,6 +14,8 @@ typedef enum {
ZOMBIE, ZOMBIE,
} ProcessState; } ProcessState;
_Static_assert(sizeof(ProcessState) == 1, "");
/** Saved registers for kernel context switches. */ /** Saved registers for kernel context switches. */
typedef struct Context { typedef struct Context {
uint64_t ra; uint64_t ra;