marrus-sh / jelli

A game engine! Currently being developed.
MIT License
1 stars 0 forks source link

Data subarrays #66

Open marrus-sh opened 8 years ago

marrus-sh commented 8 years ago

This requires support for Data arrays which can start in the middle of a byte.

marrus-sh commented 8 years ago

(taken from the Data documentation):

Because the unit boundaries of Data arrays do not always line up with the byte boundaries of an ArrayBuffer, it is not possible to ensure that a new Data array can be created on the same ArrayBuffer store. For example, for a 6-bit Data object with the following binary data:

    000000 000101 000001

…this would be stored in a 32-bit array as:

    (00000000000000)000000000101000001

…which would then be broken up into the following ArrayBuffer bytes:

    00000000 00000000 00000001 01000001

As you can see, creating a new view on this ArrayBuffer which starts on the second unit of 6-bit data is not easily feasible, making subarray implementation difficult.