Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Modules/Core/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ include(CheckIncludeFiles)
check_include_files(fenv.h HAVE_FENV_H)
# check if the platform has some widely used header files
check_include_files("unistd.h" HAVE_UNISTD_H)
# check if the platform has the header file "stdint.h" which has been added as part of the C99 standard
check_include_files("stdint.h" HAVE_STDINT_H)
# every system should have this header
check_include_files("stddef.h" HAVE_STDDEF_H)
check_include_files("sys/types.h" HAVE_SYS_TYPES_H)


# Check if this platform support the sse2 rounding functions for 32 and 64 bits
Expand Down
58 changes: 1 addition & 57 deletions Modules/Core/Common/include/itkIntTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,11 @@

#include "itkMacro.h"

#if defined( ITK_HAVE_STDINT_H )
#include <stdint.h>
#else
// the system doesn't have the C or C++ version of stdint so lets use
// KWIML's macros for fixed widths
#include "itk_kwiml.h"

#ifdef ITK_HAVE_STDDEF_H
#include <cstddef>
#endif //ITK_HAVE_STDDEF_H

#endif // ITK_HAVE_CSTDINT

#include <cstdint>
#include <climits>

namespace itk
{
#if defined( ITK_HAVE_STDINT_H )

// Note: these types are technically optional in C99 stdint.h file. As
// such a try complile for their existence may be needed.
typedef::int8_t int8_t;
Expand Down Expand Up @@ -76,48 +62,6 @@ typedef::uintmax_t uintmax_t;
typedef::intptr_t intptr_t;
typedef::uintptr_t uintptr_t;

#else // ITK_HAVE_STDINT_H

/** Fixed width integer types. */
typedef KWIML_INT_int8_t int8_t;
typedef KWIML_INT_uint8_t uint8_t;
typedef KWIML_INT_int16_t int16_t;
typedef KWIML_INT_uint16_t uint16_t;
typedef KWIML_INT_int32_t int32_t;
typedef KWIML_INT_uint32_t uint32_t;
typedef KWIML_INT_int64_t int64_t;
typedef KWIML_INT_uint64_t uint64_t;

/** Types which are at least a certain size, these are preferred over
* fixed width. */
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef int16_t int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;

/** Types which are at least a certain size but may be greater if
* performace benefits, these are preferred over fixed width. */
typedef int8_t int_fast8_t;
typedef uint8_t uint_fast8_t;
typedef int16_t int_fast16_t;
typedef uint16_t uint_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast32_t;
typedef int64_t int_fast64_t;
typedef uint64_t uint_fast64_t;

/** Types which contain the largest represetable integer. */
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;

typedef::ptrdiff_t intptr_t;
typedef::size_t uintptr_t;

#endif // ITK_HAVE_STDINT_H

#if defined(ITK_USE_64BITS_IDS) && ((ULLONG_MAX != ULONG_MAX) || (LLONG_MAX != LONG_MAX))

Expand Down
31 changes: 13 additions & 18 deletions Modules/Core/Common/include/itkMathDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@
#include "itkIntTypes.h"
#include "itkNumericTraits.h"

#ifdef ITK_HAVE_FENV_H
// The Sun Studio CC compiler seems to have a bug where if cstdio is
// included stdio.h must also be included before fenv.h
#include <cstdio>
#include <fenv.h>
#endif /* ITK_HAVE_FENV_H */
#include <cfenv>

#if defined( ITK_HAVE_EMMINTRIN_H ) && !defined( ITK_WRAPPING_PARSER )
#include <emmintrin.h> // sse 2 intrinsics
Expand Down Expand Up @@ -175,15 +170,15 @@ CLANG_PRAGMA_POP

inline int32_t RoundHalfIntegerToEven_32(double x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
return _mm_cvtsd_si32( _mm_set_sd(x) );
}

inline int32_t RoundHalfIntegerToEven_32(float x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
return _mm_cvtss_si32( _mm_set_ss(x) );
Expand All @@ -193,7 +188,7 @@ inline int32_t RoundHalfIntegerToEven_32(float x)

inline int32_t RoundHalfIntegerToEven_32(double x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int32_t r;
Expand All @@ -203,7 +198,7 @@ inline int32_t RoundHalfIntegerToEven_32(double x)

inline int32_t RoundHalfIntegerToEven_32(float x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int32_t r;
Expand All @@ -215,7 +210,7 @@ inline int32_t RoundHalfIntegerToEven_32(float x)

inline int32_t RoundHalfIntegerToEven_32(double x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int32_t r;
Expand All @@ -229,7 +224,7 @@ inline int32_t RoundHalfIntegerToEven_32(double x)

inline int32_t RoundHalfIntegerToEven_32(float x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int32_t r;
Expand Down Expand Up @@ -279,15 +274,15 @@ inline int32_t Ceil_32(float x) { return Ceil_base< int32_t, float >(x); }

inline int64_t RoundHalfIntegerToEven_64(double x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
return _mm_cvtsd_si64( _mm_set_sd(x) );
}

inline int64_t RoundHalfIntegerToEven_64(float x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
return _mm_cvtss_si64( _mm_set_ss(x) );
Expand All @@ -297,7 +292,7 @@ inline int64_t RoundHalfIntegerToEven_64(float x)

inline int64_t RoundHalfIntegerToEven_64(double x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int64_t r;
Expand All @@ -307,7 +302,7 @@ inline int64_t RoundHalfIntegerToEven_64(double x)

inline int64_t RoundHalfIntegerToEven_64(float x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int64_t r;
Expand All @@ -319,7 +314,7 @@ inline int64_t RoundHalfIntegerToEven_64(float x)

inline int64_t RoundHalfIntegerToEven_64(double x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int64_t r;
Expand All @@ -333,7 +328,7 @@ inline int64_t RoundHalfIntegerToEven_64(double x)

inline int64_t RoundHalfIntegerToEven_64(float x)
{
#if defined( ITK_CHECK_FPU_ROUNDING_MODE ) && defined( HAVE_FENV_H )
#if defined( ITK_CHECK_FPU_ROUNDING_MODE )
itkAssertInDebugAndIgnoreInReleaseMacro(fegetround() == FE_TONEAREST);
#endif
int64_t r;
Expand Down
9 changes: 0 additions & 9 deletions Modules/Core/Common/src/itkConfigure.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,6 @@
#if ITK_CMAKEDEFINE_VAR_@HAVE_FENV_H@
# define ITK_HAVE_FENV_H
#endif /* HAVE_FENV_H */
#if ITK_CMAKEDEFINE_VAR_@HAVE_SYS_TYPES_H@
# define ITK_HAVE_SYS_TYPES_H
#endif /* HAVE_SYS_TYPES_H */
#if ITK_CMAKEDEFINE_VAR_@HAVE_STDINT_H@
# define ITK_HAVE_STDINT_H
#endif /* HAVE_STDINT_H */
#if ITK_CMAKEDEFINE_VAR_@HAVE_STDDEF_H@
# define ITK_HAVE_STDDEF_H
#endif /* HAVE_STDDEF_H */
#if ITK_CMAKEDEFINE_VAR_@HAVE_UNISTD_H@
# define ITK_HAVE_UNISTD_H
#endif /* HAVE_UNISTD_H */
Expand Down