
On 01/23/2013 12:47 PM, Nikita Kiryanov wrote:
Hi Albert,
On 01/22/2013 09:37 AM, Albert ARIBAUD wrote:
Hi Nikita,
[...]
Note that if the user address is constrained to be 4-byte-aligned, then only the "2 x 'B' 'M'" case would apply.
I think a simpler way to implement something like this is to just use modulo 4 to check alignment and fix the address dynamically; perhaps even fixing it in the environment.
This is a localized approach though. We will have to do this from all the code paths that lead to a bmp header being probed in memory. I would prefer a more localized solution.
Correction: "I would prefer a more global solution."
- define an internal 'BMP holder' structure which contains a
two-byte prefix before the 'BMP file' header and data. This way, if the overall structure is aligned, then the fields in the BMP header are aligned too.
Amicalement,