emacs-devel
[Top][All Lists]
Advanced

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

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


From: Keith David Bershatsky
Subject: Re: How to quickly compare equality of structs ...
Date: Mon, 06 May 2019 13:40:07 -0700

Thank you, Paul, for having a look at this particular thread.

I had read on Stackoverflow that memcmp is not always reliable, and that is why 
I was trying to come up with a quick and guaranteed method of doing the 
comparison of data for each fake cursor in the new/old caches:

https://stackoverflow.com/a/141791/2112489

In the accepted answer, it says that C provides no method for comparing 
equality of structs ...

My only experience with a hash table has been in Lisp by setting up a unique 
key per each entry in the table; e.g., make-hash-table, gethash, puthash ....  
The old cache and new cache will most likely have a different number of fake 
cursors and the order in which they appear will also be different; e.g., 200 
fake cursors in the old cache and 250 fake cursors in the new cache.  Based on 
my limited experience with hash tables in Lisp, I am unable to visualize how I 
could use such a table in C to do my comparison for each fake cursor ....

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [05-06-2019 12:00:11] <6 May 2019 12:00:11 -0700>
> From: Paul Eggert <address@hidden>
> To: Keith David Bershatsky <address@hidden>
> Cc: Emacs Devel <address@hidden>
> Subject: Re: How to quickly compare equality of structs ...
> 
> On 5/6/19 11:55 AM, Keith David Bershatsky wrote:
> > PROBLEM:  If the tentative plan makes good sense, then how can I 
> > programmatically turn a combination of int, enum, double and bool into one 
> > (1) unique numeric representation such as a SHA1 (Secure Hash Algorithm)?
> 
> It's not clear to me that hashing is needed here; why not just use
> memcmp? And if you do need hashing, why not just use an ordinary hash
> table rather than messing with cryptographic hashing?



reply via email to

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