diffcore-delta.c: LLP64 compatibility, upcast unity for left shift
Visual Studio reports C4334 "was 64-bit shift intended" warning because of size miss-match. Promote unity to the matching type to fit with its subsequent operation. Signed-off-by: Philip Oakley <philipoakley@iee.email> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philip Oakley committed
Dec 1, 2021 at 00:29 UTC
62e8452c8c0ecdd7af5ff1e0c8cefaf153216d12
1 file changed
+3
-3
diffcore-delta.c
+3
-3
@@ -133,10 +133,10 @@ static struct spanhash_top *hash_chars(struct repository *r,
133
134
i = INITIAL_HASH_SIZE;
135
hash = xmalloc(st_add(sizeof(*hash),
136
- st_mult(sizeof(struct spanhash), 1<<i)));
136
+ st_mult(sizeof(struct spanhash), (size_t)1 << i)));
137
hash->alloc_log2 = i;
138
hash->free = INITIAL_FREE(i);
139
- memset(hash->data, 0, sizeof(struct spanhash) * (1<<i));
139
+ memset(hash->data, 0, sizeof(struct spanhash) * ((size_t)1 << i));
140
141
n = 0;
142
accum1 = accum2 = 0;
@@ -159,7 +159,7 @@ static struct spanhash_top *hash_chars(struct repository *r,
159
n = 0;
160
accum1 = accum2 = 0;
161
}
162
- QSORT(hash->data, 1ul << hash->alloc_log2, spanhash_cmp);
162
+ QSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp);
163
return hash;
164
}
165