Re: patch "tty: fix up atime/mtime mess, take four" added to tty-linus

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

 



On Sat, Mar 07, 2015 at 11:30:37AM -0800, Linus Torvalds wrote:
> On Fri, Mar 6, 2015 at 6:07 PM,  <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > +       unsigned long sec = get_seconds();
> > +       if (abs(sec - time->tv_sec) & ~7)
> >                 time->tv_sec = sec;
> 
> It does strike me that instead of
> 
>    abs(sec - time->tv_sec) & ~7
> 
> we could just do
> 
>     (sec ^ time->tv_sec) & ~7
> 
> which just simply says "do the two values differ in any other bits
> than the low three ones". Which is a lot easier to calculate.
> 
> It's not like this is some hugely performance-sensitive thing, of
> course, so I guess nobody cares.

But it makes it more obvious what is going on instead of the abs() call,
which made me have to think about it for an extra few seconds instead of
the ^ version.  I'll queue that up for the next merge window, thanks.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]