Carry a MEOS byte buffer and its length as one array - #30
Merged
estebanzimanyi merged 1 commit intoSep 3, 2026
Merged
Conversation
MEOS states the length of a buffer it answers through a pointer the caller supplies, and reads one back as a pointer and a length beside it. To a C# caller both are one array: `AsWKB` answers a `byte[]` of the length MEOS wrote, `FromWKB` takes a `byte[]` and hands MEOS its address and its own length, and the length out-parameter leaves the signature — every `size_t *` in the surface is one of these 28, and nothing else asks for one. The hex form needs no length either, the string ending where MEOS ends it, so its buffer is written and dropped. That is why `AsHEXWKB` takes only the variant it is given. The length beside an array argument is spelled `count` for an array of values and `size` for a byte buffer, and both say the same thing, so the counted-array convention reads either. A scalar element needs no gathering: what is pinned across the call is the caller's own array. 61 methods reach the object layer that way — 1232 against 1171, 63 deferred against 105. Three tests round-trip the forms: a span through its own WKB, a temporal float through its own, and a span through the hex form, each read back to the value it started as.
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.
MEOS states the length of a buffer it answers through a pointer the caller
supplies, and reads one back as a pointer and a length beside it. To a C#
caller both are one array:
AsWKBanswers abyte[]of the length MEOS wrote,FromWKBtakes abyte[]and hands MEOS its address and its own length, andthe length out-parameter leaves the signature — every
size_t *in the surfaceis one of these 28, and nothing else asks for one.
The hex form needs no length either, the string ending where MEOS ends it, so
its buffer is written and dropped. That is why
AsHEXWKBtakes only the variantit is given.
The length beside an array argument is spelled
countfor an array of valuesand
sizefor a byte buffer, and both say the same thing, so the counted-arrayconvention reads either. A scalar element needs no gathering: what is pinned
across the call is the caller's own array. 61 methods reach the object layer
that way — 1232 against 1171, 63 deferred against 105.
Three tests round-trip the forms: a span through its own WKB, a temporal float
through its own, and a span through the hex form, each read back to the value
it started as.