All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org,  Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH v2] commit-graph: fix writing generations with dates exceeding 34 bits
Date: Tue, 24 Mar 2026 08:42:31 -0700	[thread overview]
Message-ID: <xmqq1ph92pzs.fsf@gitster.g> (raw)
In-Reply-To: <20260324-pks-commit-graph-overflow-v2-1-843568cf8780@pks.im> (Patrick Steinhardt's message of "Tue, 24 Mar 2026 07:18:26 +0100")

Patrick Steinhardt <ps@pks.im> writes:

> Changes in v2:
>   - Account for platforms where `timestamp_t` has 32 bit precision. This
>     matches logic in `write_graph_chunk_data()`, where we also depend on
>     the size of the commit timestamps.

> +static timestamp_t compute_generation_offset(struct commit *c)
> +{
> +	timestamp_t masked_date;
> +
> +	if (sizeof(timestamp_t) > 4)
> +		masked_date = c->date & (((timestamp_t) 1 << 34) - 1);
> +	else
> +		masked_date = c->date;

It is a bit surprising that on a platform where timestamp_t is only
32-bit wide, a smart-enough compiler would not find (1<<34) as
suspicious.  IOW, I would have expected this to be done not with
runtime switch but with conditional compilation.


  reply	other threads:[~2026-03-24 15:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 19:02 [PATCH] commit-graph: fix writing generations with dates exceeding 34 bits Patrick Steinhardt
2026-03-17 19:39 ` Junio C Hamano
2026-03-19  6:56   ` Patrick Steinhardt
2026-03-20 17:21     ` Derrick Stolee
2026-03-24  6:18 ` [PATCH v2] " Patrick Steinhardt
2026-03-24 15:42   ` Junio C Hamano [this message]
2026-03-25  5:36     ` Patrick Steinhardt
2026-03-26 10:02   ` Karthik Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq1ph92pzs.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.