[Gs-code-review] Fix for bug #523073 "Segment fault in mem_mono_copy_mono".
L. Peter Deutsch
ghost at aladdin.com
Wed Feb 27 07:37:14 PST 2002
> Perhaps at least for Intel/Windows the alignment constraint may be
> replaced with a weaker one. Intel hardware doesn't require an alignment.
> Therefore only the last line needs to be padded to word boundary. With
> this weaker constraint the temporary copy is needed for lesser cases. If
> even and odd bitmap size has same probability for both width and height,
> the average number of copies would be 4 times lesser.
I see the requirements are not documented adequately. I will update
gxbitmap.h to include the following paragraphs.
There are two different requirements for the mem_xxx procedures: an
alignment requirement, and a padding requirement.
The alignment requirement is only for the hardware, but it must be respected
in all platform-independent code. More precisely, platform-independent code
can *assume* that Ghostscript allocators return blocks that are adequately
aligned, and then must *ensure* that that alignment is not lost. (The
assumption is not true in some MSVC implementations, but even in those
implementations, the alignment is sufficient to satisfy the hardware.)
The padding requirement occurs because, as you observed, the mem_xxx
procedures may process bitmaps in units as large as align_bitmap_mod. It is
required in all cases.
L. Peter Deutsch | Aladdin Enterprises | 203 Santa Margarita Ave.
ghost at aladdin.com | http://www.aladdin.com | Menlo Park, CA 94025
The future of software is at http://www.opensource.org
More information about the gs-code-review