Skip to content

Commit 7d50fae

Browse files
dfa1claude
andcommitted
docs: native structs use named StructLayout + VarHandle, no magic offsets
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 29a8e8a commit 7d50fae

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Built `.dylib/.so/.dll` are git-ignored; they are regenerated from the submodule
4040
- Native pointers wrap in `NativeObject` (`AutoCloseable`, idempotent close).
4141
- All native handles live in `Bindings`; `size_t`/`unsigned long long` map to
4242
`JAVA_LONG`. Public methods guard zstd's negative sentinels.
43+
- Native structs: model the layout as a named `StructLayout` and access fields
44+
through `static final VarHandle`s from it (`LAYOUT.varHandle(groupElement("…"))`),
45+
deriving size from `LAYOUT.byteSize()`. No hardcoded offsets/sizes — see
46+
`ZstdStreamBuffer`.
4347
- API is **segment-first for the zero-copy fast path, with thin `byte[]`
4448
overloads** for heap callers. Never allocate a `byte[]` for decode output on a
4549
hot path — see [docs/zero-copy.md](docs/zero-copy.md).

0 commit comments

Comments
 (0)