Closed ppelleti closed 3 years ago
For example, this was causing the EXIF version (tag 0x9000) to come out as "0000" instead of "0320".
Here is a test program and image which demonstrates the bug: exif-test-version.zip
The compiler was interpreting:
[fromIntegral $ ofs .&. 0xFF000000 `unsafeShiftR` (3 * 8) ,fromIntegral $ ofs .&. 0x00FF0000 `unsafeShiftR` (2 * 8) ,fromIntegral $ ofs .&. 0x0000FF00 `unsafeShiftR` (1 * 8) ,fromIntegral $ ofs .&. 0x000000FF ]
as:
[fromIntegral $ ofs .&. (0xFF000000 `unsafeShiftR` (3 * 8)) ,fromIntegral $ ofs .&. (0x00FF0000 `unsafeShiftR` (2 * 8)) ,fromIntegral $ ofs .&. (0x0000FF00 `unsafeShiftR` (1 * 8)) ,fromIntegral $ ofs .&. 0x000000FF ]
which is the same as:
[fromIntegral $ ofs .&. 0x000000FF ,fromIntegral $ ofs .&. 0x000000FF ,fromIntegral $ ofs .&. 0x000000FF ,fromIntegral $ ofs .&. 0x000000FF ]
i. e. repeating the last byte four times.
For example, this was causing the EXIF version (tag 0x9000) to come out as "0000" instead of "0320".
Here is a test program and image which demonstrates the bug: exif-test-version.zip
The compiler was interpreting:
as:
which is the same as:
i. e. repeating the last byte four times.