Is there a nicer way of implementing this? Perhaps without hardcoding UInts of specific sizes?
# Inverse sizeof, basically.
of_exact_size(::Val{1}) = UInt8
of_exact_size(::Val{2}) = UInt16
of_exact_size(::Val{4}) = UInt32
of_exact_size(::Val{8}) = UInt64
of_exact_size(::Val{16}) = UInt128
# Returns the smallest unsigned integer type not narrower than
# min_width.
#
# There's no dynamic dispatch according to JET.jl, at least with Julia
# 1.8.
of_size(::Val{min_width}) where {min_width} =
of_exact_size(Val(nextpow(2, min_width)))