All of lore.kernel.org
 help / color / mirror / Atom feed
From: Varsha Rao <rvarsha016@gmail.com>
To: outreachy-kernel <outreachy-kernel@googlegroups.com>
Cc: rvarsha016@gmail.com, mawilcox@microsoft.com
Subject: Re: [Outreachy kernel] [PATCH v2 2/3] kernel: pid: Change function return value to bool.
Date: Mon, 27 Mar 2017 06:47:56 -0700 (PDT)	[thread overview]
Message-ID: <d9905b6f-434e-4943-8c78-8a35bcddfe24@googlegroups.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1703271003090.3387@hadrien>


[-- Attachment #1.1: Type: text/plain, Size: 1167 bytes --]



On Monday, March 27, 2017 at 1:35:06 PM UTC+5:30, Julia Lawall wrote:
>
>
>
> On Mon, 27 Mar 2017, Varsha Rao wrote: 
>
> > 
> >       On Mon, 27 Mar 2017, Varsha Rao wrote: 
> > 
> >       > Remove unsign cast and add bool as return type for 
> >       pid_before() 
> >       > function. 
> > 
> >       unsign -> unsigned.  But are you sure that the change is 
> >       correct?  For 
> >       example -1 < 1 but (unsigned) -1 > (unsigned) 1. 
> > 
> > 
> >    The change is incorrect. I will make both the differences as absolute 
> >    value, I guess then the change will be correct. 
>
> Not sure.  You would have to provide an argument as to why the change is 
> correct.  Absolute value also requires some computation, while casting 
> requires none. 
>

The usage of unsigned is to increase range and consider positive value.
It would be better to use unsigned int only.

If unsigned int is used, a - base won't exceed MAXUINT value and therefore
there will be no negative result. As a, b and base are of type int. 
(a - base + MAXUINT) % MAXUINT < (b - base + MAXUINT) % MAXUINT

If abs is considered then the range would decrease.

Thanks,
Varsha Rao

[-- Attachment #1.2: Type: text/html, Size: 1510 bytes --]

  reply	other threads:[~2017-03-27 13:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1490581288.git.rvarsha016@gmail.com>
2017-03-27  2:36 ` [PATCH v2 1/3] kernel: pid: Update documentation Varsha Rao
2017-03-27  5:42   ` [Outreachy kernel] " Julia Lawall
2017-03-27  5:51     ` Julia Lawall
2017-03-27 15:50   ` Matthew Wilcox
2017-03-27  2:44 ` [PATCH v2 2/3] kernel: pid: Change function return value to bool Varsha Rao
2017-03-27  5:30   ` [Outreachy kernel] " Julia Lawall
2017-03-27  7:54     ` Varsha Rao
2017-03-27  8:04       ` Julia Lawall
2017-03-27 13:47         ` Varsha Rao [this message]
2017-03-27 13:56           ` Varsha Rao
2017-03-27 21:48             ` Julia Lawall
2017-03-27 21:35           ` Julia Lawall
2017-03-27  2:45 ` [PATCH v2 3/3] kernel: pid: Add blank line after declarations Varsha Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9905b6f-434e-4943-8c78-8a35bcddfe24@googlegroups.com \
    --to=rvarsha016@gmail.com \
    --cc=mawilcox@microsoft.com \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.