Re: RFC: small syscons and kbd patch

From: Maksim Yevmenkin <maksim.yevmenkin_at_gmail.com>
Date: Thu, 4 Dec 2008 09:18:49 -0800
On Thu, Dec 4, 2008 at 3:33 AM, Eygene Ryabinkin <rea-fbsd_at_codelabs.ru> wrote:
> Garrett, good day.
>
> Thu, Dec 04, 2008 at 03:24:28AM -0800, Garrett Cooper wrote:
>> On Tue, Dec 2, 2008 at 5:01 PM, Maksim Yevmenkin
>>      Why are you double and triple negating on this line?
>> +     return (atomic_cmpset_acq_int(&kbd->kb_locked, !!!on, !!on));
>
> Double negation is easy -- !!N = 1 for int N != 0, so it is the way to
> turn N != 0 to one.

yep, that was the idea.

>  Triple negation?  I am out of guesses, because it
> seems redundant to me: !0 = 1, !5 = 0, so adding another two negations
> is seem to be worthless.

well, that's just silly typo (blame my sticky fingers). you are
correct single negation should work just as good :)

thanks for catching this guys, i fixed it.

thanks,
max


> --
> Eygene
>  _                ___       _.--.   #
>  \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
>  /  ' `         ,       __.--'      #  to read the on-line manual
>  )/' _/     \   `-_,   /            #  while single-stepping the kernel.
>  `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
>     _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
>    {_.-``-'         {_/            #
>
Received on Thu Dec 04 2008 - 16:18:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:38 UTC