Re: [PATCH 1/2] string: add mem_is_zero() helper to check if memory area is all zeros

2024-05-27 Thread Jani Nikula
On Mon, 27 May 2024, Andy Shevchenko wrote: > On Mon, May 27, 2024 at 12:43 PM Jani Nikula wrote: >> >> Almost two thirds of the memchr_inv() usages check if the memory area is >> all zeros, with no interest in where in the buffer the first non-zero >> byte is located. Checking for !memchr_inv(s,

Re: [PATCH 1/2] string: add mem_is_zero() helper to check if memory area is all zeros

2024-05-27 Thread Andy Shevchenko
On Mon, May 27, 2024 at 12:43 PM Jani Nikula wrote: > > Almost two thirds of the memchr_inv() usages check if the memory area is > all zeros, with no interest in where in the buffer the first non-zero > byte is located. Checking for !memchr_inv(s, 0, n) is also not very > intuitive or discoverable

[PATCH 1/2] string: add mem_is_zero() helper to check if memory area is all zeros

2024-05-27 Thread Jani Nikula
Almost two thirds of the memchr_inv() usages check if the memory area is all zeros, with no interest in where in the buffer the first non-zero byte is located. Checking for !memchr_inv(s, 0, n) is also not very intuitive or discoverable. Add an explicit mem_is_zero() helper for this use case. Sign