AndrasKovacs / flatparse

Fast parsing from bytestrings
MIT License
146 stars 12 forks source link

Check for architectures that don't support unaligned reads? #24

Open oberblastmeister opened 2 years ago

oberblastmeister commented 2 years ago

I think there are some unaligned reads here, and some architectures don't support them.

AndrasKovacs commented 2 years ago

Do you know perhaps how to check for architectures? I searched just now and didn't find out.

It makes sense to do it, but I'd consider it very low priority. Backends without unaligned access are extremely niche. Some searching turned up SPARC as the only such official backend.

oberblastmeister commented 2 years ago

bytestring does this https://github.com/haskell/bytestring/blob/master/Data/ByteString/Short/Internal.hs#L22

AndrasKovacs commented 2 years ago

Thanks!

raehik commented 7 months ago

GHC 9.10 will be coming with (read|write)Word8OffAddrAs<ty> primops, which will handle unalignment on platforms that don't support it! (This isn't news to oberblastmeister because they wrote it! but I only just learned and it's gonna be super handy for some of my own code! thanks!!)