[Haskell-cafe] ANN: reinterpret-cast - byte-casting word-size numbers
mail at nh2.me
Wed Apr 30 15:28:04 UTC 2014
Announcing the first version of the reinterpret-cast package:
Takes the bit representation of a number and uses it for a different
numeric type. This is reinterpret_cast from C++ and float f = 1.23; int
i = * (int *) &f; from C.
I started writing this because the PointCloudLibrary project (PCL) makes
RGB colours available as an int-packed format cast to a float value -
that's silly but oh the legacy. I was surprised that fast reinterpret
casts are not readily available in base or at least GHC, but there are
improvements going on (see links in the README). Meanwhile this package
is for dealing with it.
The way implemented here is the fastest possible way known to me as of
now. In particular, it is faster than what data-binary-ieee754 does at
Contributions are very welcome.
More information about the Haskell-Cafe