Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 1.33 KB

README.md

File metadata and controls

35 lines (27 loc) · 1.33 KB

FieldFlags.jl

CI Stable CI Nightly docs-stable docs-dev codecov

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