[util] Remove enum_bitfields

The enum_bitfields system never worked quite right, and always had edge cases where name
resolution for the SFINAE would fail. Move everything over to use util::bitset, which can
be constexpr and boils down to inline integer bitops in release mode.

Improved util::bitset itself, moving the array-backed base implementation into a new
util::sized_bitset, and making the single-inttype backed implementation the base case.
Also added a distinction between | or |= (which work with real bit values) and + or +=
(which work with bit indexes).
This commit is contained in:
Justin C. Miller
2024-02-25 23:40:14 -08:00
parent f7ea46e49e
commit 9f54927a82
36 changed files with 352 additions and 622 deletions

View File

@@ -3,7 +3,8 @@
/// Enums used as flags for syscalls
enum j6_vm_flags {
#define VM_FLAG(name, v) j6_vm_flag_ ## name = v,
j6_vm_flag_none = 0,
#define VM_FLAG(name, v) j6_vm_flag_ ## name = (1ul << v),
#include <j6/tables/vm_flags.inc>
#undef VM_FLAG
j6_vm_flag_MAX

View File

@@ -1,15 +1,13 @@
VM_FLAG( none, 0x00000000 )
VM_FLAG( write, 0 )
VM_FLAG( exec, 1 )
VM_FLAG( write, 0x00000001 )
VM_FLAG( exec, 0x00000002 )
VM_FLAG( contiguous, 4 )
VM_FLAG( large_pages, 5 )
VM_FLAG( huge_pages, 6 )
VM_FLAG( contiguous, 0x00000010 )
VM_FLAG( large_pages, 0x00000020 )
VM_FLAG( huge_pages, 0x00000040 )
VM_FLAG( write_combine, 8 )
VM_FLAG( write_combine, 0x00000100 )
VM_FLAG( mmio, 12 )
VM_FLAG( mmio, 0x00001000 )
VM_FLAG( exact, 0x00010000 )
VM_FLAG( ring, 0x00020000 )
VM_FLAG( exact, 16 )
VM_FLAG( ring, 17 )