Skip to content
Permalink
Browse files
  • Loading branch information
Cristy committed Oct 13, 2019
1 parent 91ae12c commit 8c6e86f81968fab1710317d87b00c608108e6a2a
Showing with 19 additions and 19 deletions.
  1. +19 −19 magick/quantum-private.h
@@ -327,7 +327,7 @@ static inline QuantumAny ScaleQuantumToAny(const Quantum quantum,
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((QuantumAny) ((MagickRealType) range*quantum/QuantumRange));
#else
if (quantum <= 0.0)
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return((QuantumAny) 0UL);
if (((MagickRealType) range*quantum/QuantumRange) >= 18446744073709551615.0)
return((QuantumAny) MagickULLConstant(18446744073709551615));
@@ -368,8 +368,8 @@ static inline unsigned int ScaleQuantumToLong(const Quantum quantum)
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((unsigned int) (16843009UL*quantum));
#else
if (quantum <= 0.0)
return(0UL);
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0U);
if ((16843009.0*quantum) >= 4294967295.0)
return(4294967295UL);
return((unsigned int) (16843009.0*quantum+0.5));
@@ -383,8 +383,8 @@ static inline unsigned int ScaleQuantumToMap(const Quantum quantum)
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((unsigned int) quantum);
#else
if (quantum < 0.0)
return(0UL);
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0U);
return((unsigned int) (quantum+0.5));
#endif
}
@@ -394,7 +394,7 @@ static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((unsigned short) (257UL*quantum));
#else
if (quantum <= 0.0)
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0);
if ((257.0*quantum) >= 65535.0)
return(65535);
@@ -447,8 +447,8 @@ static inline unsigned int ScaleQuantumToLong(const Quantum quantum)
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((unsigned int) (65537UL*quantum));
#else
if (quantum <= 0.0)
return(0UL);
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0U);
if ((65537.0*quantum) >= 4294967295.0)
return(4294967295U);
return((unsigned int) (65537.0*quantum+0.5));
@@ -462,8 +462,8 @@ static inline unsigned int ScaleQuantumToMap(const Quantum quantum)
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((unsigned int) quantum);
#else
if (quantum < 0.0)
return(0UL);
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0U);
return((unsigned int) (quantum+0.5));
#endif
}
@@ -473,7 +473,7 @@ static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((unsigned short) quantum);
#else
if (quantum <= 0.0)
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0);
if (quantum >= 65535.0)
return(65535);
@@ -518,8 +518,8 @@ static inline unsigned int ScaleQuantumToLong(const Quantum quantum)
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((unsigned int) quantum);
#else
if (quantum <= 0.0)
return(0);
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0U);
if ((quantum) >= 4294967295.0)
return(4294967295);
return((unsigned int) (quantum+0.5));
@@ -528,8 +528,8 @@ static inline unsigned int ScaleQuantumToLong(const Quantum quantum)

static inline unsigned int ScaleQuantumToMap(const Quantum quantum)
{
if (quantum < 0.0)
return(0UL);
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0U);
if ((quantum/65537) >= (Quantum) MaxMap)
return((unsigned int) MaxMap);
#if !defined(MAGICKCORE_HDRI_SUPPORT)
@@ -546,7 +546,7 @@ static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
return((unsigned short) ((quantum+MagickULLConstant(32768))/
MagickULLConstant(65537)));
#else
if (quantum <= 0.0)
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0);
if ((quantum/65537.0) >= 65535.0)
return(65535);
@@ -589,16 +589,16 @@ static inline unsigned int ScaleQuantumToLong(const Quantum quantum)

static inline unsigned int ScaleQuantumToMap(const Quantum quantum)
{
if (quantum <= 0.0)
return(0UL);
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0U);
if ((quantum/281479271743489.0) >= MaxMap)
return((unsigned int) MaxMap);
return((unsigned int) (quantum/281479271743489.0+0.5));
}

static inline unsigned short ScaleQuantumToShort(const Quantum quantum)
{
if (quantum <= 0.0)
if ((IsNaN(quantum) != MagickFalse) || (quantum <= 0.0))
return(0);
if ((quantum/281479271743489.0) >= 65535.0)
return(65535);

0 comments on commit 8c6e86f

Please sign in to comment.