After you allocate the newValues buffer, fill the buffer with the desired element value for each element in the specified range, in row-major order. For each element to be modified, fill the buffer as follows:
- The first 4 bytes should describe the size of the data. This is only applicable for variable-length element data types.
- The remaining bytes allocated for each element are allocated to hold the maximum size of the element data type. This space should contain the new element value.
Therefore, for each element, space is allocated as:
- (MAX_SIZE_OF_ELEMENT_DATA_TYPE + 4 bytes) for variable-length element data types.
- (MAX_SIZE_OF_ELEMENT_DATA_TYPE) for fixed-length data types.