On Mon, 2021-02-22 at 19:27 +0000, Jessica Clarke wrote:
> > > Example: 16-bit m68k
> > no, it's a 32bit platform with extra alignment requirements.
> 
> Actually, fewer. Most architectures have alignof(x) == sizeof(x) for
> all the primitive types, but m68k is more relaxed and caps alignof(x)
> at 2. This means that assert((p & sizeof(long)) == 0) is too strict,
> and should instead just be assert((p & alignof(long)) == 0), which is
> always correct, rather than relying on implementation-defined
> alignment requirements. In autoconf there's AC_CHECK_ALIGNOF just as
> there is AC_CHECK_SIZEOF, the result of which should be used for the
> alignment check instead. That's the portable way to do it (and would
> allow the removal of the #ifdef).

I agree, except that -- as I mentioned elsewhere -- the #ifdef was added
because the x86 optimization hack is actually slower on m68k.  I suspect
that if more benchmarking was made, it might turn out that #ifdef should
actually disable it on more platforms.

-- 
Best regards,
Michał Górny

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/AAM5PRW5KMEDWZPNCO4VHIJM5ZYV5QIH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to