Fix: Honor intEncoding: 'variant' for float f16 type#9
Open
incapdns wants to merge 30 commits into4t145:masterfrom
Open
Fix: Honor intEncoding: 'variant' for float f16 type#9incapdns wants to merge 30 commits into4t145:masterfrom
incapdns wants to merge 30 commits into4t145:masterfrom
Conversation
Removed commented sections indicating the start and end of decode and encode corrections.
Removed commented-out code for unimplemented f128 encoding.
…mproved compatibility
Update decode function to use Uint8Array instead of ArrayBuffer for i…
Refactor decode function to use ArrayBuffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here's what's happening:
f16 is treated as u16: The serde_bincode library (in the Rust backend) doesn't natively support half::f16. When you use SerdeAtomicF16, serde simply takes the raw bits of f16 and treats them as a u16.
varint is applied to u16: Because the Bincode (Rust) configuration is using variable integer encoding, it sees this u16 and applies varint logic to it.
This is why structures (that use f16) will fail: the f16 was sent as 3 bytes ([251, byte1, byte2]), but bincode-ts expected 2 bytes, which in this case was currently commented out.