[GHC] #11143: Feature request: Add index/read/write primops with byte offset for ByteArray#
GHC
ghc-devs at haskell.org
Thu Feb 22 18:37:38 UTC 2018
#11143: Feature request: Add index/read/write primops with byte offset for
ByteArray#
-------------------------------------+-------------------------------------
Reporter: vagarenko | Owner: sjakobi
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords: newcomers
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4433
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by vagarenko):
Replying to [comment:10 sjakobi]:
> Replying to [comment:9 vagarenko]:
> > Replying to [comment:8 sjakobi]:
> > > * They relieve the user from doing the byte offset computation.
> > Then what does that `Int# {-byte offset-}` parameter mean?
>
> What I meant is that the user doesn't need to compute the total offset.
While a user may use the API you proposed like
> {{{#!hs
> indexByteInt16Array# ba (byte_offset + type_offset * int16_size)
>
> }}}
I still don't understand. What is total offset? What are `byte_offset` and
`type_offset`?
By `byte_offset` you mean number of bytes from the start of the array `ba`
to the sought value of type `Int#`, correct?
Then what is `type_offset`? Number of `Int16` elements before the sought
element? But my motivation for this ticket was to be able to store values
of different types in a `ByteArray#`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11143#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list