aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eval.c2
-rw-r--r--src/hashtab.c4
-rw-r--r--src/memfile.c2
-rw-r--r--src/option.c6
-rw-r--r--src/quickfix.c2
-rw-r--r--src/window.c8
6 files changed, 11 insertions, 13 deletions
diff --git a/src/eval.c b/src/eval.c
index 9506dd989e..e5a869b923 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7162,7 +7162,7 @@ find_internal_func (
* Find the function name in the table. Binary search.
*/
while (first <= last) {
- x = first + ((unsigned)(last - first) >> 1);
+ x = first + (last - first) / 2;
cmp = STRCMP(name, functions[x].f_name);
if (cmp < 0)
last = x - 1;
diff --git a/src/hashtab.c b/src/hashtab.c
index b84b56278f..a43180d6cb 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -141,7 +141,7 @@ hashitem_T* hash_lookup(hashtab_T *ht, char_u *key, hash_T hash)
// count a "miss" for hashtab lookup
hash_count_perturb++;
#endif // ifdef HT_DEBUG
- idx = (unsigned)((idx << 2U) + idx + perturb + 1U);
+ idx = 5 * idx + perturb + 1;
hi = &ht->ht_array[idx & ht->ht_mask];
if (hi->hi_key == NULL) {
@@ -378,7 +378,7 @@ static int hash_may_resize(hashtab_T *ht, int minitems)
newitem = &newarray[newi];
if (newitem->hi_key != NULL) {
for (perturb = olditem->hi_hash;; perturb >>= PERTURB_SHIFT) {
- newi = (unsigned)((newi << 2U) + newi + perturb + 1U);
+ newi = 5 * newi + perturb + 1;
newitem = &newarray[newi & newmask];
if (newitem->hi_key == NULL) {
break;
diff --git a/src/memfile.c b/src/memfile.c
index 497c9ddacd..ee228e6cda 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -192,7 +192,7 @@ memfile_T *mf_open(char_u *fname, int flags)
unsigned page_size = mfp->mf_page_size;
while (shift > 0 && (page_size & 1) == 0) {
- page_size = page_size >> 1;
+ page_size /= 2;
--shift;
}
mfp->mf_used_count_max = (p_mm << shift) / page_size;
diff --git a/src/option.c b/src/option.c
index a12b3d879a..7bf01bafac 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2042,8 +2042,8 @@ void set_init_1(void)
/* Initialize the 'cdpath' option's default value. */
cdpath = vim_getenv((char_u *)"CDPATH", &mustfree);
if (cdpath != NULL) {
- buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2));
- if (buf != NULL) {
+ buf = xmalloc(2 * STRLEN(cdpath) + 2);
+ {
buf[0] = ','; /* start with ",", current dir first */
j = 1;
for (i = 0; cdpath[i] != NUL; ++i) {
@@ -2376,7 +2376,7 @@ void set_init_2(void)
* 'scroll' defaults to half the window height. Note that this default is
* wrong when the window height changes.
*/
- set_number_default("scroll", (long)((long_u)Rows >> 1));
+ set_number_default("scroll", Rows / 2);
idx = findoption((char_u *)"scroll");
if (idx >= 0 && !(options[idx].flags & P_WAS_SET))
set_option_default(idx, OPT_LOCAL, p_cp);
diff --git a/src/quickfix.c b/src/quickfix.c
index f14861f5d9..75c80ed2b0 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -312,7 +312,7 @@ qf_init_ext (
/*
* Get some space to modify the format string into.
*/
- i = (FMT_PATTERNS * 3) + ((int)STRLEN(efm) << 2);
+ i = 3 * FMT_PATTERNS + 4 * (int)STRLEN(efm);
for (round = FMT_PATTERNS; round > 0; )
i += (int)STRLEN(fmt_pat[--round].pattern);
#ifdef COLON_IN_FILENAME
diff --git a/src/window.c b/src/window.c
index 1b0c2013e9..d47ed22720 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1516,8 +1516,7 @@ win_equal_rec (
if (totwincount == 0)
new_size = room;
else
- new_size = (wincount * room + ((unsigned)totwincount >> 1))
- / totwincount;
+ new_size = (wincount * room + (totwincount / 2)) / totwincount;
if (hnc) { /* add next_curwin size */
next_curwin_size -= p_wiw - (m - n);
new_size += next_curwin_size;
@@ -1638,8 +1637,7 @@ win_equal_rec (
if (totwincount == 0)
new_size = room;
else
- new_size = (wincount * room + ((unsigned)totwincount >> 1))
- / totwincount;
+ new_size = (wincount * room + (totwincount / 2)) / totwincount;
if (hnc) { /* add next_curwin size */
next_curwin_size -= p_wh - (m - n);
new_size += next_curwin_size;
@@ -4644,7 +4642,7 @@ void win_new_width(win_T *wp, int width)
void win_comp_scroll(win_T *wp)
{
- wp->w_p_scr = ((unsigned)wp->w_height >> 1);
+ wp->w_p_scr = wp->w_height / 2;
if (wp->w_p_scr == 0)
wp->w_p_scr = 1;
}