We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4b1a1b commit e975580Copy full SHA for e975580
1 file changed
src/NarrowTuple.jl
@@ -136,10 +136,6 @@ function field_bitwidths(::Type{Ts}) where Ts<:Tuple
136
return map(T -> Int(bitwidth(T)), fieldtypes(Ts))
137
end
138
139
-function bitwidth(::Type{Ts}) where Ts<:Tuple
140
- return sum(field_bitwidths(Ts); init=0)
141
-end
142
-
143
function exact_unsigned_type(total_bits::Int)
144
total_bits == 8 ? UInt8 :
145
total_bits == 16 ? UInt16 :
@@ -155,7 +151,7 @@ function narrow_storage_type(total_bits::Int)
155
151
156
152
157
153
function narrow_storage_type(::Type{Ts}) where Ts<:Tuple
158
- return narrow_storage_type(bitwidth(Ts))
154
+ return narrow_storage_type(sum(field_bitwidths(Ts); init=0))
159
160
161
function narrow_mask(::Type{U}, width::Int) where U<:Unsigned
0 commit comments