src/ds++/Endian.cc
bool has_ieee_float_representation() {
  // start by assume IEEE platform (i.e.: not a Cray machine).
  bool i_am_ieee(true);

  // Create a double precision value that will be used to test bit representations.
  double d_two(2.0);
  size_t constexpr size(sizeof(double));
  // Generate a bit-by-bit view of the double precision value:
  std::array<char, size> char_two;
  std::memcpy(&char_two, &d_two, size);

  // IEEE reference value:
  std::array<char, size> ieee64_two = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40};
  if (is_big_endian())
    char_byte_swap(&ieee64_two[0], size);

  // Cray reference value:
  // Note The 5th value of the actual Cray representation causes overflow warnings on IEEE machines:
  // char cray64_two[size] = {0x00,0x00,0x00,0x00,0x00,0x80,0x02,0x40};

  for (size_t i = 0; i < size; ++i)
    if (char_two[i] != ieee64_two[i]) {
      i_am_ieee = false;
      break;
    }

  return i_am_ieee;
}
//------------------------------------------------------------------------------------------------//
/*!
 * \brief Does this platform support IEEE float representation?
 *
 * Some older Cray machines did not support the IEEE float representation.  This simple test will
 * identify machines that are IEEE compliant.
 *
 * \return true if we support IEEE float representation.
 */
\brief Does this platform support IEEE float representation.
Some older Cray machines did not support the IEEE float representation.  This simple test will
identify machines that are IEEE compliant.

\return true if we support IEEE float representation.
\ brief Does this platform support IEEE float representation . Some older Cray machines did not support the IEEE float representation . This simple test will identify machines that are IEEE compliant . \ return true if we support IEEE float representation .
bool has_ieee_float_representation() {
  bool i_am_ieee(true);
  double d_two(2.0);
  size_t constexpr size(sizeof(double));
  std::array<char, size> char_two;
  std::memcpy(&char_two, &d_two, size);
  std::array<char, size> ieee64_two = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40};
  if (is_big_endian())
    char_byte_swap(&ieee64_two[0], size);
  for (size_t i = 0; i < size; ++i)
    if (char_two[i] != ieee64_two[i]) {
      i_am_ieee = false;
      break;
    }
  return i_am_ieee;
}
bool has_ieee_float_representation ( ) { bool i_am_ieee ( true ) ; double d_two ( 2.0 ) ; size_t constexpr size ( sizeof ( double ) ) ; std :: array < char , size > char_two ; std :: memcpy ( & char_two , & d_two , size ) ; std :: array < char , size > ieee64_two = { 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x40 } ; if ( is_big_endian ( ) ) char_byte_swap ( & ieee64_two [ 0 ] , size ) ; for ( size_t i = 0 ; i < size ; ++ i ) if ( char_two [ i ] != ieee64_two [ i ] ) { i_am_ieee = false ; break ; } return i_am_ieee ; }
\brief Does this platform support IEEE float representation?
\ brief Does this platform support IEEE float representation?
// start by assume IEEE platform (i.e.: not a Cray machine). // Create a double precision value that will be used to test bit representations. // Generate a bit-by-bit view of the double precision value: // IEEE reference value: // Cray reference value: // Note The 5th value of the actual Cray representation causes overflow warnings on IEEE machines: // char cray64_two[size] = {0x00,0x00,0x00,0x00,0x00,0x80,0x02,0x40};