git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fix diff-delta bad memory access

From
Linus Torvalds <torvalds@osdl.org>
Date
May 10, 2006, 19:01 UTC
Message-ID
<Pine.LNX.4.64.0605101159160.3718@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0605101311020.24505@localhost.localdomain>
Btw, Nico, that rabin hash code is _extremely_ confusing.

The hash entry pointers point to "data + RABIN_WINDOW", and then to make things even _more_ confusing, the hash calculation code is actually offset by one, so it will have computed the hash with

	val = ((val << 8) | data[i]) ^ T[val >> RABIN_SHIFT];
where "i" goes from _1_ to RABIN_WINDOW instead of 0..WINDOW-1.

So, if I read that correctly, the "entry->ptr" actually points not to the beginning of the data that was hashed, or even the end, but literally to the last byte of the data that was hashed in that window.

Isn't that just _really_ confusing?
Or is there some sense to this?
			Linus
Previous: Nicolas PitreNext: Nicolas Pitre
Message 5 of 7 in “fix diff-delta bad memory access”
  1. fix diff-delta bad memory accessNicolas Pitre, May 10, 2006
  2. Linus TorvaldsMay 10, 2006
  3. Linus TorvaldsMay 10, 2006
  4. Nicolas PitreMay 10, 2006
  5. Linus TorvaldsMay 10, 2006
  6. Nicolas PitreMay 10, 2006
  7. Nicolas PitreMay 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.