Re: [POC] verifying UTF-8 using SIMD instructions - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: [POC] verifying UTF-8 using SIMD instructions
Date
Msg-id 8b5d6e4b-2478-38d1-8b3e-ce5132e3ce4c@iki.fi
Whole thread Raw
In response to Re: [POC] verifying UTF-8 using SIMD instructions  (John Naylor <john.naylor@enterprisedb.com>)
Responses Re: [POC] verifying UTF-8 using SIMD instructions
List pgsql-hackers
On 09/02/2021 22:08, John Naylor wrote:
> Maybe there's a smarter way to check for zeros in C. Or maybe be more 
> careful about cache -- running memchr() on the whole input first might 
> not be the best thing to do.

The usual trick is the haszero() macro here: 
https://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord. That's 
how memchr() is typically implemented, too.

- Heikki



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Custom compression methods
Next
From: Robert Haas
Date:
Subject: Re: Is txid_status() actually safe? / What is 011_crash_recovery.pl testing?