Stefan Hajnoczi suggested we can use __builtin_constant_p() in the cpu_to_ENDIAN()/ENDIAN_to_cpu() functions to check if expression is constant, and if so use the const_ENDIAN() macros.
This series modifies cpu_to_ENDIAN() to use const_ENDIAN() when possible. Philippe Mathieu-Daudé (4): qemu/bswap: Move const_le() definitions around qemu/bswap: add const_be16() and const_be32() qemu/bswap: Add const_le64() and const_be64() qemu/bswap: Let cpu_to_endian() functions handle constant expressions include/qemu/bswap.h | 75 +++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 21 deletions(-) -- 2.26.2