diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f0dc5d..45fd31a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: - macOS-14 arch: - x64 + - x86 # Test - aarch64 exclude: - os: ubuntu-latest @@ -37,6 +38,10 @@ jobs: arch: x64 - os: macOS-14 version: '1.6' + - os: macOS-14 + arch: x86 + - os: macOS-13 + arch: x86 steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 diff --git a/src/codec/Codecs.jl b/src/codec/Codecs.jl index e4c01af..aa1f405 100644 --- a/src/codec/Codecs.jl +++ b/src/codec/Codecs.jl @@ -15,7 +15,7 @@ ProtoDecoder(io::IO) = ProtoDecoder(io, eof) struct LengthDelimitedProtoDecoder{I<:IO} <: AbstractProtoDecoder io::I - endpos::Int + endpos::Int64 end message_done(d::LengthDelimitedProtoDecoder) = d.endpos == position(d.io) diff --git a/src/codec/decode.jl b/src/codec/decode.jl index 3f32bb8..fec322d 100644 --- a/src/codec/decode.jl +++ b/src/codec/decode.jl @@ -189,6 +189,7 @@ end function decode(d::AbstractProtoDecoder, ::Type{Ref{T}}) where {T} bytelen = vbyte_decode(d.io, UInt32) endpos = bytelen + position(d.io) + endpos = convert(Int64, endpos) out = decode(LengthDelimitedProtoDecoder(d.io, endpos), T) @assert position(d.io) == endpos return out diff --git a/test/test_perf.jl b/test/test_perf.jl index b68de22..9f979fb 100644 --- a/test/test_perf.jl +++ b/test/test_perf.jl @@ -26,10 +26,10 @@ vbyte_decode(io, UInt64) @test_noalloc vbyte_encode(io, typemax(UInt32)) seekstart(io) -@test @allocated(vbyte_decode(io, UInt32)) == 16 +@test @allocated(vbyte_decode(io, UInt32)) <= 16 # 32 Bit systems require fewer allocations @test_noalloc vbyte_encode(io, typemax(UInt64)) seekstart(io) -@test @allocated(vbyte_decode(io, UInt64)) == 16 +@test @allocated(vbyte_decode(io, UInt64)) <= 16 # 32 Bit systems require fewer allocations @enumx TestEnum DEFAULT=0 OTHER=1 diff --git a/test/test_protojl.jl b/test/test_protojl.jl index 6952c39..2dc32ff 100644 --- a/test/test_protojl.jl +++ b/test/test_protojl.jl @@ -187,7 +187,7 @@ end typemax(UInt32), typemax(UInt64), EmptyMessage(), - NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, 1), nothing), OneOf(:y, 2), nothing), + NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, Int64(1)), nothing), OneOf(:y, Int64(2)), nothing), OneOf(:oneof_uint32_field, typemax(UInt32)), [UInt8[0xff]], @@ -206,8 +206,8 @@ end [typemax(UInt64)], [EmptyMessage()], [ - NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, 3), nothing), OneOf(:y, 4), nothing), - NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, 3), nothing), OneOf(:y, 4), CoRecursiveMessage(nothing)), + NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, Int64(3)), nothing), OneOf(:y, Int64(4)), nothing), + NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, Int64(3)), nothing), OneOf(:y, Int64(4)), CoRecursiveMessage(nothing)), ], Dict("K" => UInt8[0xff]), @@ -226,8 +226,8 @@ end Dict("K" => typemax(UInt64)), Dict("K" => EmptyMessage()), Dict( - "K1" => NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, 5), nothing), OneOf(:y, 6), nothing), - "K2" => NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, 5), nothing), OneOf(:y, 6), CoRecursiveMessage(nothing)), + "K1" => NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, Int64(5)), nothing), OneOf(:y, Int64(6)), nothing), + "K2" => NonEmptyMessage(typemax(UInt32), NonEmptyMessage(typemax(UInt32), nothing, OneOf(:y, Int64(5)), nothing), OneOf(:y, Int64(6)), CoRecursiveMessage(nothing)), ), @@ -302,9 +302,9 @@ using ProtoBuf end test_dictionary = Dict{String, Int64}( - "field1"=>1, - "field2"=>-5, - "field3"=>120, + "field1"=>Int64(1), + "field2"=>Int64(-5), + "field3"=>Int64(120), ) dict_message = Map(test_dictionary)