lkml.org 
[lkml]   [2022]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] pipe_fs_i.h: add pipe_buf_init()
On Sun, Mar 13, 2022 at 02:48:10AM +0000, Matthew Wilcox wrote:

> That's not equivalent. I think the better option here is to always
> initialise flags to 0 (and not have a parameter for it):
>
> pipe_buf_init(buf, page, 0, 0, &anon_pipe_buf_ops);
> if (is_packetized(filp))
> buf->flags = PIPE_BUF_FLAG_PACKET;
> else
> buf->flags = PIPE_BUF_FLAG_CAN_MERGE;

Not equivalent in which sense? IDGI... Your variant is basically

X = 0;
if (Y == constant)
X = 1;
else
X = 2;

If gcc can optimize that to

X = (Y == constant) ? 1 : 2;

it should be able to do the same to
X = 1;
if (Y != constant)
X = 2;

What obstacles are there, besides a (false) assumption that
X might alias Y? Which would apply to both variants... Granted, I'm
half-asleep right now, so I might be missing something obvious...

\
 
 \ /
  Last update: 2022-03-13 05:35    [W:0.130 / U:0.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site