By using bitstype, you can define a
concrete type with given number of bits in size.
Synatx
bitstype noOfBits newType
bitstype noOfBits newType <: parentType
noOfBits: Number of bits of storage for given
type. It should be multiple of 8.
newType:
Name of the type
parentType:
Specifies the parent
type of given type
julia> bitstype 8 noOfDays <: Integer julia> show(x::noOfDays) = print("noOfDays($(reinterpret(Int32,x)))") show (generic function with 1 method) julia> reinterpret(noOfDays, Int8(123)) noOfDays(0x7b)
No comments:
Post a Comment