diff options
-rw-r--r-- | src/Box.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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; |