From 404a82d5ee5e4089ac24dd16cce125cca70ae157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 24 Aug 2017 14:37:56 +0200 Subject: [PATCH] register_set: do not shift when ITEM_WIDTH is 64 Issue #2507. --- repos/base/include/util/register_set.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/repos/base/include/util/register_set.h b/repos/base/include/util/register_set.h index 384c4aa66..6b1b5a69c 100644 --- a/repos/base/include/util/register_set.h +++ b/repos/base/include/util/register_set.h @@ -289,7 +289,8 @@ class Genode::Register_set : Noncopyable ITEM_WIDTH = _ITEM_WIDTH, ITEM_WIDTH_LOG2 = Item::WIDTH_LOG2, MAX_INDEX = ITEMS - 1, - ITEM_MASK = (1ULL << ITEM_WIDTH) - 1, + /* prevent shifting more than bit width by setting all bits explicitly */ + ITEM_MASK = (ITEM_WIDTH == 64) ? ~0ULL : (1ULL << ITEM_WIDTH) - 1, }; /* analogous to 'Register_set::Register::Register_base' */