[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1444925909-6013-1-git-send-email-martink@posteo.de>
Date: Thu, 15 Oct 2015 18:18:27 +0200
From: Martin Kepplinger <martink@...teo.de>
To: mingo@...nel.org, akpm@...ux-foundation.org, linux@...izon.com,
linux@...musvillemoes.dk, maxime.coquelin@...com,
dvlasenk@...hat.com, yury.norov@...il.com,
torvalds@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org
Subject: bitops.h: improve sign extending API
PATCH 1/2 improves the doc of sign_extend32()
This should help to avoid different manual approaches to sign extension
PATCH 2/2 adds sign_extend64()
An informal example of what could follow in
arch/sh/kernel/traps_64.c after PATCH 2/2:
@@ -101,7 +102,7 @@ static int generate_and_check_address(struct pt_regs *regs,
__s64 displacement;
displacement = (opcode >> 10) & 0x3ff;
- displacement = ((displacement << 54) >> 54); /* sign extend */
+ displacement = sign_extend64(displacement, 9);
addr = (__u64)((__s64)base_address + (displacement << width_shift));
} else {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists