Skip to content

Commit 62e8452

Browse files
PhilipOakleygitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a43abad commit 62e8452

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

diffcore-delta.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ static struct spanhash_top *hash_chars(struct repository *r,
133133

134134
i = INITIAL_HASH_SIZE;
135135
hash = xmalloc(st_add(sizeof(*hash),
136-
st_mult(sizeof(struct spanhash), 1<<i)));
136+
st_mult(sizeof(struct spanhash), (size_t)1 << i)));
137137
hash->alloc_log2 = i;
138138
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));
140140

141141
n = 0;
142142
accum1 = accum2 = 0;
@@ -159,7 +159,7 @@ static struct spanhash_top *hash_chars(struct repository *r,
159159
n = 0;
160160
accum1 = accum2 = 0;
161161
}
162-
QSORT(hash->data, 1ul << hash->alloc_log2, spanhash_cmp);
162+
QSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp);
163163
return hash;
164164
}
165165

0 commit comments

Comments
 (0)