Unaligned word-sized reads on ByteArray#
johan.tibell at gmail.com
Tue Oct 26 01:21:28 EDT 2010
On Sun, Oct 24, 2010 at 2:02 AM, Johan Tibell <johan.tibell at gmail.com> wrote:
> I noticed that indexWordArray# only allows for aligned reads (by
> forcing the offset to be in words, rather than in bytes.) Is it
> possible to perform unaligned reads on a ByteArray# e.g. going via
> Addr#? There's the byteArrayContent# primitive but I don't know how to
> force the ByteArray# to stay pinned in memory while performing my
> reads. The ByteArray# is not guaranteed to be pinned in my case.
It seems like I should be able to use (the undocumented) touch#
function to achieve this. Is that the case?
More information about the Glasgow-haskell-users