mbox series

[0/4] qemu/bswap: Let cpu_to_endian() functions handle constant expressions

Message ID 20200917163106.49351-1-philmd@redhat.com
Headers show
Series qemu/bswap: Let cpu_to_endian() functions handle constant expressions | expand

Message

Philippe Mathieu-Daudé Sept. 17, 2020, 4:31 p.m. UTC
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(-)