]> www.infradead.org Git - users/jedix/linux-maple.git/commit
wordpart.h: Add REPEAT_BYTE_U32()
authorMark Rutland <mark.rutland@arm.com>
Mon, 17 Jun 2024 11:18:37 +0000 (12:18 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 24 Jun 2024 17:16:44 +0000 (18:16 +0100)
commit118d777c4cb40f44e7b675955fd2da8b22f83913
tree8f1b01ee8e3062993a34ba1e694d75f8c647c832
parent83a7eefedc9b56fe7bfeff13b6c7356688ffa670
wordpart.h: Add REPEAT_BYTE_U32()

In some cases it's necessary to replicate a byte across a u32 value, for
which REPEAT_BYTE() would be helpful. Currently this requires explicit
masking of the result to avoid sparse warnings, as e.g.

    (u32)REPEAT_BYTE(0xa0))

... will result in a warning:

    cast truncates bits from constant value (a0a0a0a0a0a0a0a0 becomes a0a0a0a0)

Add a new REPEAT_BYTE_U32() which does the necessary masking internally,
so that we don't need to duplicate this for every usage.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20240617111841.2529370-2-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/wordpart.h