OSDN Git Service

Fix the code to avoid plus minus conversion if the result is already zero in the...
authorUng, Teng En <teng.en.ung@intel.com>
Thu, 18 Aug 2016 06:06:36 +0000 (14:06 +0800)
committerSean V Kelley <seanvk@posteo.de>
Thu, 18 Aug 2016 20:13:35 +0000 (13:13 -0700)
Signed-off-by: Ung, Teng En <teng.en.ung@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
src/intel_media_common.c

index 99293b2..8821bc4 100644 (file)
@@ -76,7 +76,7 @@ int intel_format_convert(float src, int out_int_bits, int out_frac_bits,int out_
      if(negative_flag)
          output_value = (~output_value + 1) & ((1 <<(out_int_bits + out_frac_bits)) -1);
 
-     if(out_sign_flag == 1 && negative_flag)
+     if(output_value != 0 && out_sign_flag == 1 && negative_flag)
      {
           output_value |= negative_flag <<(out_int_bits + out_frac_bits);
      }