[GHC] #11143: Feature request: Add index/read/write primops with byte offset for ByteArray#
GHC
ghc-devs at haskell.org
Thu Feb 22 22:10:02 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 sjakobi):
Replying to [comment:11 vagarenko]:
> I 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#`.
Yes, sorry for my lack of clarity and thanks for putting it in a nutshell!
What I assume is [comment:2 Mathnerd314]'s motivation is that even when a
`ByteArray#` contains several types, it may contain a sequence of values
of the same type.
For example you may want to serialize a vector of `Int32`s by first
writing the length of the vector as a `Word64` followed by the values.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11143#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list