bitops.h: revert db1ffc32dd ("qemu/bitops.h: add bitrev8 implementation")
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Sun, 25 Jul 2021 11:05:57 +0000 (12:05 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 26 Jul 2021 16:56:41 +0000 (06:56 -1000)
Commit db1ffc32dd ("qemu/bitops.h: add bitrev8 implementation") introduced
a bitrev8() function to reverse the bit ordering required for storing the
MAC address in the q800 PROM.

This function is not required since QEMU implements its own revbit8()
function which does exactly the same thing. Remove the extraneous
bitrev8() function and switch its only caller in hw/m68k/q800.c to
use revbit8() instead.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210725110557.3007-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
hw/m68k/q800.c
include/qemu/bitops.h

index 6817c8b5d1a8b51c1eca0940a7f92da477f2b3e8..ac0a13060b4a8d1e52a467238669a68d4f028dd5 100644 (file)
@@ -334,7 +334,7 @@ static void q800_init(MachineState *machine)
     prom = memory_region_get_ram_ptr(dp8393x_prom);
     checksum = 0;
     for (i = 0; i < 6; i++) {
-        prom[i] = bitrev8(nd_table[0].macaddr.a[i]);
+        prom[i] = revbit8(nd_table[0].macaddr.a[i]);
         checksum ^= prom[i];
     }
     prom[7] = 0xff - checksum;
index 110c56e0993b3ecdb0f498407e897f7ba6a6ca37..03213ce952c6d4142814cfb62ee8080da125ccc5 100644 (file)
@@ -618,26 +618,4 @@ static inline uint64_t half_unshuffle64(uint64_t x)
     return x;
 }
 
-/**
- * bitrev8:
- * @x: 8-bit value to be reversed
- *
- * Given an input value with bits::
- *
- *   ABCDEFGH
- *
- * return the value with its bits reversed from left to right::
- *
- *   HGFEDCBA
- *
- * Returns: the bit-reversed value.
- */
-static inline uint8_t bitrev8(uint8_t x)
-{
-    x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
-    x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
-    x = (x >> 4) | (x << 4) ;
-    return x;
-}
-
 #endif