summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Box.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Box.c b/src/Box.c
index 9cf3b5f..50be698 100644
--- a/src/Box.c
+++ b/src/Box.c
@@ -351,15 +351,13 @@ PreferredSize(Widget widget, XtWidgetGeometry *constraint, XtWidgetGeometry *pre
else {
width = preferred_width;
do { /* find some width big enough to stay within this height */
- if (width > constraint->width/2) { /* avoid short int overflow */
+ if (width > (constraint->width >> 1)) /* avoid short int overflow */
width = constraint->width;
- }
- else {
- width *= 2;
- }
+ else
+ width <<= 1;
DoLayout(w, width, 0, &preferred_width, &preferred_height, FALSE);
- } while (preferred_height > constraint->height &&
- width < constraint->width);
+ } while (preferred_height > constraint->height
+ && width < constraint->width);
if (width != constraint->width) {
do { /* find minimum width */
width = preferred_width;