Removed the helper array and its initialization loop as we can achieve the
same with two variables in one loop.
This patch also removes the warning below:
> gen8_mfc.c:2735:9: warning: variable 'i' is incremented both in the loop
> header and in the loop body [-Wfor-loop-analysis]
> i++;
> ^
> gen8_mfc.c:2732:25: note: incremented here
> for (i = 0; i < 64; i++) {
> ^
Signed-off-by: Victor Toso <victortoso@redhat.com>
get_reciprocal_dword_qm(unsigned char *raster_qm, uint32_t *dword_qm)
{
int i = 0, j = 0;
- short reciprocal_qm[64];
+ short hdw, ldw;
- for (i = 0; i < 64; i++) {
- reciprocal_qm[i] = 65535 / (raster_qm[i]);
+ for (i = 0, j = 0; i < 64; i += 2, j++) {
+ hdw = 65535 / (raster_qm[i]);
+ ldw = 65535 / (raster_qm[i + 1]);
+ dword_qm[j] = (hdw << 16) | ldw;
}
-
- for (i = 0; i < 64; i++) {
- dword_qm[j] = ((reciprocal_qm[i + 1] << 16) | (reciprocal_qm[i]));
- j++;
- i++;
- }
-
}