Skip to content

spirv: switch to util_bswap32 to improve portability

Jan Beich requested to merge jbeich/mesa:endian into master

Regressed by !6090 (merged). See error log and downstream fix. CC @pkubaj who helped with testing.

Each OS tends to have slightly different naming for byteswap functions:

  • Linux (bionic, glibc, musl) use bswap_32
  • FreeBSD and NetBSD use bswap32
  • OpenBSD use swap32

Each OS defines byteswap functions in different headers:

  • Linux (bionic, glibc, musl) use <byteswap.h>
  • FreeBSD and OpenBSD use <sys/endian.h>
  • NetBSD uses <sys/bswap.h> (but <sys/endian.h> can also be used)
Edited by Jan Beich

Merge request reports