* [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c
@ 2025-02-12 19:28 Moumita
2025-02-12 19:28 ` [PATCH 1/1] commit-reach: use unsigned int for flags in paint_down_to_common() Moumita
2025-02-12 21:16 ` [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c Junio C Hamano
0 siblings, 2 replies; 3+ messages in thread
From: Moumita @ 2025-02-12 19:28 UTC (permalink / raw)
To: git; +Cc: Moumita
The `flags` variable holds multiple bitwise flags (PARENT1, PARENT2, STALE),these flags are defined using (1u << N), so maybe there will be no issues if it is changed from `int` to `unsigned int`
Moumita (1):
commit-reach: use unsigned int for flags in paint_down_to_common()
commit-reach.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.48.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] commit-reach: use unsigned int for flags in paint_down_to_common()
2025-02-12 19:28 [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c Moumita
@ 2025-02-12 19:28 ` Moumita
2025-02-12 21:16 ` [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Moumita @ 2025-02-12 19:28 UTC (permalink / raw)
To: git; +Cc: Moumita, Abhishek Kumar, Taylor Blau, Junio C Hamano,
Derrick Stolee
The `flags` variable in `paint_down_to_common()` stores bitwise flags
(PARENT1, PARENT2, and STALE), which are defined as `(1u << N)`.
Since these are already unsigned values,`flags` can also be declared as
`unsigned int` instead of `int`.
Signed-off-by: Moumita <dhar61595@gmail.com>
---
commit-reach.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit-reach.c b/commit-reach.c
index a339e41aa4..a4aaae2737 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -79,7 +79,7 @@ static int paint_down_to_common(struct repository *r,
while (queue_has_nonstale(&queue)) {
struct commit *commit = prio_queue_get(&queue);
struct commit_list *parents;
- int flags;
+ unsigned int flags;
timestamp_t generation = commit_graph_generation(commit);
if (min_generation && generation > last_gen)
--
2.48.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c
2025-02-12 19:28 [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c Moumita
2025-02-12 19:28 ` [PATCH 1/1] commit-reach: use unsigned int for flags in paint_down_to_common() Moumita
@ 2025-02-12 21:16 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2025-02-12 21:16 UTC (permalink / raw)
To: Moumita; +Cc: git
Moumita <dhar61595@gmail.com> writes:
> The `flags` variable holds multiple bitwise flags (PARENT1,
> PARENT2, STALE),these flags are defined using (1u << N), so maybe
> there will be no issues if it is changed from `int` to `unsigned
> int`
"This change will not break" is not a good reason to make the
change, though, as not making that change will not break anything,
either.
If you need to write something, say something that positively
justifies the change, explaining readers why it is a good thing to
do, and how the resulting code is _better_ than the original.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-12 21:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 19:28 [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c Moumita
2025-02-12 19:28 ` [PATCH 1/1] commit-reach: use unsigned int for flags in paint_down_to_common() Moumita
2025-02-12 21:16 ` [PATCH 0/1] [GSOC] Use unsigned type for bit flags in commit-reach.c Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox