[Mesa-dev] [PATCH] mesa: Fix test for big-endian architecture in compiler.h
Oded Gabbay
oded.gabbay at gmail.com
Tue Feb 16 08:37:47 UTC 2016
On Tue, Feb 16, 2016 at 9:23 AM, Jonathan Gray <jsg at jsg.id.au> wrote:
> On Fri, Feb 12, 2016 at 10:01:21AM +0100, Jochen Rollwagen wrote:
>> Hi,
>>
>> i think i found & fixed a bug in mesa concerning tests for big-endian
>> machines. The defines tested don't exist or are wrongly defined so the test
>> (probably) never fires. The gcc defines on my machine concerning big-endian
>> are
>>
>> jochen at mac-mini:~/sources/mesa$ gcc -dM -E - < /dev/null | grep BIG
>> #define __BIGGEST_ALIGNMENT__ 16
>> #define __BIG_ENDIAN__ 1
>> #define __FLOAT_WORD_ORDER__ __ORDER_BIG_ENDIAN__
>> #define _BIG_ENDIAN 1
>> #define __ORDER_BIG_ENDIAN__ 4321
>> #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
>>
>> The tested values in current mesa are quite different :-)
>>
>> The following patch fixes this.
>
> I think you have this backwards.
>
> On OpenBSD/sparc64
> $ gcc -dM -E - < /dev/null | grep BIG
> $
> $ sysctl hw.byteorder
> hw.byteorder=4321
>
> endian.h defines BYTE_ORDER and it should be included to test it.
>
> I was under the impression the headers on linux had similiar defines.
>
> Look at how src/gallium/include/pipe/p_config.h does it.
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
After looking at it last night, I also think a better solution will be
to just include <endian.h> in compiler.h file
Oded
More information about the mesa-dev
mailing list