[babl] base: remove commented out single/half code



commit 3d739ec92e86afecf0a504cab61173fe4ba34348
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Jan 16 12:08:06 2016 +0100

    base: remove commented out single/half code

 babl/base/type-half.c |  108 -------------------------------------------------
 1 files changed, 0 insertions(+), 108 deletions(-)
---
diff --git a/babl/base/type-half.c b/babl/base/type-half.c
index 57b5d7d..ac20ec9 100644
--- a/babl/base/type-half.c
+++ b/babl/base/type-half.c
@@ -129,114 +129,6 @@ static void doubles2halfp(void *target, void *source, long numel)
     }
 }
 
-#if 0
-//-----------------------------------------------------------------------------
-
-static void halfp2singles(void *target, void *source, long numel)
-{
-    uint16_t *hp = (uint16_t *) source; // Type pun input as an unsigned 16-bit int
-    uint32_t *xp = (uint32_t *) target; // Type pun output as an unsigned 32-bit int
-    uint16_t h, hs, he, hm;
-    uint32_t xs, xe, xm;
-    int32_t xes;
-    int e;
-    
-    if( source == NULL || target == NULL ) // Nothing to convert (e.g., imag part of pure real)
-        return;
-    while( numel-- ) {
-        h = *hp++;
-        if( (h & 0x7FFFu) == 0 ) {  // Signed zero
-            *xp++ = ((uint32_t) h) << 16;  // Return the signed zero
-        } else { // Not zero
-            hs = h & 0x8000u;  // Pick off sign bit
-            he = h & 0x7C00u;  // Pick off exponent bits
-            hm = h & 0x03FFu;  // Pick off mantissa bits
-            if( he == 0 ) {  // Denormal will convert to normalized
-                e = -1; // The following loop figures out how much extra to adjust the exponent
-                do {
-                    e++;
-                    hm <<= 1;
-                } while( (hm & 0x0400u) == 0 ); // Shift until leading bit overflows into exponent bit
-                xs = ((uint32_t) hs) << 16; // Sign bit
-                xes = ((int32_t) (he >> 10)) - 15 + 127 - e; // Exponent unbias the halfp, then bias the 
single
-                xe = (uint32_t) (xes << 23); // Exponent
-                xm = ((uint32_t) (hm & 0x03FFu)) << 13; // Mantissa
-                *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits
-            } else if( he == 0x7C00u ) {  // Inf or NaN (all the exponent bits are set)
-                if( hm == 0 ) { // If mantissa is zero ...
-                    *xp++ = (((uint32_t) hs) << 16) | ((uint32_t) 0x7F800000u); // Signed Inf
-                } else {
-                    *xp++ = (uint32_t) 0xFFC00000u; // NaN, only 1st mantissa bit set
-                }
-            } else { // Normalized number
-                xs = ((uint32_t) hs) << 16; // Sign bit
-                xes = ((int32_t) (he >> 10)) - 15 + 127; // Exponent unbias the halfp, then bias the single
-                xe = (uint32_t) (xes << 23); // Exponent
-                xm = ((uint32_t) hm) << 13; // Mantissa
-                *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits
-            }
-        }
-    }
-}
-
-static void singles2halfp(void *target, void *source, long numel)
-{
-    uint16_t *hp = (uint16_t *) target; // Type pun output as an unsigned 16-bit int
-    uint32_t *xp = (uint32_t *) source; // Type pun input as an unsigned 32-bit int
-    uint16_t    hs, he, hm;
-    uint32_t x, xs, xe, xm;
-    int hes;
-    
-    if( source == NULL || target == NULL ) { // Nothing to convert (e.g., imag part of pure real)
-        return;
-    }
-    while( numel-- ) {
-        x = *xp++;
-        if( (x & 0x7FFFFFFFu) == 0 ) {  // Signed zero
-            *hp++ = (uint16_t) (x >> 16);  // Return the signed zero
-        } else { // Not zero
-            xs = x & 0x80000000u;  // Pick off sign bit
-            xe = x & 0x7F800000u;  // Pick off exponent bits
-            xm = x & 0x007FFFFFu;  // Pick off mantissa bits
-            if( xe == 0 ) {  // Denormal will underflow, return a signed zero
-                *hp++ = (uint16_t) (xs >> 16);
-            } else if( xe == 0x7F800000u ) {  // Inf or NaN (all the exponent bits are set)
-                if( xm == 0 ) { // If mantissa is zero ...
-                    *hp++ = (uint16_t) ((xs >> 16) | 0x7C00u); // Signed Inf
-                } else {
-                    *hp++ = (uint16_t) 0xFE00u; // NaN, only 1st mantissa bit set
-                }
-            } else { // Normalized number
-                hs = (uint16_t) (xs >> 16); // Sign bit
-                hes = ((int)(xe >> 23)) - 127 + 15; // Exponent unbias the single, then bias the halfp
-                if( hes >= 0x1F ) {  // Overflow
-                    *hp++ = (uint16_t) ((xs >> 16) | 0x7C00u); // Signed Inf
-                } else if( hes <= 0 ) {  // Underflow
-                    if( (14 - hes) > 24 ) {  // Mantissa shifted all the way off & no rounding possibility
-                        hm = (uint16_t) 0u;  // Set mantissa to zero
-                    } else {
-                        xm |= 0x00800000u;  // Add the hidden leading bit
-                        hm = (uint16_t) (xm >> (14 - hes)); // Mantissa
-                        if( (xm >> (13 - hes)) & 0x00000001u ) // Check for rounding
-                            hm += (uint16_t) 1u; // Round, might overflow into exp bit, but this is OK
-                    }
-                    *hp++ = (hs | hm); // Combine sign bit and mantissa bits, biased exponent is zero
-                } else {
-                    he = (uint16_t) (hes << 10); // Exponent
-                    hm = (uint16_t) (xm >> 13); // Mantissa
-                    if( xm & 0x00001000u ) // Check for rounding
-                        *hp++ = (hs | he | hm) + (uint16_t) 1u; // Round, might overflow to inf, this is OK
-                    else
-                        *hp++ = (hs | he | hm);  // No rounding
-                }
-            }
-        }
-    }
-}
-#endif
-
-//-----------------------------------------------------------------------------
-
 static void halfp2doubles(void *target, void *source, long numel)
 {
     uint16_t *hp = (uint16_t *) source; // Type pun input as an unsigned 16-bit int


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