Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-09 Thread Junio C Hamano
Johannes Schindelin writes: > On Wed, 9 Oct 2019, Junio C Hamano wrote: > >> Johannes Schindelin writes: >> >> > FWIW I actually agree with Junio about the helper, but in hindsight I >> > could have used a better name (not one that is tied to the "index"). >> > Something like `unsigned_one_compl

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-09 Thread Johannes Schindelin
Hi Junio, On Wed, 9 Oct 2019, Junio C Hamano wrote: > Johannes Schindelin writes: > > > FWIW I actually agree with Junio about the helper, but in hindsight I > > could have used a better name (not one that is tied to the "index"). > > Something like `unsigned_one_complement()`. But of course, th

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-09 Thread Junio C Hamano
Johannes Schindelin writes: > FWIW I actually agree with Junio about the helper, but in hindsight I > could have used a better name (not one that is tied to the "index"). > Something like `unsigned_one_complement()`. But of course, that would > say _what_ it does, not _why_. I personally feel th

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-09 Thread Johannes Schindelin
Hi Hannes, On Wed, 9 Oct 2019, Johannes Sixt wrote: > Am 09.10.19 um 03:19 schrieb Junio C Hamano: > > Johannes Sixt writes: > > > After all, the primary purpose of > > inventing the encoder was to catch the arith overflow, wasn't it? > > That was *your* motivation for the helper function. But

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-09 Thread Johannes Schindelin
Hi Hannes, On Tue, 8 Oct 2019, Johannes Sixt wrote: > Am 08.10.19 um 08:48 schrieb Johannes Schindelin via GitGitGadget: > > We have just introduced the helper `index_pos_to_insert_pos()` to help > > avoiding underflows when returning `-1 - pos` for cases where we want to > > return an insert pos

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-09 Thread Johannes Schindelin
Hi Junio, On Wed, 9 Oct 2019, Junio C Hamano wrote: > Johannes Sixt writes: > > > We do not want to have it for *all* cases, where we return -1 - pos, but > > only for those cases, where the result was actually encoded by > > index_pos_to_insert_pos(). > > Yup, I agree with you that decoder sho

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-08 Thread Johannes Sixt
Am 09.10.19 um 03:19 schrieb Junio C Hamano: > Johannes Sixt writes: > >> We do not want to have it for *all* cases, where we return -1 - pos, but >> only for those cases, where the result was actually encoded by >> index_pos_to_insert_pos(). > > Yup, I agree with you that decoder should be fed

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-08 Thread Junio C Hamano
Johannes Sixt writes: > We do not want to have it for *all* cases, where we return -1 - pos, but > only for those cases, where the result was actually encoded by > index_pos_to_insert_pos(). Yup, I agree with you that decoder should be fed only the data emitted by the encoder. But shouldn't the

Re: [PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-08 Thread Johannes Sixt
Am 08.10.19 um 08:48 schrieb Johannes Schindelin via GitGitGadget: > We have just introduced the helper `index_pos_to_insert_pos()` to help > avoiding underflows when returning `-1 - pos` for cases where we want to > return an insert position, using the ones' complement (as `int`). We do not want

[PATCH 1/1] Add a helper to reverse index_pos_to_insert_pos()

2019-10-07 Thread Johannes Schindelin via GitGitGadget
From: Johannes Schindelin We have just introduced the helper `index_pos_to_insert_pos()` to help avoiding underflows when returning `-1 - pos` for cases where we want to return an insert position, using the ones' complement (as `int`). As pointed out during the review of the patch series that in