Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bits: Add fromBytes #7

Merged
merged 9 commits into from
Oct 1, 2023
Merged

Bits: Add fromBytes #7

merged 9 commits into from
Oct 1, 2023

Conversation

deavmi
Copy link
Owner

@deavmi deavmi commented Oct 1, 2023

Purpose

From a byte array to given type, more clear. We call it bytesToIntegral!(toIntegralType)(ubyte).

Todo ✍️

  • Code documentation
  • Unit testing
    • On ARM BigEndian
    • On x86 LittleEndian

- Added `fromBytes`
@deavmi deavmi added the enhancement New feature or request label Oct 1, 2023
@deavmi deavmi self-assigned this Oct 1, 2023
- Renamed `fromBytes` to `bytesToIntegral`
- `bytesToIntegral` is documented
- `bytesToIntegral` now has a runtime length check
- Dicumented example
- Added unit test
- Fixed unittest
- Return `T.init` when runtime range check fails
- Made `bytesToIntegral(T)(ubyte[] bytes)` not use any stack space
@deavmi
Copy link
Owner Author

deavmi commented Oct 1, 2023

Aight, this is all done ✔️

@deavmi
Copy link
Owner Author

deavmi commented Oct 1, 2023

Aight, this is all done ✔️

I checked on ARM too (BE) all good.

- Fixed unittest
@deavmi
Copy link
Owner Author

deavmi commented Oct 1, 2023

Fixed unit tests, all good to go now ✔️

@deavmi deavmi merged commit f3fa6d2 into master Oct 1, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant