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

Frediano Ziglio fziglio at redhat.com
Wed Jul 5 09:30:21 UTC 2017


> 
> 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.

> ---
>  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


More information about the Spice-devel mailing list