haskell / primitive

This package provides various primitive memory-related operations.
Other
114 stars 58 forks source link

Add unaligned reads from primitive-unaligned #355

Closed oberblastmeister closed 1 year ago

oberblastmeister commented 2 years ago

On architectures that support unaligned reads should you still use readUnalignedByteArray or can you just read normally? Should you always use the unaligned variants if there is a possibility that the index is not aligned?

andrewthad commented 2 years ago

What are you referring to when you say "read normally"? There's no way to make readByteArray (from primitive) perform an unaligned read.

oberblastmeister commented 2 years ago

Yeah I somehow got confused. I guess I was thinking about something like memcpy where it is cross platform but readUnalignedByteArray will fail on some architectures?

andrewthad commented 1 year ago

Closing since I'm not certain what this issue is asking for. The issue title is a request for a change to the library, but the body of the issue is questions about how GHC works. Open a new issue if there's still something actionable you'd like to see done.