From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzhgv-0006CV-R9 for qemu-devel@nongnu.org; Tue, 02 Jun 2015 04:36:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzhgo-0006uC-SZ for qemu-devel@nongnu.org; Tue, 02 Jun 2015 04:36:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzhgo-0006tt-FP for qemu-devel@nongnu.org; Tue, 02 Jun 2015 04:36:50 -0400 From: Gerd Hoffmann Date: Tue, 2 Jun 2015 10:36:38 +0200 Message-Id: <1433234200-19037-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1433234200-19037-1-git-send-email-kraxel@redhat.com> References: <1433234200-19037-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 1/2] virtio-input: const_le16 and const_le32 not build time constant List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Mueller , Gerd Hoffmann From: Michael Mueller As the implementation of const_le16 and const_le32 is not build time cons= tant on big endian systems this need to be fixed. CC hw/input/virtio-input-hid.o hw/input/virtio-input-hid.c:340:13: error: initializer element is not con= stant hw/input/virtio-input-hid.c:340:13: error: (near initialization for =E2=80= =98virtio_keyboard_config[1].u.ids.bustype=E2=80=99) ... Signed-off-by: Michael Mueller Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-input.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-= input.h index a265519..bcee355 100644 --- a/include/hw/virtio/virtio-input.h +++ b/include/hw/virtio/virtio-input.h @@ -14,8 +14,14 @@ typedef struct virtio_input_config virtio_input_config= ; typedef struct virtio_input_event virtio_input_event; =20 #if defined(HOST_WORDS_BIGENDIAN) -# define const_le32(_x) bswap32(_x) -# define const_le16(_x) bswap32(_x) +# define const_le32(_x) \ + (((_x & 0x000000ffU) << 24) | \ + ((_x & 0x0000ff00U) << 8) | \ + ((_x & 0x00ff0000U) >> 8) | \ + ((_x & 0xff000000U) >> 24)) +# define const_le16(_x) \ + (((_x & 0x00ff) << 8) | \ + ((_x & 0xff00) >> 8)) #else # define const_le32(_x) (_x) # define const_le16(_x) (_x) --=20 1.8.3.1