Skip to content

Commit 1a44b31

Browse files
committed
Update core.jl
fix reduce_min identity to use typemax(T) instead of typemax(Int64) - For UInt32, typemax(UInt32) = 4294967295 fits in 32 bits - typemax(Int64) = 9223372036854775807 does not fit and caused encoding error
1 parent 68db6d2 commit 1a44b31

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/compiler/intrinsics/core.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ reduce_identity(::Val{:mul}, dtype, ::Type{T}) where T <: Integer =
702702
reduce_identity(::Val{:min}, dtype, ::Type{T}) where T <: AbstractFloat =
703703
FloatIdentityOp(+Inf, dtype, T)
704704
reduce_identity(::Val{:min}, dtype, ::Type{T}) where T <: Integer =
705-
IntegerIdentityOp(typemax(Int64), dtype, T, is_signed(T)) # Use max int as +Inf proxy
705+
IntegerIdentityOp(typemax(T), dtype, T, is_signed(T))
706706

707707
# AND identity: all bits set (x & -1 == x)
708708
reduce_identity(::Val{:and}, dtype, ::Type{T}) where T <: Integer =

0 commit comments

Comments
 (0)