diff --git a/base/ryu/shortest.jl b/base/ryu/shortest.jl index 21ef2e8c02e85a..53ab1d61a809a9 100644 --- a/base/ryu/shortest.jl +++ b/base/ryu/shortest.jl @@ -365,10 +365,10 @@ end c1 = (c ÷ 100) << 1 d0 = (d % 100) << 1 d1 = (d ÷ 100) << 1 - memcpy(ptr, pos + olength - 2, ptr2, c0 + 1, 2) - memcpy(ptr, pos + olength - 4, ptr2, c1 + 1, 2) - memcpy(ptr, pos + olength - 6, ptr2, d0 + 1, 2) - memcpy(ptr, pos + olength - 8, ptr2, d1 + 1, 2) + memcpy(ptr, pos + olength - 2, ptr2, (c0 + 1)::UInt, 2) + memcpy(ptr, pos + olength - 4, ptr2, (c1 + 1)::UInt, 2) + memcpy(ptr, pos + olength - 6, ptr2, (d0 + 1)::UInt, 2) + memcpy(ptr, pos + olength - 8, ptr2, (d1 + 1)::UInt, 2) i += 8 end output2 = output % UInt32 @@ -377,14 +377,14 @@ end output2 = div(output2, UInt32(10000)) c0 = (c % 100) << 1 c1 = (c ÷ 100) << 1 - memcpy(ptr, pos + olength - i - 2, ptr2, c0 + 1, 2) - memcpy(ptr, pos + olength - i - 4, ptr2, c1 + 1, 2) + memcpy(ptr, pos + olength - i - 2, ptr2, (c0 + 1)::UInt, 2) + memcpy(ptr, pos + olength - i - 4, ptr2, (c1 + 1)::UInt, 2) i += 4 end if output2 >= 100 c = (output2 % UInt32(100)) << 1 output2 = div(output2, UInt32(100)) - memcpy(ptr, pos + olength - i - 2, ptr2, c + 1, 2) + memcpy(ptr, pos + olength - i - 2, ptr2, (c + 1)::UInt, 2) i += 2 end if output2 >= 10 diff --git a/base/strings/string.jl b/base/strings/string.jl index 1ebb85ff78dd22..e0b2e4a2829716 100644 --- a/base/strings/string.jl +++ b/base/strings/string.jl @@ -92,7 +92,7 @@ String(s::CodeUnits{UInt8,String}) = s.s ## low-level functions ## pointer(s::String) = unsafe_convert(Ptr{UInt8}, s) -pointer(s::String, i::Integer) = pointer(s)+(i-1) +pointer(s::String, i::Integer) = pointer(s) + (i - 1)::Integer @pure ncodeunits(s::String) = Core.sizeof(s) codeunit(s::String) = UInt8