There are two vectors of different but related sizes. The larger (2 * RESOLUTION) + INDEX_OFFSET (e.g., 2050), the less simply RESOLUTION (e.g., 1024). I believe this is safe enough to suggest that uint16_t can be used to store a vector index.
Iteration through a larger vector is performed by increasing resultIndex by 2. During each iteration, assignment to a smaller vector in the index (resultIndex - INDEX_OFFSET) / 2 .
In fact, the code is based on the assumption that if INDEX_OFFSET is odd or even, the specified division by 2 will always be rounded down, regardless of architecture. For example, if resultIndex is 0 or 1, then 0 is expected, if it is 2 or 3, then 1 is expected, and so on. Is this a safe assumption within the parameters above?
NB I acknowledge the existence of "Separation of integer types - are the results predictable?" but this does not seem to be an exact match.
source share