lkml.org 
[lkml]   [2019]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Make is_signed_type() simpler
On Sun, 29 Sep 2019 23:44:24 +0300
Alexey Dobriyan <adobriyan@gmail.com> wrote:

> On Sun, Sep 29, 2019 at 04:15:31PM -0400, Steven Rostedt wrote:
> > On Sun, 29 Sep 2019 23:06:19 +0300
> > Alexey Dobriyan <adobriyan@gmail.com> wrote:
> >
> > > * Simply compare -1 with 0,
> > > * Drop unnecessary parenthesis sets
> > >
> > > New macro leaves pointer as "unsigned type" but gives a warning,
> > > which should be fine because asking whether a pointer is signed is
> > > strange question.
> > >
> > > I'm not sure what's going on in the i915 driver, it is shipping kernel
> > > pointers to userspace.
> >
> > This tells us what the patch does, not why.
>
> Check the subject line.

I don't see how it's simpler.

-#define is_signed_type(type) (((type)(-1)) < (type)1)
+#define is_signed_type(type) ((type)-1 < 0)


Requires more rational that "make it simpler". Rewriting futex or tty
layer code would be something I would love to see, but just replacing
"(type)1" with "0" isn't worth the churn.

-- Steve

\
 
 \ /
  Last update: 2019-09-29 23:17    [W:0.042 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site