( )⚙ D4003 index: write expression for encoded revision index consistently

This is an archive of the discontinued Mercurial Phabricator instance.

index: write expression for encoded revision index consistently
ClosedPublic

Authored by martinvonz on Aug 1 2018, 12:43 PM.

Details

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Aug 1 2018, 12:43 PM
pulkit accepted this revision.Aug 1 2018, 4:48 PM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Aug 2 2018, 8:57 AM
  • n->children[k] = -rev - 1;

+ n->children[k] = -(rev + 1);

This is technically less correct since (MAX_INT + 1) overflows, but maybe
we don't care?

In D4003#62821, @yuja wrote:
  • n->children[k] = -rev - 1;

+ n->children[k] = -(rev + 1);

This is technically less correct since (MAX_INT + 1) overflows, but maybe
we don't care?

Good point, I had not noticed before that the encoding was using one form and the decoding was using the other and the reason was almost certainly to avoid integer overflow. It won't be relevant after D4005, but I'll dequeue this patch and update D4004 and D4005.