[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

@@ -94,7 +94,7 @@ load_image(image_list::item_type &img, j6::proto::vfs::client &vfs)
// TODO: way to remap VMA as read-only if there's no write flag on
// the segment
unsigned long flags = j6_vm_flag_exact | j6_vm_flag_write;
if (seg.flags && elf::segment_flags::exec)
if (seg.flags.get(elf::segment_flags::exec))
flags |= j6_vm_flag_exec;
uintptr_t start = file.base() + seg.offset;

View File

@@ -3,7 +3,6 @@
/// Data structure for dealing with j6romfs images
#include <util/counted.h>
#include <util/enum_bitfields.h>
namespace j6romfs
{

View File

@@ -95,7 +95,7 @@ load_program_into(j6_handle_t proc, elf::file &file, uintptr_t image_base, const
// TODO: way to remap VMA as read-only if there's no write flag on
// the segment
unsigned long flags = j6_vm_flag_write;
if (seg.flags && elf::segment_flags::exec)
if (seg.flags.get(elf::segment_flags::exec))
flags |= j6_vm_flag_exec;
uintptr_t start = file.base() + seg.offset;