[babl] base: half-float reference zero initialize lsb



commit 1d9e46419253420868515efe929e2c7f74798fc7
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sat Jan 16 19:33:25 2016 +0100

    base: half-float reference zero initialize lsb

 babl/base/type-half.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/babl/base/type-half.c b/babl/base/type-half.c
index ac20ec9..5c0d079 100644
--- a/babl/base/type-half.c
+++ b/babl/base/type-half.c
@@ -138,6 +138,8 @@ static void halfp2doubles(void *target, void *source, long numel)
     int32_t xes;
     int e;
 
+    if (next)
+      *xp = 0;
     xp += next;  // Little Endian adjustment if necessary
     
     if( source == NULL || target == NULL ) // Nothing to convert (e.g., imag part of pure real)
@@ -175,7 +177,9 @@ static void halfp2doubles(void *target, void *source, long numel)
                 *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits
             }
         }
-        *xp++ = 0; // Skip over and zero the remaining 32 bits of the mantissa
+        xp++; // Skip over and zero the remaining 32 bits of the mantissa
+        if (!next)
+          *xp = 0;
     }
 }
 


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