real-logic / simple-binary-encoding

Simple Binary Encoding (SBE) - High Performance Message Codec
Apache License 2.0
3.12k stars 524 forks source link

[Rust] BUG sbe-tool calculate wrong NULL value for uint64 fields #1025

Open wbprime opened 1 week ago

wbprime commented 1 week ago

In PrimitiveValue, SBE uint64 value were represented using long type, leading to NULL value of uint64 (which is 2^64^ -1) output as -1.

This is observed in generated Rust code, and might also exists in other lang generated code.

Example:

 <type name="Fixed16u64" description="Array of 16 u64" length="16" primitiveType="uint64" />

<field name="fixed16u64" id="34" type="Fixed16u64"/>

Will generate something in Rust like:

        /// primitive array field 'fixed16u64'
        /// - min value: 0
        /// - max value: -2
        /// - null value: -1
        /// - characterEncoding: null
        /// - semanticType: null
        /// - encodedOffset: 464
        /// - encodedLength: 128
        /// - version: 0
        #[inline]
        pub fn fixed_16_u64(&mut self, value: &[u64; 16]) {

The generated null value in commets was -1.