FieldFlags.jl is a small package for declaring bitfield-like structs, without having to manually mask out bits. For more information, check out the documentation!
julia> using FieldFlags
julia> @bitfield mutable struct Foo
a:1
b:2
_:7
c:3
end
# The type only takes up 2 bytes
julia> sizeof(Foo)
2
julia> f = Foo(1,2,3)
Foo(a: true, b: 0x2, c: 0x3)
julia> f.a = 2
2
# Assignments truncate leading bits!
julia> f.a
false