use DIV_ROUND_UP()
This commit is contained in:
parent
2c254526b9
commit
62a8e0a021
|
@ -13,17 +13,21 @@ notnull.cocci
|
||||||
null_ref.cocci
|
null_ref.cocci
|
||||||
unused.cocci
|
unused.cocci
|
||||||
use_after_iter.cocci
|
use_after_iter.cocci
|
||||||
|
div_round_up.cocci
|
||||||
"
|
"
|
||||||
|
|
||||||
HAS_ERROR=0
|
HAS_ERROR=0
|
||||||
for f in $COCCI_FILES; do
|
for f in $COCCI_FILES; do
|
||||||
CMD="spatch --timeout 200 --very-quiet --cocci-file scripts/coccinelle/$f --include-headers --dir $DIR"
|
OPTIONS=""
|
||||||
#CMD="spatch --very-quiet --cocci-file scripts/coccinelle/$f --dir $DIR -allow_inconsistent_paths"
|
if [ "$COCCI_FILES" = "div_round_up" ]; then
|
||||||
OUT=$($CMD)
|
OPTIONS="--defined DIV_ROUND_UP"
|
||||||
echo "$CMD"
|
fi
|
||||||
if [ -n "$OUT" ]; then
|
CMD="spatch --timeout 200 --very-quiet --cocci-file scripts/coccinelle/$f --include-headers --dir $DIR $OPTIONS"
|
||||||
echo "$OUT"
|
OUT=$($CMD)
|
||||||
HAS_ERROR=1
|
echo "$CMD"
|
||||||
fi
|
if [ -n "$OUT" ]; then
|
||||||
|
echo "$OUT"
|
||||||
|
HAS_ERROR=1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
exit $HAS_ERROR
|
exit $HAS_ERROR
|
||||||
|
|
|
@ -16,11 +16,11 @@ _accounting_change(int64_t diff)
|
||||||
{
|
{
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
{
|
{
|
||||||
diff = ((diff + 16-1) / 16) * 16;
|
diff = DIV_ROUND_UP(diff, 16) * 16;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
diff = ((-1 * diff + 16-1) / 16) * -16;
|
diff = DIV_ROUND_UP(-1 * diff, 16) * -16;
|
||||||
}
|
}
|
||||||
_mem_used += diff;
|
_mem_used += diff;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ termpty_backlog_length(Termpty *ty)
|
||||||
if (!ts->cells)
|
if (!ts->cells)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
nb_lines = (ts->w == 0) ? 1 : (ts->w + ty->w - 1) / ty->w;
|
nb_lines = (ts->w == 0) ? 1 : DIV_ROUND_UP(ts->w, ty->w);
|
||||||
screen_y += nb_lines;
|
screen_y += nb_lines;
|
||||||
ty->backlog_beacon.screen_y = screen_y;
|
ty->backlog_beacon.screen_y = screen_y;
|
||||||
ty->backlog_beacon.backlog_y = backlog_y;
|
ty->backlog_beacon.backlog_y = backlog_y;
|
||||||
|
|
|
@ -147,7 +147,7 @@ _mouse_move_cb(void *data,
|
||||||
return;
|
return;
|
||||||
iw = sqrt(eina_list_count(sd->items));
|
iw = sqrt(eina_list_count(sd->items));
|
||||||
if (iw < 1) iw = 1;
|
if (iw < 1) iw = 1;
|
||||||
ih = (eina_list_count(sd->items) + (iw - 1)) / iw;
|
ih = DIV_ROUND_UP(eina_list_count(sd->items), iw);
|
||||||
if (ih < 1) ih = 1;
|
if (ih < 1) ih = 1;
|
||||||
evas_object_geometry_get(sd->self, &x, &y, &w, &h);
|
evas_object_geometry_get(sd->self, &x, &y, &w, &h);
|
||||||
sw = w * sd->zoom;
|
sw = w * sd->zoom;
|
||||||
|
@ -366,7 +366,7 @@ _layout(Sel *sd)
|
||||||
|
|
||||||
iw = sqrt(eina_list_count(sd->items));
|
iw = sqrt(eina_list_count(sd->items));
|
||||||
if (iw < 1) iw = 1;
|
if (iw < 1) iw = 1;
|
||||||
ih = (eina_list_count(sd->items) + (iw - 1)) / iw;
|
ih = DIV_ROUND_UP(eina_list_count(sd->items), iw);
|
||||||
if (ih < 1) ih = 1;
|
if (ih < 1) ih = 1;
|
||||||
evas_object_geometry_get(sd->self, &ox, &oy, &ow, &oh);
|
evas_object_geometry_get(sd->self, &ox, &oy, &ow, &oh);
|
||||||
w = ow * sd->zoom;
|
w = ow * sd->zoom;
|
||||||
|
|
|
@ -992,8 +992,8 @@ termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max)
|
||||||
{
|
{
|
||||||
int old_len = ts->w;
|
int old_len = ts->w;
|
||||||
termpty_save_expand(ty, ts, cells, w);
|
termpty_save_expand(ty, ts, cells, w);
|
||||||
ty->backlog_beacon.screen_y += (ts->w + ty->w - 1) / ty->w
|
ty->backlog_beacon.screen_y += DIV_ROUND_UP(ts->w, ty->w)
|
||||||
- (old_len + ty->w - 1) / ty->w;
|
- DIV_ROUND_UP(old_len, ty->w);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1060,7 @@ termpty_backscroll_adjust(Termpty *ty, int *scroll)
|
||||||
*scroll = ty->backlog_beacon.screen_y;
|
*scroll = ty->backlog_beacon.screen_y;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nb_lines = (ts->w == 0) ? 1 : (ts->w + ty->w - 1) / ty->w;
|
nb_lines = (ts->w == 0) ? 1 : DIV_ROUND_UP(ts->w, ty->w);
|
||||||
screen_y += nb_lines;
|
screen_y += nb_lines;
|
||||||
ty->backlog_beacon.screen_y = screen_y;
|
ty->backlog_beacon.screen_y = screen_y;
|
||||||
ty->backlog_beacon.backlog_y = backlog_y;
|
ty->backlog_beacon.backlog_y = backlog_y;
|
||||||
|
@ -1099,7 +1099,7 @@ _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
nb_lines = (ts->w == 0) ? 1 : (ts->w + ty->w - 1) / ty->w;
|
nb_lines = (ts->w == 0) ? 1 : DIV_ROUND_UP(ts->w, ty->w);
|
||||||
|
|
||||||
/* Only update the beacon if working on different line than the one
|
/* Only update the beacon if working on different line than the one
|
||||||
* from the beacon */
|
* from the beacon */
|
||||||
|
@ -1130,7 +1130,7 @@ _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
nb_lines = (ts->w == 0) ? 1 : (ts->w + ty->w - 1) / ty->w;
|
nb_lines = (ts->w == 0) ? 1 : DIV_ROUND_UP(ts->w, ty->w);
|
||||||
|
|
||||||
ty->backlog_beacon.screen_y = screen_y;
|
ty->backlog_beacon.screen_y = screen_y;
|
||||||
ty->backlog_beacon.backlog_y = backlog_y;
|
ty->backlog_beacon.backlog_y = backlog_y;
|
||||||
|
|
|
@ -52,17 +52,17 @@ scaleterm(int w, int h, int *iw, int *ih)
|
||||||
if (w > (width * cw))
|
if (w > (width * cw))
|
||||||
{
|
{
|
||||||
*iw = width;
|
*iw = width;
|
||||||
*ih = ((h * (width * cw) / w) + (ch - 1)) / ch;
|
*ih = DIV_ROUND_UP((h * (width * cw) / w), ch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*iw = (w + (cw - 1)) / cw;
|
*iw = DIV_ROUND_UP(w, cw);
|
||||||
*ih = (h + (ch - 1)) / ch;
|
*ih = DIV_ROUND_UP(h, ch);
|
||||||
}
|
}
|
||||||
if (maxh && *ih > maxh)
|
if (maxh && *ih > maxh)
|
||||||
{
|
{
|
||||||
*ih = maxh;
|
*ih = maxh;
|
||||||
*iw = ((w * (maxh * ch) / h) + (cw - 1)) / cw;
|
*iw = DIV_ROUND_UP((w * (maxh * ch) / h), cw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue