Skip to content

Commit

Permalink
Update struct.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas authored Feb 22, 2024
1 parent 89d34b6 commit 89dccfe
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/struct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ function encodetyp(::Type{T}) where {T}
end

function decodetyp(typ::TypeT)
siz = TypeT(8) * (typ >> SIZE_OFFSET)
_size = TypeT(8) * (typ >> SIZE_OFFSET)
if !iszero(typ & (TypeT(1) << ISINTEGER))
if !iszero(typ & TypeT(1) << SIGNED_OFFSET)
siz == 8 ? Int8 :
siz == 16 ? Int16 :
siz == 32 ? Int32 :
siz == 64 ? Int64 :
_size == 8 ? Int8 :
_size == 16 ? Int16 :
_size == 32 ? Int32 :
_size == 64 ? Int64 :
error("invalid type $(typ)!")
else # unsigned
siz == 8 ? UInt8 :
siz == 16 ? UInt16 :
siz == 32 ? UInt32 :
siz == 64 ? UInt64 :
_size == 8 ? UInt8 :
_size == 16 ? UInt16 :
_size == 32 ? UInt32 :
_size == 64 ? UInt64 :
error("invalid type $(typ)!")
end
else # float
siz == 16 ? Float16 :
siz == 32 ? Float32 :
siz == 64 ? Float64 :
_size == 16 ? Float16 :
_size == 32 ? Float32 :
_size == 64 ? Float64 :
error("invalid type $(typ)!")
end
end
Expand Down

0 comments on commit 89dccfe

Please sign in to comment.