Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Dec 2008 09:18:49 -0800
From:      "Maksim Yevmenkin" <maksim.yevmenkin@gmail.com>
To:        "Eygene Ryabinkin" <rea-fbsd@codelabs.ru>
Cc:        Garrett Cooper <yanefbsd@gmail.com>, "current@freebsd.org" <current@freebsd.org>
Subject:   Re: RFC: small syscons and kbd patch
Message-ID:  <bb4a86c70812040918n793dfd40i9f163bb7e206fbbb@mail.gmail.com>
In-Reply-To: <XyF%2B8oK9MN%2BR7Vvh5BW2XWkYOoE@yY%2BfOhC1VHEMJMRMqdV4xmT5mXM>
References:  <bb4a86c70812021701i621fdcfjb6a58a7f5cf781d5@mail.gmail.com> <7d6fde3d0812040324y3bf0901cy1f4a6d961362c314@mail.gmail.com> <XyF%2B8oK9MN%2BR7Vvh5BW2XWkYOoE@yY%2BfOhC1VHEMJMRMqdV4xmT5mXM>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 4, 2008 at 3:33 AM, Eygene Ryabinkin <rea-fbsd@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
>    {_.-``-'         {_/            #
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb4a86c70812040918n793dfd40i9f163bb7e206fbbb>