Skip to content

Commit 072ebbc

Browse files
committed
Minor code clean-up.
1 parent 546efdb commit 072ebbc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/imageio/imageio_pfm.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ dt_imageio_retval_t dt_imageio_open_pfm(dt_image_t *img,
133133
for_three_channels(c)
134134
{
135135
value.as_float = readbuf[3 * (target_row * img->width + column) + c];
136-
if(swap_byte_order) value.as_int = GUINT32_SWAP_LE_BE(value.as_int);
136+
if(swap_byte_order)
137+
value.as_int = GUINT32_SWAP_LE_BE(value.as_int);
137138
pix[c] = value.as_float;
138139
}
139140
copy_pixel_nontemporal(&buf[4 * (img->width * row + column)], pix);
@@ -148,10 +149,11 @@ dt_imageio_retval_t dt_imageio_open_pfm(dt_image_t *img,
148149
const size_t target_row = made_by_photoshop ? row : img->height - 1 - row;
149150
for(size_t column = 0; column < img->width; column++)
150151
{
152+
const size_t idx = img->width * row + column;
151153
value.as_float = readbuf[target_row * img->width + column];
152-
if(swap_byte_order) value.as_int = GUINT32_SWAP_LE_BE(value.as_int);
153-
buf[4 * (img->width * row + column) + 2] = buf[4 * (img->width * row + column) + 1]
154-
= buf[4 * (img->width * row + column) + 0] = value.as_float;
154+
if(swap_byte_order)
155+
value.as_int = GUINT32_SWAP_LE_BE(value.as_int);
156+
buf[4 * idx + 2] = buf[4 * idx + 1] = buf[4 * idx + 0] = value.as_float;
155157
}
156158
}
157159
}

0 commit comments

Comments
 (0)