Tiny optimizations of bit testing operations
Rein Klazes
rklazes at xs4all.nl
Wed Oct 20 08:10:50 CDT 2004
On Wed, 20 Oct 2004 19:48:05 +0900, you wrote:
> Hello,
>
> Changelog:
> Dmitry Timoshkov <dmitry at codeweavers.com>
> Tiny optimizations of bit testing operations.
Testing with gcc 3.3.5:
> - BOOL min_or_max_box = (wndPtr->dwStyle & WS_MAXIMIZEBOX) ||
> - (wndPtr->dwStyle & WS_MINIMIZEBOX);
> + BOOL min_or_max_box = wndPtr->dwStyle & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
At moderate optimization levels (-O1) gcc compiles this to identical
code.
> - if((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
> + if (wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR)
At any optimization level, gcc compiles this to identical code.
> if ((wndPtr->dwStyle & WS_VSCROLL) &&
> - ((((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (ptClient.x <= rcClient.left + GetSystemMetrics(SM_CXVSCROLL))) ||
> - (((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (ptClient.x >= rcClient.right - GetSystemMetrics(SM_CXVSCROLL)))))
> + (((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) && (ptClient.x <= rcClient.left + GetSystemMetrics(SM_CXVSCROLL))) ||
> + (!(wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) && (ptClient.x >= rcClient.right - GetSystemMetrics(SM_CXVSCROLL)))))
Not different then the previous example.
More information about the wine-devel
mailing list