Skip to content

Comments

Bluetooth Serializer#914

Merged
Daeda88 merged 50 commits intofeature/bluetooth-serverfrom
feature/bluetooth-serializer
Jan 30, 2026
Merged

Bluetooth Serializer#914
Daeda88 merged 50 commits intofeature/bluetooth-serverfrom
feature/bluetooth-serializer

Conversation

@Daeda88
Copy link
Contributor

@Daeda88 Daeda88 commented Nov 27, 2025

Creates custom serialization logic to be used with Bluetooth. This allows us to easily set up what a Device communicates, removing need for manual byte processing.

@ci-splendo
Copy link
Contributor

ci-splendo commented Nov 27, 2025

Code coverage

Total Project Coverage 35.91%

@thoutbeckers thoutbeckers self-assigned this Jan 16, 2026
Copy link
Collaborator

@thoutbeckers thoutbeckers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

managed to put pretty much all comments in the parent PR

*/
fun Int.length() = when (this) {
0 -> 1
else -> log10(abs(toDouble())).toInt() + 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat of a rabbit hole on what is actually faster then this, I suspected it can be done by counting leading zeros in the binary. Turns out you can indeed do that combined with a precaculated jump table.

https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/blob/master/2021/06/03/digitcount.c

via

https://code-maze.com/csharp-whats-the-best-way-to-count-the-number-of-digits-in-a-number/

However in that same post in C# anyway this method comes pretty close to it.

@Daeda88 Daeda88 merged commit f06bd14 into feature/bluetooth-server Jan 30, 2026
4 checks passed
@Daeda88 Daeda88 deleted the feature/bluetooth-serializer branch January 30, 2026 09:37
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.

3 participants