From patchwork Fri Nov 26 11:36:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip Oakley X-Patchwork-Id: 12640421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58A3CC433EF for ; Fri, 26 Nov 2021 11:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348544AbhKZLts (ORCPT ); Fri, 26 Nov 2021 06:49:48 -0500 Received: from smtp-out-6.talktalk.net ([62.24.135.70]:56352 "EHLO smtp-out-6.talktalk.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351088AbhKZLrr (ORCPT ); Fri, 26 Nov 2021 06:47:47 -0500 Received: from localhost.localdomain ([84.13.154.214]) by smtp.talktalk.net with SMTP id qZWhm5FMyCcoVqZWhmUAfT; Fri, 26 Nov 2021 11:36:24 +0000 X-Originating-IP: [84.13.154.214] X-Spam: 0 X-OAuthority: v=2.3 cv=ebBDgIMH c=1 sm=1 tr=0 a=nZAgPUNe/8GoCGAv1ndepQ==:117 a=nZAgPUNe/8GoCGAv1ndepQ==:17 a=IkcTkHD0fZMA:10 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=ldyaYNNxDcoA:10 a=ZZnuYtJkoWoA:10 a=acTyJGYzDTWRqCFSA_0A:9 a=QEXdDO2ut3YA:10 From: Philip Oakley To: GitList , Junio C Hamano Cc: =?utf-8?q?Ren=C3=A9_Scharfe?= , Johannes Schindelin , Philip Oakley Subject: [PATCH 1/4] mergesort.c: LLP64 compatibility, upcast unity for left shift Date: Fri, 26 Nov 2021 11:36:11 +0000 Message-Id: <20211126113614.709-2-philipoakley@iee.email> X-Mailer: git-send-email 2.34.0.windows.1 In-Reply-To: <20211126113614.709-1-philipoakley@iee.email> References: <20211126113614.709-1-philipoakley@iee.email> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfLAI0pzwCuBTB7RxS8sMIs7Xd+1OVZrQCBt35fC8S14f2IFJhE6K0f4BbNBgN/GbJUHm4FSBeMOYzoVFl5rHrRVnDR77BGEeA8d1+3YW9OlE1k6oodiZ +NkAlvfGBj6Gl9PAjIhlAr9DGvdM/L4gl2ExI1pI3BWLK7SvDmUy8ag1SqlWQbiiMaBI6BCV9YX29hcMOwgH1y2WQvlgxEc+wlbzfKFq+CIpUVy/Bf2IHrsU uU8MwzgAqEk2DkZguozuC5XAoKMDn2rZnrf3sdcZRmc1JFo+K1So10LcDI3hvnsmB1N8omDtxrxm62Li7oVzUg== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Visual Studio reports C4334 "was 64-bit shift intended" size mismatch warning because of size miss-match. Promote unity to the matching type to fit with the `&` operator. Signed-off-by: Philip Oakley --- This is the same fix that René Scharfe provided in 42c456ff81 (mergesort: avoid left shift overflow, 2021-11-16) Use size_t to match n when building the bitmask for checking whether a rank is occupied, instead of the default signed int. --- mergesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mergesort.c b/mergesort.c index 6216835566..bd9c6ef8ee 100644 --- a/mergesort.c +++ b/mergesort.c @@ -63,7 +63,7 @@ void *llist_mergesort(void *list, void *next = get_next_fn(list); if (next) set_next_fn(list, NULL); - for (i = 0; n & (1 << i); i++) + for (i = 0; n & ((size_t)1 << i); i++) list = llist_merge(ranks[i], list, get_next_fn, set_next_fn, compare_fn); n++; From patchwork Fri Nov 26 11:36:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Oakley X-Patchwork-Id: 12640425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7181FC433FE for ; Fri, 26 Nov 2021 11:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349008AbhKZLtw (ORCPT ); Fri, 26 Nov 2021 06:49:52 -0500 Received: from smtp-out-6.talktalk.net ([62.24.135.70]:43880 "EHLO smtp-out-6.talktalk.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351134AbhKZLrs (ORCPT ); Fri, 26 Nov 2021 06:47:48 -0500 Received: from localhost.localdomain ([84.13.154.214]) by smtp.talktalk.net with SMTP id qZWhm5FMyCcoVqZWimUAfb; Fri, 26 Nov 2021 11:36:24 +0000 X-Originating-IP: [84.13.154.214] X-Spam: 0 X-OAuthority: v=2.3 cv=ebBDgIMH c=1 sm=1 tr=0 a=nZAgPUNe/8GoCGAv1ndepQ==:117 a=nZAgPUNe/8GoCGAv1ndepQ==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=ldyaYNNxDcoA:10 a=ZZnuYtJkoWoA:10 a=wwJ6zcVpBE7CKp6EtbsA:9 From: Philip Oakley To: GitList , Junio C Hamano Cc: =?utf-8?q?Ren=C3=A9_Scharfe?= , Johannes Schindelin , Philip Oakley Subject: [PATCH 2/4] repack.c: LLP64 compatibility, upcast unity for left shift Date: Fri, 26 Nov 2021 11:36:12 +0000 Message-Id: <20211126113614.709-3-philipoakley@iee.email> X-Mailer: git-send-email 2.34.0.windows.1 In-Reply-To: <20211126113614.709-1-philipoakley@iee.email> References: <20211126113614.709-1-philipoakley@iee.email> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfLAI0pzwCuBTB7RxS8sMIs7Xd+1OVZrQCBt35fC8S14f2IFJhE6K0f4BbNBgN/GbJUHm4FSBeMOYzoVFl5rHrRVnDR77BGEeA8d1+3YW9OlE1k6oodiZ +NkAlvfGBj6Gl9PAjIhlAr9DGvdM/L4gl2ExI1pI3BWLK7SvDmUy8ag1SqlWQbiiMaBI6BCV9YX29hcMOwgH1y2WQvlgxEc+wlbzfKFq+CIpUVy/Bf2IHrsU uU8MwzgAqEk2DkZguozuC5XAoKMDn2rZnrf3sdcZRmc1JFo+K1So10LcDI3hvnsmB1N8omDtxrxm62Li7oVzUg== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Visual Studio reports C4334 "was 64-bit shift intended" warning because of size miss-match. Promote unity to the matching type to fit with the `&` operator. Signed-off-by: Philip Oakley --- builtin/repack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/repack.c b/builtin/repack.c index 0b2d1e5d82..6da66474fd 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -842,7 +842,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix) fname_old = mkpathdup("%s-%s%s", packtmp, item->string, exts[ext].name); - if (((uintptr_t)item->util) & (1 << ext)) { + if (((uintptr_t)item->util) & ((uintptr_t)1 << ext)) { struct stat statbuffer; if (!stat(fname_old, &statbuffer)) { statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); From patchwork Fri Nov 26 11:36:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Oakley X-Patchwork-Id: 12640423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC205C433EF for ; Fri, 26 Nov 2021 11:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348679AbhKZLtu (ORCPT ); Fri, 26 Nov 2021 06:49:50 -0500 Received: from smtp-out-6.talktalk.net ([62.24.135.70]:51224 "EHLO smtp-out-6.talktalk.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351099AbhKZLrs (ORCPT ); Fri, 26 Nov 2021 06:47:48 -0500 Received: from localhost.localdomain ([84.13.154.214]) by smtp.talktalk.net with SMTP id qZWhm5FMyCcoVqZWimUAfh; Fri, 26 Nov 2021 11:36:24 +0000 X-Originating-IP: [84.13.154.214] X-Spam: 0 X-OAuthority: v=2.3 cv=ebBDgIMH c=1 sm=1 tr=0 a=nZAgPUNe/8GoCGAv1ndepQ==:117 a=nZAgPUNe/8GoCGAv1ndepQ==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=ldyaYNNxDcoA:10 a=ZZnuYtJkoWoA:10 a=WJ5fosVX2o5eYQUPKkoA:9 From: Philip Oakley To: GitList , Junio C Hamano Cc: =?utf-8?q?Ren=C3=A9_Scharfe?= , Johannes Schindelin , Philip Oakley Subject: [PATCH 3/4] diffcore-delta.c: LLP64 compatibility, upcast unity for left shift Date: Fri, 26 Nov 2021 11:36:13 +0000 Message-Id: <20211126113614.709-4-philipoakley@iee.email> X-Mailer: git-send-email 2.34.0.windows.1 In-Reply-To: <20211126113614.709-1-philipoakley@iee.email> References: <20211126113614.709-1-philipoakley@iee.email> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfLAI0pzwCuBTB7RxS8sMIs7Xd+1OVZrQCBt35fC8S14f2IFJhE6K0f4BbNBgN/GbJUHm4FSBeMOYzoVFl5rHrRVnDR77BGEeA8d1+3YW9OlE1k6oodiZ +NkAlvfGBj6Gl9PAjIhlAr9DGvdM/L4gl2ExI1pI3BWLK7SvDmUy8ag1SqlWQbiiMaBI6BCV9YX29hcMOwgH1y2WQvlgxEc+wlbzfKFq+CIpUVy/Bf2IHrsU uU8MwzgAqEk2DkZguozuC5XAoKMDn2rZnrf3sdcZRmc1JFo+K1So10LcDI3hvnsmB1N8omDtxrxm62Li7oVzUg== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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 --- diffcore-delta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diffcore-delta.c b/diffcore-delta.c index 5668ace60d..a4e86dfa38 100644 --- a/diffcore-delta.c +++ b/diffcore-delta.c @@ -133,10 +133,10 @@ static struct spanhash_top *hash_chars(struct repository *r, i = INITIAL_HASH_SIZE; hash = xmalloc(st_add(sizeof(*hash), - st_mult(sizeof(struct spanhash), 1<alloc_log2 = i; hash->free = INITIAL_FREE(i); - memset(hash->data, 0, sizeof(struct spanhash) * (1<data, 0, sizeof(struct spanhash) * ((size_t)1 << i)); n = 0; accum1 = accum2 = 0; @@ -159,7 +159,7 @@ static struct spanhash_top *hash_chars(struct repository *r, n = 0; accum1 = accum2 = 0; } - QSORT(hash->data, 1ul << hash->alloc_log2, spanhash_cmp); + QSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp); return hash; } From patchwork Fri Nov 26 11:36:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip Oakley X-Patchwork-Id: 12640419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BF3C433F5 for ; Fri, 26 Nov 2021 11:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348295AbhKZLts (ORCPT ); Fri, 26 Nov 2021 06:49:48 -0500 Received: from smtp-out-6.talktalk.net ([62.24.135.70]:48544 "EHLO smtp-out-6.talktalk.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234169AbhKZLrr (ORCPT ); Fri, 26 Nov 2021 06:47:47 -0500 Received: from localhost.localdomain ([84.13.154.214]) by smtp.talktalk.net with SMTP id qZWhm5FMyCcoVqZWimUAfo; Fri, 26 Nov 2021 11:36:24 +0000 X-Originating-IP: [84.13.154.214] X-Spam: 0 X-OAuthority: v=2.3 cv=ebBDgIMH c=1 sm=1 tr=0 a=nZAgPUNe/8GoCGAv1ndepQ==:117 a=nZAgPUNe/8GoCGAv1ndepQ==:17 a=IkcTkHD0fZMA:10 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=ldyaYNNxDcoA:10 a=ZZnuYtJkoWoA:10 a=qW9_nJxYNLE7NW8Q08AA:9 a=QEXdDO2ut3YA:10 From: Philip Oakley To: GitList , Junio C Hamano Cc: =?utf-8?q?Ren=C3=A9_Scharfe?= , Johannes Schindelin , Philip Oakley Subject: [PATCH 4/4] object-file.c: LLP64 compatibility, upcast unity for left shift Date: Fri, 26 Nov 2021 11:36:14 +0000 Message-Id: <20211126113614.709-5-philipoakley@iee.email> X-Mailer: git-send-email 2.34.0.windows.1 In-Reply-To: <20211126113614.709-1-philipoakley@iee.email> References: <20211126113614.709-1-philipoakley@iee.email> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfLAI0pzwCuBTB7RxS8sMIs7Xd+1OVZrQCBt35fC8S14f2IFJhE6K0f4BbNBgN/GbJUHm4FSBeMOYzoVFl5rHrRVnDR77BGEeA8d1+3YW9OlE1k6oodiZ +NkAlvfGBj6Gl9PAjIhlAr9DGvdM/L4gl2ExI1pI3BWLK7SvDmUy8ag1SqlWQbiiMaBI6BCV9YX29hcMOwgH1y2WQvlgxEc+wlbzfKFq+CIpUVy/Bf2IHrsU uU8MwzgAqEk2DkZguozuC5XAoKMDn2rZnrf3sdcZRmc1JFo+K1So10LcDI3hvnsmB1N8omDtxrxm62Li7oVzUg== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Visual Studio reports C4334 "was 64-bit shift intended" warning because of size miss-match. Promote unity to the matching type to fit with the assignment. Signed-off-by: Philip Oakley --- This cannot be applied to the maint-2.32 branch as the earlier René Scharfe patch had been, because the original sha1-file.c, to which the backport would apply, has been renamed in e5afd4449d (object-file.c: rename from sha1-file.c, 2020-12-31) which was merged in 8b327f1784 (Merge branch 'ma/sha1-is-a-hash', 2021-01-15) --- object-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-file.c b/object-file.c index c3d866a287..da8821cb91 100644 --- a/object-file.c +++ b/object-file.c @@ -2425,7 +2425,7 @@ struct oidtree *odb_loose_cache(struct object_directory *odb, struct strbuf buf = STRBUF_INIT; size_t word_bits = bitsizeof(odb->loose_objects_subdir_seen[0]); size_t word_index = subdir_nr / word_bits; - size_t mask = 1u << (subdir_nr % word_bits); + size_t mask = (size_t)1u << (subdir_nr % word_bits); uint32_t *bitmap; if (subdir_nr < 0 ||