RE: [PATCH 3/4] bpf, docs: Use consistent names for the same field

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

 



sdf@xxxxxxxxxx wrote: 
> >   ``BPF_ADD | BPF_X | BPF_ALU`` means::
> 
> > -  dst_reg = (u32) dst_reg + (u32) src_reg;
> > +  dst = (u32) (dst + src)
> 
> IIUC, by going from (u32) + (u32) to (u32)(), we want to signal that the value
> will just wrap around? 

Right.  In particular the old line could be confusing if one misinterpreted it as
saying that the addition could overflow into a higher bit.  The new line is intended
to be unambiguous that the upper 32 bits are 0.

> But isn't it more confusing now because it's unclear
> what the sign of the dst/src is (s32 vs u32)?

As stated the upper 32 bits have to be 0, just as any other u32 assignment.

> Also, we do keep (u32) ^ (u32) for BPF_XOR below..

Well for XOR it's equivalent either way so didn't need a change.

Thanks for reviewing,
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