-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Binary endianness safety #41
Comments
Hello again 🙂 Seems you already made some local changes... would you kindly help the project with a PR of your changes? It will be a great addition to the library. |
Sure, I will address #40 in my PR too. |
Sounds great! Looking forward to it 🙂 |
This was closed by fd6ae39 |
Hi,
The class
ByteIntegerConverter
have methods likeLoadLittleEndian32
andStoreLittleEndian32
which is not checking for system endianness (which is not guaranteed to be little-endian in .NET). In the old .NET days, we were checkingSystem.BitConverter.IsLittleEndian
field to finding out system endianness and reversing the bytes to achieve the endianness that we were looking for, but in this modern .NET age we should consider usingSystem.Buffers.BinaryPrimitives
class (my benchmarks showed me it is significantly faster than bitwise operations like<<
and||
since it takes advantage of CPU instructions likerotl
androtr
on X86 machines).The text was updated successfully, but these errors were encountered: