I have defined my own primitive type as below which works.
import Base: >>, <<
primitive type UInt24 24 end
>>(x::UInt24, y) = Base.lshr_int(x, y)
<<(x::UInt24, y) = Base.shl_int(x, y)
I then tried to define a masking operation using & the below works pretty well but I can’t figure out how to define my own bits e.g. if I want to set z = 0xffffff it turns z into UInt32 with 0x00ffffff. But I want 24 bits of 1’s. How can I acheive that? Or more generally how do I define arbitrary bit patters for my new type. Help appreciated! This will help make a much faster string sorting algorithm in pure Julia!
x = unsafe_load(Ptr{UInt24}(pointer("abc")))
y = unsafe_load(Ptr{UInt24}(pointer("def")))
Base.and_int(x,y)