include: sbi: Fix BSWAPx() macros for big-endian host
authorAnup Patel <apatel@ventanamicro.com>
Thu, 9 Feb 2023 03:45:19 +0000 (09:15 +0530)
committerAnup Patel <anup@brainfault.org>
Thu, 9 Feb 2023 04:01:10 +0000 (09:31 +0530)
commitaa5dafcb5bfc04f8509a04291402d86d6b5c36d5
treeb8a19e75960e40e17a3b7263d96db1f7119c956a
parentb224ddb41fe1f9cbdfb246ebf22036ae1fe3f40f
include: sbi: Fix BSWAPx() macros for big-endian host

The BSWAPx() macros won't do any swapping for big-endian host
because the EXTRACT_BYTE() macro will pickup bytes in reverse
order. Also, the EXTRACT_BYTE() will generate compile error
for constants.

To fix this, we get remove the EXTRACT_BYTE() macro and re-write
BSWAPx() using simple mask and shift operations.

Fixes: 09b34d8cca51 ("include: Add support for byteorder/endianness
conversion")
Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
include/sbi/sbi_byteorder.h