SE
FieldFlags.jl
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
falseOn this page
Languages
Julia100.0%
Contributors
MIT License
Created March 29, 2023
Updated June 13, 2025