[PATCH] Use "all_zero()"

Simo simo at samba.org
Wed Jan 4 19:06:23 UTC 2017


On Mon, 2017-01-02 at 15:37 +0100, Volker Lendecke wrote:
> Hi!
> 
> A few days ago I found the "all_zero()" routine. This patchset
> replaces
> all "memcmp(zeros, ..)" with a call to all_zeros().
> 
> Two reasons: First I find the "all_zeros" metaphor nice to read, much
> nicer than memcmp(zeros...)==0 or "!=0". Second, probably not
> measurable:
> I think all_zero() is more cache-friendly. We don't have to read in
> stuff from main memory that we know is 0.
> 
> Review appreciated!
> 
> Thanks, Volker

Will all_zero() be optimized by the compiler like memcmp is ?
Why not call memcmp() from all_zero() instead of building a custom for
loop  ?

Simo.



More information about the samba-technical mailing list