kolmodin / binary

Efficient, pure binary serialisation using ByteStrings in Haskell.
Other
105 stars 67 forks source link

Use unsafe shifts from base rather than hand-rolling #178

Closed Ericson2314 closed 3 years ago

Ericson2314 commented 3 years ago

This is a companion to https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4492.

I'm not sure why the second-to-top commit isn't already merged, as ghc HEAD relies on it.

CC @bgamari

bgamari commented 3 years ago

@Ericson2314, this was an oversight on my part; thanks for doing this!

Can we get this merged, @kolmodin?

Ericson2314 commented 3 years ago

https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4492 is now just blocked on upstream libraries approving these PRs. (The current rebuild as I write this is just from me changing the a changeg log message.)

Ericson2314 commented 3 years ago

According to https://github.com/haskell/bytestring/pull/326 these manual unboxed shifts for static shit amounts are no longer needed at all.

Ericson2314 commented 3 years ago

And even better, base within the version range supported, always provides the very unsafe shifts we want!

Ericson2314 commented 3 years ago

@kolmodin Can we merge this? It no longer makes any assumptions about the state of 9.2. As you can see in the description of https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4492, some of the others have gotten merged.

bgamari commented 3 years ago

Pinging @kolmodin?

bgamari commented 3 years ago

Looks good. The base bound is already >= 4.5.0.0 so it looks like this is good to go.