Skip to content

feat: wire helpers (byte order, UTF-8, IsNumber, MaxASCII, MaxInt32) - #32

Merged
Snider merged 2 commits into
mainfrom
feat/wire-helpers
Nov 24, 2026
Merged

Snider merged 2 commits into
mainfrom
feat/wire-helpers

Conversation

@Snider

@Snider Snider commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The binary-parsing helpers GrootDPS's packet decoder needs: LittleEndianUint16/32, BigEndianUint16, AppendLittleEndianUint16/32, UTF8Valid, UTF8ValidString, IsNumber, MaxASCII, MaxInt32. Inlining one-liners in the owner files (encode.go, string.go, unicode.go, math.go). Good/Bad/Ugly + examples; passes on Windows too.

🤖 Generated with Claude Code
Co-Authored-By: Virgil virgil@lethean.io

Summary by CodeRabbit

  • New Features
    • Added helpers for reading and appending little-endian values, plus reading big-endian 16-bit values.
    • Added UTF-8 validation helpers for strings and byte sequences.
    • Added constants for the maximum 32-bit integer and ASCII value, and a helper for identifying Unicode numbers.
  • Tests
    • Added examples and tests covering byte order, UTF-8 validation, Unicode number checks and edge cases.

…[String], IsNumber, MaxASCII, MaxInt32

What GrootDPS's packet parser reaches for in encoding/binary, unicode/utf8,
unicode and math. One-line wrappers that inline to the direct call, so the
hot path pays nothing. Good/Bad/Ugly tests and an example each.

Co-Authored-By: Virgil <virgil@lethean.io>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The change adds binary encoding and decoding helpers, UTF-8 validation helpers, the MaxInt32 and MaxASCII constants, and the IsNumber wrapper. Tests and examples cover the new APIs.

Changes: Utility APIs

Layer / File(s) Summary
Binary encoding and decoding helpers
encode.go, encode_test.go, encode_example_test.go
Adds little-endian 16-bit and 32-bit readers, a big-endian 16-bit reader, and append-style little-endian writers. Tests and examples cover byte order, short inputs, appended values and expected outputs.
UTF-8 validation helpers
string.go, string_test.go, string_example_test.go
Adds byte-slice and string validation helpers. Tests and examples cover valid, invalid and empty inputs.
Numeric constants and rune classification
math.go, unicode.go, unicode_test.go, unicode_example_test.go
Adds MaxInt32, MaxASCII and IsNumber. Tests and an example cover rune classification.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ms sleep (Windows timer resolution)

Co-Authored-By: Virgil <virgil@lethean.io>
@Snider
Snider merged commit 3884824 into main Nov 24, 2026
2 checks passed
@Snider
Snider deleted the feat/wire-helpers branch November 24, 2026 14:00
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant