From 325125ba4f58efc8b99c78d7311878b58200bf4f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 25 Sep 2006 18:15:39 +0000 Subject: [PATCH] fix undefined behaviour due to using shift variable twice in the same expression git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/cocoa/cursor.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cocoa/cursor.mm b/src/cocoa/cursor.mm index 23d5be6cbb..f5b548cc42 100644 --- a/src/cocoa/cursor.mm +++ b/src/cocoa/cursor.mm @@ -212,8 +212,9 @@ NSCursor* wxGetStockCursor( short sIndex ) //do the rest of those bits and alphas :) for (int shift = 0; shift < 32; ++shift) { - data[i] |= ( !!( (pCursor->mask[i] & (1 << (shift >> 1) )) ) ) << shift; - data[i] |= ( !( (pCursor->bits[i] & (1 << (shift >> 1) )) ) ) << ++shift; + const int bit = 1 << (shift >> 1); + data[i] |= ( !!( (pCursor->mask[i] & bit) ) ) << shift; + data[i] |= ( !( (pCursor->bits[i] & bit) ) ) << ++shift; } } -- 2.45.2