bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22689: [PATCH] Add logcount


From: Benjamin Riefenstahl
Subject: bug#22689: [PATCH] Add logcount
Date: Sat, 30 Sep 2017 18:50:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)

Hi Mark,

Just a drive-by note:

Mark Oteiza writes:
> +    {
> +      unsigned int count;
> +      for (count = 0; v; count++)
> +        {
> +          v &= v - 1;
> +        }
> +      XSETINT (res, v);
> +    }

Isn't this a fancy way of just saying "XSETINT (res, 0)"?  The variable
"count" is incremented but never used, so without it the loop
degenerates to

      while (v)
        {
          v &= v - 1;
        }

I other words, this just loops until "v == 0".

Maybe that assignment should be "XSETINT (res, count)"?  That would
actually use the variable "count".

benny





reply via email to

[Prev in Thread] Current Thread [Next in Thread]