linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/4] exfat: Simplify exfat_utf8_d_hash() for code points above U+FFFF
@ 2020-04-03  2:18 Kohada.Tetsuhiro
  2020-04-03 20:40 ` Pali Rohár
  0 siblings, 1 reply; 22+ messages in thread
From: Kohada.Tetsuhiro @ 2020-04-03  2:18 UTC (permalink / raw)
  To: 'pali@kernel.org'
  Cc: 'linux-fsdevel@vger.kernel.org',
	'linux-kernel@vger.kernel.org',
	'namjae.jeon@samsung.com',
	'sj1557.seo@samsung.com',
	'viro@zeniv.linux.org.uk'


> I guess it was designed for 8bit types, not for long (64bit types) and
> I'm not sure how effective it is even for 16bit types for which it is
> already used.

In partial_name_hash (), when 8bit value or 16bit value is specified, 
upper 8-12bits tend to be 0.

> So question is, what should we do for either 21bit number (one Unicode
> code point = equivalent of UTF-32) or for sequence of 16bit numbers
> (UTF-16)?

If you want to get an unbiased hash value by specifying an 8 or 16-bit value,
the hash32() function is a good choice.
ex1: Prepare by hash32 () function.
   hash = partial_name_hash (hash32 (val16,32), hash);
ex2: Use the hash32() function directly.
   hash + = hash32 (val16,32);

> partial_name_hash(unsigned long c, unsigned long prevhash)
> {
>	return (prevhash + (c << 4) + (c >> 4)) * 11;
> }

Another way may replace partial_name_hash().

	return prevhash + hash32(c,32)


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-04-15 23:43 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200317222604epcas1p1559308b0199c5320a9c77f5ad9f033a2@epcas1p1.samsung.com>
2020-03-17 22:25 ` [PATCH 0/4] Fixes for exfat driver Pali Rohár
2020-03-17 22:25   ` [PATCH 1/4] exfat: Simplify exfat_utf8_d_hash() for code points above U+FFFF Pali Rohár
2020-03-18  0:09     ` Al Viro
2020-03-18  9:32       ` Pali Rohár
2020-03-28 23:40         ` Pali Rohár
2020-03-17 22:25   ` [PATCH 2/4] exfat: Simplify exfat_utf8_d_cmp() " Pali Rohár
2020-03-17 22:25   ` [PATCH 3/4] exfat: Remove unused functions exfat_high_surrogate() and exfat_low_surrogate() Pali Rohár
2020-03-17 22:25   ` [PATCH 4/4] exfat: Fix discard support Pali Rohár
2020-03-17 23:20   ` [PATCH 0/4] Fixes for exfat driver Namjae Jeon
2020-04-15  8:01     ` Pali Rohár
2020-04-15 23:43       ` Namjae Jeon
2020-04-03  2:18 [PATCH 1/4] exfat: Simplify exfat_utf8_d_hash() for code points above U+FFFF Kohada.Tetsuhiro
2020-04-03 20:40 ` Pali Rohár
2020-04-06  9:37   ` Kohada.Tetsuhiro
2020-04-07 10:06     ` Pali Rohár
2020-04-08  3:59       ` Kohada.Tetsuhiro
2020-04-08  9:04         ` Pali Rohár
2020-04-13  8:13           ` Kohada.Tetsuhiro
2020-04-13 10:10             ` Pali Rohár
2020-04-14  9:29               ` Kohada.Tetsuhiro
2020-04-14  9:47                 ` Pali Rohár
2020-04-15  7:46                   ` Kohada.Tetsuhiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).