ch-robinson / dotnet-avro

An Avro implementation for .NET
https://engineering.chrobinson.com/dotnet-avro/
MIT License
135 stars 51 forks source link

Support `nint` and `nuint` types #140

Closed dstelljes closed 2 years ago

dstelljes commented 3 years ago

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nint-nuint

the-chieftain commented 3 years ago

Does it make sense to support native integer types for storage? For example, if a 32-bit system serialises an 'nint' then what type does a 64-bit system deserialise it as?

dstelljes commented 3 years ago

Avro encodes all integers as variable-length, so the encoding would be identical. The library has always been pretty lax about what types to map to integral schemas:

Integers are zig-zag encoded, so they take up as much space as they need. For that reason, Chr.Avro imposes no constraints on which numeric types can be serialized or deserialized to "int" or "long"—if a conversion exists, the binary serializer and deserializer will use it.

the-chieftain commented 3 years ago

That makes sense.. I saw the open bug on serialising long values which ties it all together.

dstelljes commented 2 years ago

Released in 8.0.0-rc.0.