Skip to content

Commit

Permalink
initialize with zero(basetype), no need to update lo (#29453)
Browse files Browse the repository at this point in the history
  • Loading branch information
kindlychung committed May 9, 2022
1 parent d5b95c7 commit 99455c9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions base/Enums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ macro enum(T::Union{Symbol,Expr}, syms...)
values = Vector{basetype}()
seen = Set{Symbol}()
namemap = Dict{basetype,Symbol}()
lo = hi = 0
i = zero(basetype)
lo = hi = i = zero(basetype)
hasexpr = false

if length(syms) == 1 && syms[1] isa Expr && syms[1].head === :block
Expand Down Expand Up @@ -193,7 +192,6 @@ macro enum(T::Union{Symbol,Expr}, syms...)
if length(values) == 1
lo = hi = i
else
lo = min(lo, i)
hi = max(hi, i)
end
i += oneunit(i)
Expand Down

0 comments on commit 99455c9

Please sign in to comment.