On Wed, 14 Jan 2004, Trent Piepho wrote:
> > if (posix_memalign( &buf, simd_alignment, size))
> > buf = memalign(pgsize, size);
> > if (buf && ((int)buf & (simd_alignment - 1)))
> > {
> > free(buf);
> > buf = memalign(pgsize, size);
> > }
> Could this be done at configure time? Check the glibc version or have
> autoconf run a test program to see if posix_memalign works?
Not really. Oh, that might detect the completely broken
posix_memalign() that 2.2.4 has but it won't detect the 2.2.5
(and possibly later) version that *sometimes* posix_memalign()
works and other times it does not. The autoconf test could
snag one of the times that the buffer is aligned and then
assume that a correctly functioning posix_memalign() exists.
Problem is that posix_memalign() on some systems returns 8 byte
alignment. As it happens 16 is a multiple of 8 so there's
1 in 2 chance of getting a correct answer with a buggy version of
the function. Then at run time the other case happens and the
program faults.
Much more flexible to do it at run time - there's no performance
penalty to speak of since it's only once done at program startup.
It does seem to work - it'll get wider exposure soon I hope when more
folks can test it.
Cheers,
Steven Schultz
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users