Skip to content

Commit 22bd64a

Browse files
ozbenhmpe
authored andcommitted
powerpc: Add more PPC bit conversion macros
Add 32 and 8 bit variants Signed-off-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent eeea1a4 commit 22bd64a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/powerpc/include/asm/bitops.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@
5555
#define PPC_BITEXTRACT(bits, ppc_bit, dst_bit) \
5656
((((bits) >> PPC_BITLSHIFT(ppc_bit)) & 1) << (dst_bit))
5757

58+
#define PPC_BITLSHIFT32(be) (32 - 1 - (be))
59+
#define PPC_BIT32(bit) (1UL << PPC_BITLSHIFT32(bit))
60+
#define PPC_BITMASK32(bs, be) ((PPC_BIT32(bs) - PPC_BIT32(be))|PPC_BIT32(bs))
61+
62+
#define PPC_BITLSHIFT8(be) (8 - 1 - (be))
63+
#define PPC_BIT8(bit) (1UL << PPC_BITLSHIFT8(bit))
64+
#define PPC_BITMASK8(bs, be) ((PPC_BIT8(bs) - PPC_BIT8(be))|PPC_BIT8(bs))
65+
5866
#include <asm/barrier.h>
5967

6068
/* Macro for generating the ***_bits() functions */

0 commit comments

Comments
 (0)