RE: [PATCH bpf-next] Shift operations are defined to use a mask

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

 



Yonghong Song <yhs@xxxxxxxx> wrote:
> On 5/9/23 11:08 AM, Dave Thaler wrote:
> > From: Dave Thaler <dthaler@xxxxxxxxxxxxx>
> >
> > Update the documentation regarding shift operations to explain the use
> > of a mask, since otherwise shifting by a value out of range (like
> > negative) is undefined.
> >
> > Signed-off-by: Dave Thaler <dthaler@xxxxxxxxxxxxx>
> 
> LGTM with a few nit below.
> 
> Acked-by: Yonghong Song <yhs@xxxxxx>
[...]
> > -BPF_ARSH  0xc0   sign extending shift right
> > +BPF_ARSH  0xc0   sign extending dst >>= (src & mask)
> 
> 		    dst s>>= (src & mask)
> ?

I had thought about that, but based on Jose's LSF/MM/BPF 
presentation yesterday there are multiple such syntaxes.

">>=" vs "s>>=" is only one of several.  There's ">>" vs ">>>",
there's assembly-like, etc.   So I thought that it would take
more text to define "s>>" as meaning signing extending right
shift, than just saying sign extending ">>=" here.  And I didn't
want to just assume the reader knows what "s>>" means
without defining it since neither the C standard nor gcc use
"s>>".

Thanks for the Ack.

Dave





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux