[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to quickly compare equality of structs ...

From: Stefan Monnier
Subject: Re: How to quickly compare equality of structs ...
Date: Mon, 06 May 2019 20:49:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> This afternoon, I came across the Cantor's Pairing Function that can be used
> to create a unique ID for each fake cursor.  With that unique ID, I can
> limit the quantity of comparisons ....
>  n = ((x + y)*(x + y + 1)/2) + y

Not sure why you care about limiting the number of comparisons.
Replacing two comparisons with one-comparison-plus-two-mults (and
reducing the range of x and y to sqrt(MAXINT) along thre way) doesn't
sound like much of a win.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]