[Spice-devel] [spice-common 11/14] quic: Use i == 0 rather than !i

Christophe Fergeau cfergeau at redhat.com
Wed Jul 5 09:38:56 UTC 2017


On Wed, Jul 05, 2017 at 05:30:21AM -0400, Frediano Ziglio wrote:
> > 
> > This helps to make quic_rgb_tmpl.c and quic_tmpl.c more consistent.
> 
> Actually there are less occurrences of "i == 0" in these 2 files.
> But in the rest of the files I think X == 0 is more common.

I really focused on these specific "!i" VS "i == 0" constructs in these
files, as I was comparing the functions they are in, and this was one of
the differences. I did not look at all at other comparisons as they did
not show up while comparing the code in both files.

Christophe

> 
> > ---
> >  common/quic_rgb_tmpl.c | 8 ++++----
> >  common/quic_tmpl.c     | 2 +-
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
> > index 19c84e8..b2827eb 100644
> > --- a/common/quic_rgb_tmpl.c
> > +++ b/common/quic_rgb_tmpl.c
> > @@ -182,7 +182,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder,
> > int i,
> >  
> >      spice_assert(end - i > 0);
> >  
> > -    if (!i) {
> > +    if (i == 0) {
> >          unsigned int codeword, codewordlen;
> >  
> >          COMPRESS_ONE_ROW0_0(r);
> > @@ -294,7 +294,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, int
> > i,
> >  
> >      spice_assert(end - i > 0);
> >  
> > -    if (!i) {
> > +    if (i == 0) {
> >          unsigned int codeword, codewordlen;
> >  
> >          COMPRESS_ONE_0(r);
> > @@ -429,7 +429,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder,
> > int i,
> >  
> >      spice_assert(end - i > 0);
> >  
> > -    if (!i) {
> > +    if (i == 0) {
> >          unsigned int codewordlen;
> >  
> >          UNCOMPRESS_PIX_START(&cur_row[i]);
> > @@ -550,7 +550,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder,
> >  
> >      spice_assert(end - i > 0);
> >  
> > -    if (!i) {
> > +    if (i == 0) {
> >          unsigned int codewordlen;
> >  
> >          UNCOMPRESS_PIX_START(&cur_row[i]);
> > diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
> > index fc21c14..1d6cf77 100644
> > --- a/common/quic_tmpl.c
> > +++ b/common/quic_tmpl.c
> > @@ -187,7 +187,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder,
> > Channel *channel, int i,
> >  
> >      spice_assert(end - i > 0);
> >  
> > -    if (!i) {
> > +    if (i == 0) {
> >          unsigned int codeword, codewordlen;
> >  
> >          decorrelate_drow[0] = family.xlatU2L[(unsigned)((int)cur_row->a -
> 
> Acked
> 
> Frediano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170705/bceffd2a/attachment.sig>


More information about the Spice-devel mailing list