text:
// Predefined symbols and macros -*- C++ -*-

// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING.  If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction.  Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License.  This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _CPP_CPPCONFIG
#define _CPP_CPPCONFIG 1

// Pick up any OS-specific definitions.
#include <bits/os_defines.h>

// The current version of the C++ library in compressed ISO date format.
#define __GLIBCPP__ 20040531

// This is necessary until GCC supports separate template compilation.
#define _GLIBCPP_NO_TEMPLATE_EXPORT 1

// This is a hack around not having either pre-compiled headers or
// export compilation. If defined, the io, string, and valarray
// headers will include all the necessary bits. If not defined, the
// implementation optimizes the headers for the most commonly-used
// types. For the io library, this means that larger, out-of-line
// member functions are only declared, and definitions are not parsed
// by the compiler, but instead instantiated into the library binary.
#define _GLIBCPP_FULLY_COMPLIANT_HEADERS 1

// Allow use of the GNU syntax extension, "extern template." This
// extension is fully documented in the g++ manual, but in a nutshell,
// it inhibits all implicit instantiations and is used throughout the
// library to avoid multiple weak definitions for required types that
// are already explicitly instantiated in the library binary. This
// substantially reduces the binary size of resulting executables.
#ifndef _GLIBCPP_EXTERN_TEMPLATE
#define _GLIBCPP_EXTERN_TEMPLATE 1
#endif

// To enable older, ARM-style iostreams and other anachronisms use this.
//#define _GLIBCPP_DEPRECATED 1

// Use corrected code from the committee library group's issues list.
#define _GLIBCPP_RESOLVE_LIB_DEFECTS 1

// Hopefully temporary workaround to autoconf/m4 issue with quoting '@'.
#define _GLIBCPP_AT_AT "@@"

// In those parts of the standard C++ library that use a mutex instead
// of a spin-lock, we now unconditionally use GCC's gthr.h mutex
// abstraction layer.  All support to directly map to various
// threading models has been removed.  Note: gthr.h may well map to
// gthr-single.h which is a correct way to express no threads support
// in gcc.  Support for the undocumented _NOTHREADS has been removed.

// Default to the typically high-speed, pool-based allocator (as
// libstdc++-v2) instead of the malloc-based allocator (libstdc++-v3
// snapshots).  See libstdc++-v3/docs/html/17_intro/howto.html for
// details on why you don't want to override this setting.  Ensure
// that threads are properly configured on your platform before
// assigning blame to the STL container-memory allocator.  After doing
// so, please report any possible issues to libstdc++@gcc.gnu.org .
// Do not define __USE_MALLOC on the command line.  Enforce it here:
#ifdef __USE_MALLOC
#error __USE_MALLOC should never be defined.  Read the release notes.
#endif

// Create a boolean flag to be used to determine if --fast-math is set.
#ifdef __FAST_MATH__
#define _GLIBCPP_FAST_MATH 1
#else
#define _GLIBCPP_FAST_MATH 0
#endif

// The remainder of the prewritten config is mostly automatic; all the
// user hooks are listed above.

// End of prewritten config; the discovered settings follow.
/* config.h.  Generated automatically by configure.  */
/* config.h.in.  Generated automatically from configure.in by autoheader.  */

/* Define if you have a working `mmap' system call.  */
#define _GLIBCPP_HAVE_MMAP 1

// Define if GCC supports weak symbols.
/* #undef _GLIBCPP_SUPPORTS_WEAK */

// Include I/O support for 'long long' and 'unsigned long long'.
/* #undef _GLIBCPP_USE_LONG_LONG */

// Define if C99 features such as lldiv_t, llabs, lldiv should be exposed.
/* #undef _GLIBCPP_USE_C99 */

// Define if code specialized for wchar_t should be used.
/* #undef _GLIBCPP_USE_WCHAR_T */

// Define if using setrlimit to limit memory usage during 'make check'.
/* #undef _GLIBCPP_MEM_LIMITS */

// Define to use concept checking code from the boost libraries.
/* #undef _GLIBCPP_CONCEPT_CHECKS */

// Define to use symbol versioning in the shared library.
/* #undef _GLIBCPP_SYMVER */

// Define symbol versioning in assember directives. If symbol
// versioning is beigng used, and the assembler supports this kind of
// thing, then use it.
// NB: _GLIBCPP_AT_AT is a hack to work around quoting issues in m4.
#if _GLIBCPP_SYMVER
  #define _GLIBCPP_ASM_SYMVER(cur, old, version) \
   asm (".symver " #cur "," #old _GLIBCPP_AT_AT #version);
#else
  #define _GLIBCPP_ASM_SYMVER(cur, old, version)
#endif

// Define if gthr-default.h exists (meaning that threading support is enabled).
/* #undef _GLIBCPP_HAVE_GTHR_DEFAULT */

// Define if drand48 exists.
/* #undef _GLIBCPP_HAVE_DRAND48 */

// Define if getpagesize exists.
/* #undef _GLIBCPP_HAVE_GETPAGESIZE */

// Define if setenv exists.
/* #undef _GLIBCPP_HAVE_SETENV */

// Define if sigsetjmp exists.
/* #undef _GLIBCPP_HAVE_SIGSETJMP */

// Define if mbstate_t exists in wchar.h.
/* #undef _GLIBCPP_HAVE_MBSTATE_T */

// Define if you have the modff function.
#define _GLIBCPP_HAVE_MODFF 1

// Define if you have the modfl function.
/* #undef _GLIBCPP_HAVE_MODFL */

// Define if you have the expf function.
#define _GLIBCPP_HAVE_EXPF 1

// Define if you have the expl function.
/* #undef _GLIBCPP_HAVE_EXPL */

// Define if you have the hypotf function.
/* #undef _GLIBCPP_HAVE_HYPOTF */

// Define if you have the hypotl function.
/* #undef _GLIBCPP_HAVE_HYPOTL */

// Define if the compiler/host combination has __builtin_abs
/* #undef _GLIBCPP_HAVE___BUILTIN_ABS */

// Define if the compiler/host combination has __builtin_labs
/* #undef _GLIBCPP_HAVE___BUILTIN_LABS */

// Define if the compiler/host combination has __builtin_cos
/* #undef _GLIBCPP_HAVE___BUILTIN_COS */

// Define if the compiler/host combination has __builtin_cosf
/* #undef _GLIBCPP_HAVE___BUILTIN_COSF */

// Define if the compiler/host combination has __builtin_cosl
/* #undef _GLIBCPP_HAVE___BUILTIN_COSL */

// Define if the compiler/host combination has __builtin_fabs
/* #undef _GLIBCPP_HAVE___BUILTIN_FABS */

// Define if the compiler/host combination has __builtin_fabsf
/* #undef _GLIBCPP_HAVE___BUILTIN_FABSF */

// Define if the compiler/host combination has __builtin_fabsl
/* #undef _GLIBCPP_HAVE___BUILTIN_FABSL */

// Define if the compiler/host combination has __builtin_sin
/* #undef _GLIBCPP_HAVE___BUILTIN_SIN */

// Define if the compiler/host combination has __builtin_sinf
/* #undef _GLIBCPP_HAVE___BUILTIN_SINF */

// Define if the compiler/host combination has __builtin_sinl
/* #undef _GLIBCPP_HAVE___BUILTIN_SINL */

// Define if the compiler/host combination has __builtin_sqrt
/* #undef _GLIBCPP_HAVE___BUILTIN_SQRT */

// Define if the compiler/host combination has __builtin_sqrtf
/* #undef _GLIBCPP_HAVE___BUILTIN_SQRTF */

// Define if the compiler/host combination has __builtin_sqrtl
/* #undef _GLIBCPP_HAVE___BUILTIN_SQRTL */

// Define if poll is available in <poll.h>.
/* #undef _GLIBCPP_HAVE_POLL */

// Define if S_ISREG (Posix) is available in <sys/stat.h>.
/* #undef _GLIBCPP_HAVE_S_ISREG */

// Define if S_IFREG is available in <sys/stat.h>.
/* #undef _GLIBCPP_HAVE_S_IFREG */

// Define if LC_MESSAGES is available in <locale.h>.
/* #undef _GLIBCPP_HAVE_LC_MESSAGES */

/* Define if you have the __signbit function.  */
/* #undef _GLIBCPP_HAVE___SIGNBIT */

/* Define if you have the __signbitf function.  */
/* #undef _GLIBCPP_HAVE___SIGNBITF */

/* Define if you have the __signbitl function.  */
/* #undef _GLIBCPP_HAVE___SIGNBITL */

/* Define if you have the _acosf function.  */
/* #undef _GLIBCPP_HAVE__ACOSF */

/* Define if you have the _acosl function.  */
/* #undef _GLIBCPP_HAVE__ACOSL */

/* Define if you have the _asinf function.  */
/* #undef _GLIBCPP_HAVE__ASINF */

/* Define if you have the _asinl function.  */
/* #undef _GLIBCPP_HAVE__ASINL */

/* Define if you have the _atan2f function.  */
/* #undef _GLIBCPP_HAVE__ATAN2F */

/* Define if you have the _atan2l function.  */
/* #undef _GLIBCPP_HAVE__ATAN2L */

/* Define if you have the _atanf function.  */
/* #undef _GLIBCPP_HAVE__ATANF */

/* Define if you have the _atanl function.  */
/* #undef _GLIBCPP_HAVE__ATANL */

/* Define if you have the _ceilf function.  */
/* #undef _GLIBCPP_HAVE__CEILF */

/* Define if you have the _ceill function.  */
/* #undef _GLIBCPP_HAVE__CEILL */

/* Define if you have the _copysign function.  */
/* #undef _GLIBCPP_HAVE__COPYSIGN */

/* Define if you have the _copysignl function.  */
/* #undef _GLIBCPP_HAVE__COPYSIGNL */

/* Define if you have the _cosf function.  */
/* #undef _GLIBCPP_HAVE__COSF */

/* Define if you have the _coshf function.  */
/* #undef _GLIBCPP_HAVE__COSHF */

/* Define if you have the _coshl function.  */
/* #undef _GLIBCPP_HAVE__COSHL */

/* Define if you have the _cosl function.  */
/* #undef _GLIBCPP_HAVE__COSL */

/* Define if you have the _expf function.  */
/* #undef _GLIBCPP_HAVE__EXPF */

/* Define if you have the _expl function.  */
/* #undef _GLIBCPP_HAVE__EXPL */

/* Define if you have the _fabsf function.  */
/* #undef _GLIBCPP_HAVE__FABSF */

/* Define if you have the _fabsl function.  */
/* #undef _GLIBCPP_HAVE__FABSL */

/* Define if you have the _finite function.  */
/* #undef _GLIBCPP_HAVE__FINITE */

/* Define if you have the _finitef function.  */
/* #undef _GLIBCPP_HAVE__FINITEF */

/* Define if you have the _finitel function.  */
/* #undef _GLIBCPP_HAVE__FINITEL */

/* Define if you have the _floorf function.  */
/* #undef _GLIBCPP_HAVE__FLOORF */

/* Define if you have the _floorl function.  */
/* #undef _GLIBCPP_HAVE__FLOORL */

/* Define if you have the _fmodf function.  */
/* #undef _GLIBCPP_HAVE__FMODF */

/* Define if you have the _fmodl function.  */
/* #undef _GLIBCPP_HAVE__FMODL */

/* Define if you have the _fpclass function.  */
/* #undef _GLIBCPP_HAVE__FPCLASS */

/* Define if you have the _frexpf function.  */
/* #undef _GLIBCPP_HAVE__FREXPF */

/* Define if you have the _frexpl function.  */
/* #undef _GLIBCPP_HAVE__FREXPL */

/* Define if you have the _hypot function.  */
/* #undef _GLIBCPP_HAVE__HYPOT */

/* Define if you have the _hypotf function.  */
/* #undef _GLIBCPP_HAVE__HYPOTF */

/* Define if you have the _hypotl function.  */
/* #undef _GLIBCPP_HAVE__HYPOTL */

/* Define if you have the _isinf function.  */
/* #undef _GLIBCPP_HAVE__ISINF */

/* Define if you have the _isinff function.  */
/* #undef _GLIBCPP_HAVE__ISINFF */

/* Define if you have the _isinfl function.  */
/* #undef _GLIBCPP_HAVE__ISINFL */

/* Define if you have the _isnan function.  */
/* #undef _GLIBCPP_HAVE__ISNAN */

/* Define if you have the _isnanf function.  */
/* #undef _GLIBCPP_HAVE__ISNANF */

/* Define if you have the _isnanl function.  */
/* #undef _GLIBCPP_HAVE__ISNANL */

/* Define if you have the _ldexpf function.  */
/* #undef _GLIBCPP_HAVE__LDEXPF */

/* Define if you have the _ldexpl function.  */
/* #undef _GLIBCPP_HAVE__LDEXPL */

/* Define if you have the _log10f function.  */
/* #undef _GLIBCPP_HAVE__LOG10F */

/* Define if you have the _log10l function.  */
/* #undef _GLIBCPP_HAVE__LOG10L */

/* Define if you have the _logf function.  */
/* #undef _GLIBCPP_HAVE__LOGF */

/* Define if you have the _logl function.  */
/* #undef _GLIBCPP_HAVE__LOGL */

/* Define if you have the _modff function.  */
/* #undef _GLIBCPP_HAVE__MODFF */

/* Define if you have the _modfl function.  */
/* #undef _GLIBCPP_HAVE__MODFL */

/* Define if you have the _powf function.  */
/* #undef _GLIBCPP_HAVE__POWF */

/* Define if you have the _powl function.  */
/* #undef _GLIBCPP_HAVE__POWL */

/* Define if you have the _qfpclass function.  */
/* #undef _GLIBCPP_HAVE__QFPCLASS */

/* Define if you have the _sincos function.  */
/* #undef _GLIBCPP_HAVE__SINCOS */

/* Define if you have the _sincosf function.  */
/* #undef _GLIBCPP_HAVE__SINCOSF */

/* Define if you have the _sincosl function.  */
/* #undef _GLIBCPP_HAVE__SINCOSL */

/* Define if you have the _sinf function.  */
/* #undef _GLIBCPP_HAVE__SINF */

/* Define if you have the _sinhf function.  */
/* #undef _GLIBCPP_HAVE__SINHF */

/* Define if you have the _sinhl function.  */
/* #undef _GLIBCPP_HAVE__SINHL */

/* Define if you have the _sinl function.  */
/* #undef _GLIBCPP_HAVE__SINL */

/* Define if you have the _sqrtf function.  */
/* #undef _GLIBCPP_HAVE__SQRTF */

/* Define if you have the _sqrtl function.  */
/* #undef _GLIBCPP_HAVE__SQRTL */

/* Define if you have the _tanf function.  */
/* #undef _GLIBCPP_HAVE__TANF */

/* Define if you have the _tanhf function.  */
/* #undef _GLIBCPP_HAVE__TANHF */

/* Define if you have the _tanhl function.  */
/* #undef _GLIBCPP_HAVE__TANHL */

/* Define if you have the _tanl function.  */
/* #undef _GLIBCPP_HAVE__TANL */

/* Define if you have the acosf function.  */
#define _GLIBCPP_HAVE_ACOSF 1

/* Define if you have the acosl function.  */
/* #undef _GLIBCPP_HAVE_ACOSL */

/* Define if you have the asinf function.  */
#define _GLIBCPP_HAVE_ASINF 1

/* Define if you have the asinl function.  */
/* #undef _GLIBCPP_HAVE_ASINL */

/* Define if you have the atan2f function.  */
#define _GLIBCPP_HAVE_ATAN2F 1

/* Define if you have the atan2l function.  */
/* #undef _GLIBCPP_HAVE_ATAN2L */

/* Define if you have the atanf function.  */
#define _GLIBCPP_HAVE_ATANF 1

/* Define if you have the atanl function.  */
/* #undef _GLIBCPP_HAVE_ATANL */

/* Define if you have the btowc function.  */
/* #undef _GLIBCPP_HAVE_BTOWC */

/* Define if you have the ceilf function.  */
#define _GLIBCPP_HAVE_CEILF 1

/* Define if you have the ceill function.  */
/* #undef _GLIBCPP_HAVE_CEILL */

/* Define if you have the copysign function.  */
#define _GLIBCPP_HAVE_COPYSIGN 1

/* Define if you have the copysignf function.  */
#define _GLIBCPP_HAVE_COPYSIGNF 1

/* Define if you have the copysignl function.  */
/* #undef _GLIBCPP_HAVE_COPYSIGNL */

/* Define if you have the cosf function.  */
#define _GLIBCPP_HAVE_COSF 1

/* Define if you have the coshf function.  */
#define _GLIBCPP_HAVE_COSHF 1

/* Define if you have the coshl function.  */
/* #undef _GLIBCPP_HAVE_COSHL */

/* Define if you have the cosl function.  */
/* #undef _GLIBCPP_HAVE_COSL */

/* Define if you have the drand48 function.  */
/* #undef _GLIBCPP_HAVE_DRAND48 */

/* Define if you have the expf function.  */
#define _GLIBCPP_HAVE_EXPF 1

/* Define if you have the expl function.  */
/* #undef _GLIBCPP_HAVE_EXPL */

/* Define if you have the fabsf function.  */
#define _GLIBCPP_HAVE_FABSF 1

/* Define if you have the fabsl function.  */
/* #undef _GLIBCPP_HAVE_FABSL */

/* Define if you have the fgetwc function.  */
/* #undef _GLIBCPP_HAVE_FGETWC */

/* Define if you have the fgetws function.  */
/* #undef _GLIBCPP_HAVE_FGETWS */

/* Define if you have the finite function.  */
/* #undef _GLIBCPP_HAVE_FINITE */

/* Define if you have the finitef function.  */
/* #undef _GLIBCPP_HAVE_FINITEF */

/* Define if you have the finitel function.  */
/* #undef _GLIBCPP_HAVE_FINITEL */

/* Define if you have the floorf function.  */
#define _GLIBCPP_HAVE_FLOORF 1

/* Define if you have the floorl function.  */
/* #undef _GLIBCPP_HAVE_FLOORL */

/* Define if you have the fmodf function.  */
#define _GLIBCPP_HAVE_FMODF 1

/* Define if you have the fmodl function.  */
/* #undef _GLIBCPP_HAVE_FMODL */

/* Define if you have the fpclass function.  */
/* #undef _GLIBCPP_HAVE_FPCLASS */

/* Define if you have the fputwc function.  */
/* #undef _GLIBCPP_HAVE_FPUTWC */

/* Define if you have the fputws function.  */
/* #undef _GLIBCPP_HAVE_FPUTWS */

/* Define if you have the frexpf function.  */
#define _GLIBCPP_HAVE_FREXPF 1

/* Define if you have the frexpl function.  */
/* #undef _GLIBCPP_HAVE_FREXPL */

/* Define if you have the fwide function.  */
/* #undef _GLIBCPP_HAVE_FWIDE */

/* Define if you have the fwprintf function.  */
/* #undef _GLIBCPP_HAVE_FWPRINTF */

/* Define if you have the fwscanf function.  */
/* #undef _GLIBCPP_HAVE_FWSCANF */

/* Define if you have the getpagesize function.  */
/* #undef _GLIBCPP_HAVE_GETPAGESIZE */

/* Define if you have the getwc function.  */
/* #undef _GLIBCPP_HAVE_GETWC */

/* Define if you have the getwchar function.  */
/* #undef _GLIBCPP_HAVE_GETWCHAR */

/* Define if you have the hypot function.  */
/* #undef _GLIBCPP_HAVE_HYPOT */

/* Define if you have the hypotf function.  */
/* #undef _GLIBCPP_HAVE_HYPOTF */

/* Define if you have the hypotl function.  */
/* #undef _GLIBCPP_HAVE_HYPOTL */

/* Define if you have the iconv function.  */
/* #undef _GLIBCPP_HAVE_ICONV */

/* Define if you have the iconv_close function.  */
/* #undef _GLIBCPP_HAVE_ICONV_CLOSE */

/* Define if you have the iconv_open function.  */
/* #undef _GLIBCPP_HAVE_ICONV_OPEN */

/* Define if you have the isatty function.  */
/* #undef _GLIBCPP_HAVE_ISATTY */

/* Define if you have the isinf function.  */
/* #undef _GLIBCPP_HAVE_ISINF */

/* Define if you have the isinff function.  */
/* #undef _GLIBCPP_HAVE_ISINFF */

/* Define if you have the isinfl function.  */
/* #undef _GLIBCPP_HAVE_ISINFL */

/* Define if you have the isnan function.  */
/* #undef _GLIBCPP_HAVE_ISNAN */

/* Define if you have the isnanf function.  */
/* #undef _GLIBCPP_HAVE_ISNANF */

/* Define if you have the isnanl function.  */
/* #undef _GLIBCPP_HAVE_ISNANL */

/* Define if you have the ldexpf function.  */
#define _GLIBCPP_HAVE_LDEXPF 1

/* Define if you have the ldexpl function.  */
/* #undef _GLIBCPP_HAVE_LDEXPL */

/* Define if you have the log10f function.  */
#define _GLIBCPP_HAVE_LOG10F 1

/* Define if you have the log10l function.  */
/* #undef _GLIBCPP_HAVE_LOG10L */

/* Define if you have the logf function.  */
#define _GLIBCPP_HAVE_LOGF 1

/* Define if you have the logl function.  */
/* #undef _GLIBCPP_HAVE_LOGL */

/* Define if you have the mbrlen function.  */
/* #undef _GLIBCPP_HAVE_MBRLEN */

/* Define if you have the mbrtowc function.  */
/* #undef _GLIBCPP_HAVE_MBRTOWC */

/* Define if you have the mbsinit function.  */
/* #undef _GLIBCPP_HAVE_MBSINIT */

/* Define if you have the mbsrtowcs function.  */
/* #undef _GLIBCPP_HAVE_MBSRTOWCS */

/* Define if you have the modff function.  */
#define _GLIBCPP_HAVE_MODFF 1

/* Define if you have the modfl function.  */
/* #undef _GLIBCPP_HAVE_MODFL */

/* Define if you have the nan function.  */
/* #undef _GLIBCPP_HAVE_NAN */

/* Define if you have the nl_langinfo function.  */
/* #undef _GLIBCPP_HAVE_NL_LANGINFO */

/* Define if you have the powf function.  */
#define _GLIBCPP_HAVE_POWF 1

/* Define if you have the powl function.  */
/* #undef _GLIBCPP_HAVE_POWL */

/* Define if you have the putwc function.  */
/* #undef _GLIBCPP_HAVE_PUTWC */

/* Define if you have the putwchar function.  */
/* #undef _GLIBCPP_HAVE_PUTWCHAR */

/* Define if you have the qfpclass function.  */
/* #undef _GLIBCPP_HAVE_QFPCLASS */

/* Define if you have the setenv function.  */
/* #undef _GLIBCPP_HAVE_SETENV */

/* Define if you have the sincos function.  */
/* #undef _GLIBCPP_HAVE_SINCOS */

/* Define if you have the sincosf function.  */
/* #undef _GLIBCPP_HAVE_SINCOSF */

/* Define if you have the sincosl function.  */
/* #undef _GLIBCPP_HAVE_SINCOSL */

/* Define if you have the sinf function.  */
#define _GLIBCPP_HAVE_SINF 1

/* Define if you have the sinhf function.  */
#define _GLIBCPP_HAVE_SINHF 1

/* Define if you have the sinhl function.  */
/* #undef _GLIBCPP_HAVE_SINHL */

/* Define if you have the sinl function.  */
/* #undef _GLIBCPP_HAVE_SINL */

/* Define if you have the sqrtf function.  */
#define _GLIBCPP_HAVE_SQRTF 1

/* Define if you have the sqrtl function.  */
/* #undef _GLIBCPP_HAVE_SQRTL */

/* Define if you have the strtof function.  */
#define _GLIBCPP_HAVE_STRTOF 1

/* Define if you have the strtold function.  */
#define _GLIBCPP_HAVE_STRTOLD 1

/* Define if you have the swprintf function.  */
/* #undef _GLIBCPP_HAVE_SWPRINTF */

/* Define if you have the swscanf function.  */
/* #undef _GLIBCPP_HAVE_SWSCANF */

/* Define if you have the tanf function.  */
#define _GLIBCPP_HAVE_TANF 1

/* Define if you have the tanhf function.  */
#define _GLIBCPP_HAVE_TANHF 1

/* Define if you have the tanhl function.  */
/* #undef _GLIBCPP_HAVE_TANHL */

/* Define if you have the tanl function.  */
/* #undef _GLIBCPP_HAVE_TANL */

/* Define if you have the ungetwc function.  */
/* #undef _GLIBCPP_HAVE_UNGETWC */

/* Define if you have the vfwprintf function.  */
/* #undef _GLIBCPP_HAVE_VFWPRINTF */

/* Define if you have the vfwscanf function.  */
/* #undef _GLIBCPP_HAVE_VFWSCANF */

/* Define if you have the vswprintf function.  */
/* #undef _GLIBCPP_HAVE_VSWPRINTF */

/* Define if you have the vswscanf function.  */
/* #undef _GLIBCPP_HAVE_VSWSCANF */

/* Define if you have the vwprintf function.  */
/* #undef _GLIBCPP_HAVE_VWPRINTF */

/* Define if you have the vwscanf function.  */
/* #undef _GLIBCPP_HAVE_VWSCANF */

/* Define if you have the wcrtomb function.  */
/* #undef _GLIBCPP_HAVE_WCRTOMB */

/* Define if you have the wcscat function.  */
/* #undef _GLIBCPP_HAVE_WCSCAT */

/* Define if you have the wcschr function.  */
/* #undef _GLIBCPP_HAVE_WCSCHR */

/* Define if you have the wcscmp function.  */
/* #undef _GLIBCPP_HAVE_WCSCMP */

/* Define if you have the wcscoll function.  */
/* #undef _GLIBCPP_HAVE_WCSCOLL */

/* Define if you have the wcscpy function.  */
/* #undef _GLIBCPP_HAVE_WCSCPY */

/* Define if you have the wcscspn function.  */
/* #undef _GLIBCPP_HAVE_WCSCSPN */

/* Define if you have the wcsftime function.  */
/* #undef _GLIBCPP_HAVE_WCSFTIME */

/* Define if you have the wcslen function.  */
/* #undef _GLIBCPP_HAVE_WCSLEN */

/* Define if you have the wcsncat function.  */
/* #undef _GLIBCPP_HAVE_WCSNCAT */

/* Define if you have the wcsncmp function.  */
/* #undef _GLIBCPP_HAVE_WCSNCMP */

/* Define if you have the wcsncpy function.  */
/* #undef _GLIBCPP_HAVE_WCSNCPY */

/* Define if you have the wcspbrk function.  */
/* #undef _GLIBCPP_HAVE_WCSPBRK */

/* Define if you have the wcsrchr function.  */
/* #undef _GLIBCPP_HAVE_WCSRCHR */

/* Define if you have the wcsrtombs function.  */
/* #undef _GLIBCPP_HAVE_WCSRTOMBS */

/* Define if you have the wcsspn function.  */
/* #undef _GLIBCPP_HAVE_WCSSPN */

/* Define if you have the wcsstr function.  */
/* #undef _GLIBCPP_HAVE_WCSSTR */

/* Define if you have the wcstod function.  */
/* #undef _GLIBCPP_HAVE_WCSTOD */

/* Define if you have the wcstof function.  */
/* #undef _GLIBCPP_HAVE_WCSTOF */

/* Define if you have the wcstok function.  */
/* #undef _GLIBCPP_HAVE_WCSTOK */

/* Define if you have the wcstol function.  */
/* #undef _GLIBCPP_HAVE_WCSTOL */

/* Define if you have the wcstoul function.  */
/* #undef _GLIBCPP_HAVE_WCSTOUL */

/* Define if you have the wcsxfrm function.  */
/* #undef _GLIBCPP_HAVE_WCSXFRM */

/* Define if you have the wctob function.  */
/* #undef _GLIBCPP_HAVE_WCTOB */

/* Define if you have the wmemchr function.  */
/* #undef _GLIBCPP_HAVE_WMEMCHR */

/* Define if you have the wmemcmp function.  */
/* #undef _GLIBCPP_HAVE_WMEMCMP */

/* Define if you have the wmemcpy function.  */
/* #undef _GLIBCPP_HAVE_WMEMCPY */

/* Define if you have the wmemmove function.  */
/* #undef _GLIBCPP_HAVE_WMEMMOVE */

/* Define if you have the wmemset function.  */
/* #undef _GLIBCPP_HAVE_WMEMSET */

/* Define if you have the wprintf function.  */
/* #undef _GLIBCPP_HAVE_WPRINTF */

/* Define if you have the wscanf function.  */
/* #undef _GLIBCPP_HAVE_WSCANF */

/* Define if you have the <endian.h> header file.  */
/* #undef _GLIBCPP_HAVE_ENDIAN_H */

/* Define if you have the <float.h> header file.  */
/* #undef _GLIBCPP_HAVE_FLOAT_H */

/* Define if you have the <fp.h> header file.  */
/* #undef _GLIBCPP_HAVE_FP_H */

/* Define if you have the <gconv.h> header file.  */
/* #undef _GLIBCPP_HAVE_GCONV_H */

/* Define if you have the <ieeefp.h> header file.  */
/* #undef _GLIBCPP_HAVE_IEEEFP_H */

/* Define if you have the <inttypes.h> header file.  */
/* #undef _GLIBCPP_HAVE_INTTYPES_H */

/* Define if you have the <locale.h> header file.  */
/* #undef _GLIBCPP_HAVE_LOCALE_H */

/* Define if you have the <machine/endian.h> header file.  */
/* #undef _GLIBCPP_HAVE_MACHINE_ENDIAN_H */

/* Define if you have the <machine/param.h> header file.  */
/* #undef _GLIBCPP_HAVE_MACHINE_PARAM_H */

/* Define if you have the <nan.h> header file.  */
/* #undef _GLIBCPP_HAVE_NAN_H */

/* Define if you have the <stdlib.h> header file.  */
#define _GLIBCPP_HAVE_STDLIB_H 1

/* Define if you have the <string.h> header file.  */
#define _GLIBCPP_HAVE_STRING_H 1

/* Define if you have the <sys/filio.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_FILIO_H */

/* Define if you have the <sys/ioctl.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_IOCTL_H */

/* Define if you have the <sys/isa_defs.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_ISA_DEFS_H */

/* Define if you have the <sys/machine.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_MACHINE_H */

/* Define if you have the <sys/resource.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_RESOURCE_H */

/* Define if you have the <sys/stat.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_STAT_H */

/* Define if you have the <sys/time.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_TIME_H */

/* Define if you have the <sys/types.h> header file.  */
/* #undef _GLIBCPP_HAVE_SYS_TYPES_H */

/* Define if you have the <unistd.h> header file.  */
/* #undef _GLIBCPP_HAVE_UNISTD_H */

/* Define if you have the <wchar.h> header file.  */
/* #undef _GLIBCPP_HAVE_WCHAR_H */

/* Define if you have the <wctype.h> header file.  */
/* #undef _GLIBCPP_HAVE_WCTYPE_H */

/* Define if you have the m library (-lm).  */
/* #undef _GLIBCPP_HAVE_LIBM */

/* Name of package */
#define _GLIBCPP_PACKAGE "libstdc++"

/* Version number of package */
#define _GLIBCPP_VERSION "3.3.4"

/* Define if the compiler is configured for setjmp/longjmp exceptions. */
/* #undef _GLIBCPP_SJLJ_EXCEPTIONS */

/* Define if sigsetjmp is available.   */
/* #undef _GLIBCPP_HAVE_SIGSETJMP */

/* Only used in build directory testsuite_hooks.h. */
/* #undef _GLIBCPP_HAVE_MEMLIMIT_DATA */

/* Only used in build directory testsuite_hooks.h. */
/* #undef _GLIBCPP_HAVE_MEMLIMIT_RSS */

/* Only used in build directory testsuite_hooks.h. */
/* #undef _GLIBCPP_HAVE_MEMLIMIT_VMEM */

/* Only used in build directory testsuite_hooks.h. */
/* #undef _GLIBCPP_HAVE_MEMLIMIT_AS */

//
// Systems that have certain non-standard functions prefixed with an
// underscore, we'll handle those here. Must come after config.h.in.
//
#if defined (_GLIBCPP_HAVE__ISNAN) && ! defined (_GLIBCPP_HAVE_ISNAN)
# define _GLIBCPP_HAVE_ISNAN 1
# define isnan _isnan
#endif

#if defined (_GLIBCPP_HAVE__ISNANF) && ! defined (_GLIBCPP_HAVE_ISNANF)
# define _GLIBCPP_HAVE_ISNANF 1
# define isnanf _isnanf
#endif

#if defined (_GLIBCPP_HAVE__ISNANL) && ! defined (_GLIBCPP_HAVE_ISNANL)
# define _GLIBCPP_HAVE_ISNANL 1
# define isnanl _isnanl
#endif

#if defined (_GLIBCPP_HAVE__ISINF) && ! defined (_GLIBCPP_HAVE_ISINF)
# define _GLIBCPP_HAVE_ISINF 1
# define isinf _isinf
#endif

#if defined (_GLIBCPP_HAVE__ISINFF) && ! defined (_GLIBCPP_HAVE_ISINFF)
# define _GLIBCPP_HAVE_ISINFF 1
# define isinff _isinff
#endif

#if defined (_GLIBCPP_HAVE__ISINFL) && ! defined (_GLIBCPP_HAVE_ISINFL)
# define _GLIBCPP_HAVE_ISINFL 1
# define isinfl _isinfl
#endif

#if defined (_GLIBCPP_HAVE__COPYSIGN) && ! defined (_GLIBCPP_HAVE_COPYSIGN)
# define _GLIBCPP_HAVE_COPYSIGN 1
# define copysign _copysign
#endif

#if defined (_GLIBCPP_HAVE__COPYSIGNL) && ! defined (_GLIBCPP_HAVE_COPYSIGNL)
# define _GLIBCPP_HAVE_COPYSIGNL 1
# define copysignl _copysignl
#endif

#if defined (_GLIBCPP_HAVE__COSF) && ! defined (_GLIBCPP_HAVE_COSF)
# define _GLIBCPP_HAVE_COSF 1
# define cosf _cosf
#endif

#if defined (_GLIBCPP_HAVE__ACOSF) && ! defined (_GLIBCPP_HAVE_ACOSF)
# define _GLIBCPP_HAVE_ACOSF 1
# define acosf _acosf
#endif

#if defined (_GLIBCPP_HAVE__ACOSL) && ! defined (_GLIBCPP_HAVE_ACOSL)
# define _GLIBCPP_HAVE_ACOSL 1
# define acosl _acosl
#endif

#if defined (_GLIBCPP_HAVE__ASINF) && ! defined (_GLIBCPP_HAVE_ASINF)
# define _GLIBCPP_HAVE_ASINF 1
# define asinf _asinf
#endif

#if defined (_GLIBCPP_HAVE__ASINL) && ! defined (_GLIBCPP_HAVE_ASINL)
# define _GLIBCPP_HAVE_ASINL 1
# define asinl _asinl
#endif

#if defined (_GLIBCPP_HAVE__ATANF) && ! defined (_GLIBCPP_HAVE_ATANF)
# define _GLIBCPP_HAVE_ATANF 1
# define atanf _atanf
#endif

#if defined (_GLIBCPP_HAVE__ATANL) && ! defined (_GLIBCPP_HAVE_ATANL)
# define _GLIBCPP_HAVE_ATANL 1
# define atanl _atanl
#endif

#if defined (_GLIBCPP_HAVE__CEILF) && ! defined (_GLIBCPP_HAVE_CEILF)
# define _GLIBCPP_HAVE_CEILF 1
# define aceil _ceilf
#endif

#if defined (_GLIBCPP_HAVE__CEILL) && ! defined (_GLIBCPP_HAVE_CEILL)
# define _GLIBCPP_HAVE_CEILL 1
# define aceil _ceill
#endif

#if defined (_GLIBCPP_HAVE__COSHF) && ! defined (_GLIBCPP_HAVE_COSHF)
# define _GLIBCPP_HAVE_COSHF 1
# define coshf _coshf
#endif

#if defined (_GLIBCPP_HAVE__COSL) && ! defined (_GLIBCPP_HAVE_COSL)
# define _GLIBCPP_HAVE_COSL 1
# define cosl _cosl
#endif

#if defined (_GLIBCPP_HAVE__LOGF) && ! defined (_GLIBCPP_HAVE_LOGF)
# define _GLIBCPP_HAVE_LOGF 1
# define logf _logf
#endif

#if defined (_GLIBCPP_HAVE__COSHL) && ! defined (_GLIBCPP_HAVE_COSHL)
# define _GLIBCPP_HAVE_COSHL 1
# define coshl _coshl
#endif

#if defined (_GLIBCPP_HAVE__EXPF) && ! defined (_GLIBCPP_HAVE_EXPF)
# define _GLIBCPP_HAVE_EXPF 1
# define expf _expf
#endif

#if defined (_GLIBCPP_HAVE__EXPL) && ! defined (_GLIBCPP_HAVE_EXPL)
# define _GLIBCPP_HAVE_EXPL 1
# define expl _expl
#endif

#if defined (_GLIBCPP_HAVE__FABSF) && ! defined (_GLIBCPP_HAVE_FABSF)
# define _GLIBCPP_HAVE_FABSF 1
# define fabsf _fabsf
#endif

#if defined (_GLIBCPP_HAVE__FABSL) && ! defined (_GLIBCPP_HAVE_FABSL)
# define _GLIBCPP_HAVE_FABSL 1
# define fabsl _fabsl
#endif

#if defined (_GLIBCPP_HAVE__FLOORF) && ! defined (_GLIBCPP_HAVE_FLOORF)
# define _GLIBCPP_HAVE_FLOORF 1
# define floorf _floorf
#endif

#if defined (_GLIBCPP_HAVE__FLOORL) && ! defined (_GLIBCPP_HAVE_FLOORL)
# define _GLIBCPP_HAVE_FLOORL 1
# define floorl _floorl
#endif

#if defined (_GLIBCPP_HAVE__FMODF) && ! defined (_GLIBCPP_HAVE_FMODF)
# define _GLIBCPP_HAVE_FMODF 1
# define fmodf _fmodf
#endif

#if defined (_GLIBCPP_HAVE__FMODL) && ! defined (_GLIBCPP_HAVE_FMODL)
# define _GLIBCPP_HAVE_FMODL 1
# define fmodl _fmodl
#endif

#if defined (_GLIBCPP_HAVE__FREXPF) && ! defined (_GLIBCPP_HAVE_FREXPF)
# define _GLIBCPP_HAVE_FREXPF 1
# define frexpf _frexpf
#endif

#if defined (_GLIBCPP_HAVE__FREXPL) && ! defined (_GLIBCPP_HAVE_FREXPL)
# define _GLIBCPP_HAVE_FREXPL 1
# define frexpl _frexpl
#endif

#if defined (_GLIBCPP_HAVE__LDEXPF) && ! defined (_GLIBCPP_HAVE_LDEXPF)
# define _GLIBCPP_HAVE_LDEXPF 1
# define ldexpf _ldexpf
#endif

#if defined (_GLIBCPP_HAVE__LDEXPL) && ! defined (_GLIBCPP_HAVE_LDEXPL)
# define _GLIBCPP_HAVE_LDEXPL 1
# define ldexpl _ldexpl
#endif

#if defined (_GLIBCPP_HAVE__LOG10F) && ! defined (_GLIBCPP_HAVE_LOG10F)
# define _GLIBCPP_HAVE_LOG10F 1
# define log10f _log10f
#endif

#if defined (_GLIBCPP_HAVE__LOGL) && ! defined (_GLIBCPP_HAVE_LOGL)
# define _GLIBCPP_HAVE_LOGL 1
# define logl _logl
#endif

#if defined (_GLIBCPP_HAVE__POWF) && ! defined (_GLIBCPP_HAVE_POWF)
# define _GLIBCPP_HAVE_POWF 1
# define powf _powf
#endif

#if defined (_GLIBCPP_HAVE__LOG10L) && ! defined (_GLIBCPP_HAVE_LOG10L)
# define _GLIBCPP_HAVE_LOG10L 1
# define log10l _log10l
#endif

#if defined (_GLIBCPP_HAVE__MODF) && ! defined (_GLIBCPP_HAVE_MODF)
# define _GLIBCPP_HAVE_MODF 1
# define modf _modf
#endif

#if defined (_GLIBCPP_HAVE__MODL) && ! defined (_GLIBCPP_HAVE_MODL)
# define _GLIBCPP_HAVE_MODL 1
# define modl _modl
#endif

#if defined (_GLIBCPP_HAVE__SINF) && ! defined (_GLIBCPP_HAVE_SINF)
# define _GLIBCPP_HAVE_SINF 1
# define sinf _sinf
#endif

#if defined (_GLIBCPP_HAVE__POWL) && ! defined (_GLIBCPP_HAVE_POWL)
# define _GLIBCPP_HAVE_POWL 1
# define powl _powl
#endif

#if defined (_GLIBCPP_HAVE__SINHF) && ! defined (_GLIBCPP_HAVE_SINHF)
# define _GLIBCPP_HAVE_SINHF 1
# define sinhf _sinhf
#endif

#if defined (_GLIBCPP_HAVE__SINL) && ! defined (_GLIBCPP_HAVE_SINL)
# define _GLIBCPP_HAVE_SINL 1
# define sinl _sinl
#endif

#if defined (_GLIBCPP_HAVE__SQRTF) && ! defined (_GLIBCPP_HAVE_SQRTF)
# define _GLIBCPP_HAVE_SQRTF 1
# define sqrtf _sqrtf
#endif

#if defined (_GLIBCPP_HAVE__SINHL) && ! defined (_GLIBCPP_HAVE_SINHL)
# define _GLIBCPP_HAVE_SINHL 1
# define sinhl _sinhl
#endif

#if defined (_GLIBCPP_HAVE__TANF) && ! defined (_GLIBCPP_HAVE_TANF)
# define _GLIBCPP_HAVE_TANF 1
# define tanf _tanf
#endif

#if defined (_GLIBCPP_HAVE__SQRTL) && ! defined (_GLIBCPP_HAVE_SQRTL)
# define _GLIBCPP_HAVE_SQRTL 1
# define sqrtl _sqrtl
#endif

#if defined (_GLIBCPP_HAVE__TANHF) && ! defined (_GLIBCPP_HAVE_TANHF)
# define _GLIBCPP_HAVE_TANHF 1
# define tanhf _tanhf
#endif

#if defined (_GLIBCPP_HAVE__TANL) && ! defined (_GLIBCPP_HAVE_TANL)
# define _GLIBCPP_HAVE_TANF 1
# define tanf _tanf
#endif

#if defined (_GLIBCPP_HAVE__STRTOF) && ! defined (_GLIBCPP_HAVE_STRTOF)
# define _GLIBCPP_HAVE_STRTOF 1
# define strtof _strtof
#endif

#if defined (_GLIBCPP_HAVE__TANHL) && ! defined (_GLIBCPP_HAVE_TANHL)
# define _GLIBCPP_HAVE_TANHL 1
# define tanhl _tanhl
#endif

#if defined (_GLIBCPP_HAVE__STRTOLD) && ! defined (_GLIBCPP_HAVE_STRTOLD)
# define _GLIBCPP_HAVE_STRTOLD 1
# define strtold _strtold
#endif

#if defined (_GLIBCPP_HAVE__SINCOS) && ! defined (_GLIBCPP_HAVE_SINCOS)
# define _GLIBCPP_HAVE_SINCOS 1
# define sincos _sincos
#endif

#if defined (_GLIBCPP_HAVE__SINCOSF) && ! defined (_GLIBCPP_HAVE_SINCOSF)
# define _GLIBCPP_HAVE_SINCOSF 1
# define sincosf _sincosf
#endif

#if defined (_GLIBCPP_HAVE__SINCOSL) && ! defined (_GLIBCPP_HAVE_SINCOSL)
# define _GLIBCPP_HAVE_SINCOSL 1
# define sincosl _sincosl
#endif

#if defined (_GLIBCPP_HAVE__FINITE) && ! defined (_GLIBCPP_HAVE_FINITE)
# define _GLIBCPP_HAVE_FINITE 1
# define finite _finite
#endif

#if defined (_GLIBCPP_HAVE__FINITEF) && ! defined (_GLIBCPP_HAVE_FINITEF)
# define _GLIBCPP_HAVE_FINITEF 1
# define finitef _finitef
#endif

#if defined (_GLIBCPP_HAVE__FINITEL) && ! defined (_GLIBCPP_HAVE_FINITEL)
# define _GLIBCPP_HAVE_FINITEL 1
# define finitel _finitel
#endif

#if defined (_GLIBCPP_HAVE__QFINITE) && ! defined (_GLIBCPP_HAVE_QFINITE)
# define _GLIBCPP_HAVE_QFINITE 1
# define qfinite _qfinite
#endif

#if defined (_GLIBCPP_HAVE__FPCLASS) && ! defined (_GLIBCPP_HAVE_FPCLASS)
# define _GLIBCPP_HAVE_FPCLASS 1
# define fpclass _fpclass
#endif

#if defined (_GLIBCPP_HAVE__QFPCLASS) && ! defined (_GLIBCPP_HAVE_QFPCLASS)
# define _GLIBCPP_HAVE_QFPCLASS 1
# define qfpclass _qfpclass
#endif

#endif // _CPP_CPPCONFIG_


text:
package policy

import (
	"reflect"
	"testing"

	kapi "k8s.io/kubernetes/pkg/api"
)

func TestComputeDefinitions(t *testing.T) {
	diffPriv := goodSCC()
	diffPriv.AllowPrivilegedContainer = true

	diffCaps := goodSCC()
	diffCaps.AllowedCapabilities = []kapi.Capability{"foo"}

	diffHostDir := goodSCC()
	diffHostDir.AllowHostDirVolumePlugin = true

	diffHostNetwork := goodSCC()
	diffHostNetwork.AllowHostNetwork = true

	diffHostPorts := goodSCC()
	diffHostPorts.AllowHostPorts = true

	diffHostPID := goodSCC()
	diffHostPID.AllowHostPID = true

	diffHostIPC := goodSCC()
	diffHostIPC.AllowHostIPC = true

	diffSELinux := goodSCC()
	diffSELinux.SELinuxContext.Type = kapi.SELinuxStrategyMustRunAs

	diffRunAsUser := goodSCC()
	diffRunAsUser.RunAsUser.Type = kapi.RunAsUserStrategyMustRunAs

	diffSupGroups := goodSCC()
	diffSupGroups.SupplementalGroups.Type = kapi.SupplementalGroupsStrategyMustRunAs

	diffFSGroup := goodSCC()
	diffFSGroup.FSGroup.Type = kapi.FSGroupStrategyMustRunAs

	tests := map[string]struct {
		expected    kapi.SecurityContextConstraints
		actual      kapi.SecurityContextConstraints
		needsUpdate bool
	}{
		"different priv": {
			expected:    goodSCC(),
			actual:      diffPriv,
			needsUpdate: true,
		},
		"different caps": {
			expected:    goodSCC(),
			actual:      diffCaps,
			needsUpdate: true,
		},
		"different host dir": {
			expected:    goodSCC(),
			actual:      diffHostDir,
			needsUpdate: true,
		},
		"different host network": {
			expected:    goodSCC(),
			actual:      diffHostNetwork,
			needsUpdate: true,
		},
		"different host ports": {
			expected:    goodSCC(),
			actual:      diffHostPorts,
			needsUpdate: true,
		},
		"different host pid": {
			expected:    goodSCC(),
			actual:      diffHostPID,
			needsUpdate: true,
		},
		"different host IPC": {
			expected:    goodSCC(),
			actual:      diffHostIPC,
			needsUpdate: true,
		},
		"different host SELinux": {
			expected:    goodSCC(),
			actual:      diffSELinux,
			needsUpdate: true,
		},
		"different host RunAsUser": {
			expected:    goodSCC(),
			actual:      diffRunAsUser,
			needsUpdate: true,
		},
		"different host Sup Groups": {
			expected:    goodSCC(),
			actual:      diffSupGroups,
			needsUpdate: true,
		},
		"different host FS Group": {
			expected:    goodSCC(),
			actual:      diffFSGroup,
			needsUpdate: true,
		},
		"no diff": {
			expected:    goodSCC(),
			actual:      goodSCC(),
			needsUpdate: false,
		},
	}

	for k, v := range tests {
		cmd := NewDefaultReconcileSCCOptions()

		computedSCC, needsUpdate := cmd.computeUpdatedSCC(v.expected, v.actual)
		// ensure we got an update
		if needsUpdate != v.needsUpdate {
			t.Errorf("%s expected to need an update but did not trigger one", k)
		}

		if !reflect.DeepEqual(&v.expected, computedSCC) {
			t.Errorf("unexpected diffs were produced from %s", k)
			t.Logf("wanted: %v", &v.expected)
			t.Logf("got:    %v", computedSCC)
		}

		// ensure that if the case needed an update that no diff results from passing through again
		if v.needsUpdate {
			if _, doubleUpdate := cmd.computeUpdatedSCC(v.expected, *computedSCC); doubleUpdate {
				t.Errorf("%s resulted in an SCC that needed update even after computing", k)
			}
		}
	}
}

func TestComputeMetadata(t *testing.T) {
	tests := map[string]struct {
		union       bool
		desired     kapi.ObjectMeta
		actual      kapi.ObjectMeta
		needsUpdate bool
		computed    kapi.ObjectMeta
	}{
		"identical with union": {
			union: true,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a"},
				Annotations: map[string]string{"annotationa": "a"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
			needsUpdate: false,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
		},
		"identical without union": {
			union: false,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a"},
				Annotations: map[string]string{"annotationa": "a"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
			needsUpdate: false,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
		},

		"missing labels and annotations with union": {
			union: true,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a", "labelb": "b"},
				Annotations: map[string]string{"annotationa": "a", "annotationb": "b"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
			needsUpdate: true,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a", "labelb": "b"},
				Annotations:     map[string]string{"annotationa": "a", "annotationb": "b"},
				ResourceVersion: "2",
			},
		},
		"missing labels and annotations without union": {
			union: false,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a", "labelb": "b"},
				Annotations: map[string]string{"annotationa": "a", "annotationb": "b"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
			needsUpdate: true,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a", "labelb": "b"},
				Annotations:     map[string]string{"annotationa": "a", "annotationb": "b"},
				ResourceVersion: "2",
			},
		},

		"extra labels and annotations with union": {
			union: true,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a"},
				Annotations: map[string]string{"annotationa": "a"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a", "labelb": "b"},
				Annotations:     map[string]string{"annotationa": "a", "annotationb": "b"},
				ResourceVersion: "2",
			},
			needsUpdate: false,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a", "labelb": "b"},
				Annotations:     map[string]string{"annotationa": "a", "annotationb": "b"},
				ResourceVersion: "2",
			},
		},
		"extra labels and annotations without union": {
			union: false,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a"},
				Annotations: map[string]string{"annotationa": "a"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a", "labelb": "b"},
				Annotations:     map[string]string{"annotationa": "a", "annotationb": "b"},
				ResourceVersion: "2",
			},
			needsUpdate: true,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
		},

		"disjoint labels and annotations with union": {
			union: true,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a"},
				Annotations: map[string]string{"annotationa": "a"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labelb": "b"},
				Annotations:     map[string]string{"annotationb": "b"},
				ResourceVersion: "2",
			},
			needsUpdate: true,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a", "labelb": "b"},
				Annotations:     map[string]string{"annotationa": "a", "annotationb": "b"},
				ResourceVersion: "2",
			},
		},
		"disjoint labels and annotations without union": {
			union: false,
			desired: kapi.ObjectMeta{
				Name:        "foo",
				Labels:      map[string]string{"labela": "a"},
				Annotations: map[string]string{"annotationa": "a"},
			},
			actual: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labelb": "b"},
				Annotations:     map[string]string{"annotationb": "b"},
				ResourceVersion: "2",
			},
			needsUpdate: true,
			computed: kapi.ObjectMeta{
				Name:            "foo",
				Labels:          map[string]string{"labela": "a"},
				Annotations:     map[string]string{"annotationa": "a"},
				ResourceVersion: "2",
			},
		},
	}

	for k, v := range tests {
		cmd := NewDefaultReconcileSCCOptions()
		cmd.Union = v.union

		desiredSCC := goodSCC()
		desiredSCC.ObjectMeta = v.desired

		actualSCC := goodSCC()
		actualSCC.ObjectMeta = v.actual

		computedSCC, needsUpdate := cmd.computeUpdatedSCC(desiredSCC, actualSCC)
		if needsUpdate != v.needsUpdate {
			t.Errorf("%s expected needsUpdate=%v, got %v", k, v.needsUpdate, needsUpdate)
			continue
		}
		if !reflect.DeepEqual(v.computed, computedSCC.ObjectMeta) {
			t.Errorf("%s: expected object meta\n%#v\ngot\n%#v", k, v.computed, computedSCC.ObjectMeta)
			continue
		}
	}
}

func TestComputeUnioningUsersAndGroups(t *testing.T) {
	missingGroup := goodSCC()
	missingGroup.Groups = []string{"foo"}

	missingUser := goodSCC()
	missingUser.Users = []string{"foo"}

	tests := map[string]struct {
		expected       kapi.SecurityContextConstraints
		actual         kapi.SecurityContextConstraints
		expectedGroups []string
		expectedUsers  []string
		needsUpdate    bool
		union          bool
	}{
		"missing group grants": {
			expected:       goodSCC(),
			actual:         missingGroup,
			expectedGroups: append(missingGroup.Groups, goodSCC().Groups...),
			expectedUsers:  goodSCC().Users,
			needsUpdate:    true,
			union:          true,
		},
		"missing user grants": {
			expected:       goodSCC(),
			actual:         missingUser,
			expectedGroups: goodSCC().Groups,
			expectedUsers:  append(missingUser.Users, goodSCC().Users...),
			needsUpdate:    true,
			union:          true,
		},
		"no diff union": {
			expected:       goodSCC(),
			actual:         goodSCC(),
			expectedGroups: goodSCC().Groups,
			expectedUsers:  goodSCC().Users,
			needsUpdate:    false,
			union:          true,
		},
		"non-unioning user": {
			// non-union tc will use the values in expected to compare, no need to set here
			expected:    goodSCC(),
			actual:      missingUser,
			needsUpdate: true,
			union:       false,
		},
		"non-unioning group": {
			// non-union tc will use the values in expected to compare, no need to set here
			expected:    goodSCC(),
			actual:      missingGroup,
			needsUpdate: true,
			union:       false,
		},
		"no diff non-union": {
			// non-union tc will use the values in expected to compare, no need to set here
			expected:    goodSCC(),
			actual:      goodSCC(),
			needsUpdate: false,
			union:       false,
		},
	}

	for k, v := range tests {
		cmd := NewDefaultReconcileSCCOptions()
		cmd.Union = v.union

		computedSCC, needsUpdate := cmd.computeUpdatedSCC(v.expected, v.actual)
		// ensure we got an update
		if needsUpdate != v.needsUpdate {
			t.Errorf("%s expected to need an update but did not trigger one", k)
		}

		toCompareGroups := v.expectedGroups
		toCompareUsers := v.expectedUsers
		// if not unioning then we should be reset to the expected groups/users
		if !v.union {
			toCompareGroups = v.expected.Groups
			toCompareUsers = v.expected.Users
		}
		// ensure that we ended up with the union we expected
		if !reflect.DeepEqual(computedSCC.Groups, toCompareGroups) {
			t.Errorf("%s had unexpected groups wanted: %v, got: %v", k, toCompareGroups, computedSCC.Groups)
		}
		if !reflect.DeepEqual(computedSCC.Users, toCompareUsers) {
			t.Errorf("%s had unexpected users wanted: %v, got: %v", k, toCompareUsers, computedSCC.Users)
		}

		// ensure the computed scc doesn't trigger additional updates
		if v.needsUpdate {
			if _, doubleUpdate := cmd.computeUpdatedSCC(v.expected, *computedSCC); doubleUpdate {
				t.Errorf("%s resulted in an SCC that needed update even after computing", k)
			}
		}
	}
}

func TestComputeUnioningPriorities(t *testing.T) {
	priorityOne := 1
	priorityTwo := 2

	tests := map[string]struct {
		expected         kapi.SecurityContextConstraints
		actual           kapi.SecurityContextConstraints
		expectedPriority *int
		needsUpdate      bool
		union            bool
	}{
		"not overwriting priorities, nil actual and non-nil expected": {
			expected:         goodSCCWithPriority(priorityOne),
			actual:           goodSCC(),
			expectedPriority: &priorityOne,
			needsUpdate:      true,
			union:            true,
		},
		"not overwriting priorities, non-nil actual and non-nil expected": {
			expected:         goodSCCWithPriority(priorityOne),
			actual:           goodSCCWithPriority(priorityTwo),
			expectedPriority: &priorityTwo,
			needsUpdate:      false,
			union:            true,
		},
		"not overwriting priorities, non-nil actual and nil expected": {
			expected:         goodSCC(),
			actual:           goodSCCWithPriority(priorityTwo),
			expectedPriority: &priorityTwo,
			needsUpdate:      false,
			union:            true,
		},
		"not overwriting priorities, both nil": {
			expected:         goodSCC(),
			actual:           goodSCC(),
			expectedPriority: nil,
			needsUpdate:      false,
			union:            true,
		},
		"not overwriting priorities, no diff": {
			expected:         goodSCCWithPriority(priorityOne),
			actual:           goodSCCWithPriority(priorityOne),
			expectedPriority: &priorityOne,
			needsUpdate:      false,
			union:            true,
		},
		"overwriting priorities, nil actual and non-nil expected": {
			expected:         goodSCCWithPriority(priorityOne),
			actual:           goodSCC(),
			expectedPriority: &priorityOne,
			needsUpdate:      true,
			union:            false,
		},
		"overwriting priorities, non-nil actual and non-nil expected": {
			expected:         goodSCCWithPriority(priorityOne),
			actual:           goodSCCWithPriority(priorityTwo),
			expectedPriority: &priorityOne,
			needsUpdate:      true,
			union:            false,
		},
		"overwriting priorities, nil actual and nil expected": {
			expected:         goodSCC(),
			actual:           goodSCC(),
			expectedPriority: nil,
			needsUpdate:      false,
			union:            false,
		},
		"overwriting priorities, non-nil actual and nil expected": {
			expected:         goodSCC(),
			actual:           goodSCCWithPriority(priorityTwo),
			expectedPriority: nil,
			needsUpdate:      true,
			union:            false,
		},
		"overwriting priorities, no diff": {
			expected:         goodSCCWithPriority(priorityTwo),
			actual:           goodSCCWithPriority(priorityTwo),
			expectedPriority: &priorityTwo,
			needsUpdate:      false,
			union:            false,
		},
	}

	for k, v := range tests {
		cmd := NewDefaultReconcileSCCOptions()
		cmd.Union = v.union

		computedSCC, needsUpdate := cmd.computeUpdatedSCC(v.expected, v.actual)
		// ensure we got an update
		if needsUpdate != v.needsUpdate {
			t.Errorf("%s expected to need an update but did not trigger one", k)
		}

		// ensure priorities are set correctly
		if v.expectedPriority != nil && computedSCC.Priority == nil {
			t.Errorf("%s expected a non nil computed priority", k)
		}
		if v.expectedPriority == nil && computedSCC.Priority != nil {
			t.Errorf("%s expected a nil priority but got %d", k, *computedSCC.Priority)
		}
		if v.expectedPriority != nil && computedSCC.Priority != nil && *v.expectedPriority != *computedSCC.Priority {
			t.Errorf("%s expected priority %d but got %d", k, *v.expectedPriority, *computedSCC.Priority)
		}

		// ensure the computed scc doesn't trigger additional updates
		if v.needsUpdate {
			if _, doubleUpdate := cmd.computeUpdatedSCC(v.expected, *computedSCC); doubleUpdate {
				t.Errorf("%s resulted in an SCC that needed update even after computing", k)
			}
		}
	}
}

func goodSCCWithPriority(priority int) kapi.SecurityContextConstraints {
	scc := goodSCC()
	scc.Priority = &priority
	return scc
}

func goodSCC() kapi.SecurityContextConstraints {
	return kapi.SecurityContextConstraints{
		ObjectMeta: kapi.ObjectMeta{
			Name: "scc-admin",
		},
		RunAsUser: kapi.RunAsUserStrategyOptions{
			Type: kapi.RunAsUserStrategyRunAsAny,
		},
		SELinuxContext: kapi.SELinuxContextStrategyOptions{
			Type: kapi.SELinuxStrategyRunAsAny,
		},
		FSGroup: kapi.FSGroupStrategyOptions{
			Type: kapi.FSGroupStrategyRunAsAny,
		},
		SupplementalGroups: kapi.SupplementalGroupsStrategyOptions{
			Type: kapi.SupplementalGroupsStrategyRunAsAny,
		},
		Users:  []string{"user"},
		Groups: []string{"group"},
	}
}

redpajama_set_name: RedPajamaGithub


text:
module BenchHelper
end


text:
"""
Includes class LennardJones and several methods to relax and compute forces and energies from Lennard-Jones clusters

"""
# import pyximport
# pyximport.install()

from .lj import LennardJones, lj_compact_evaluate
from .lj_utils import lj_energy, lj_forces, lj_gradient


text:
package com.alibaba.rocketmq.remoting.netty;

import com.alibaba.rocketmq.remoting.ChannelEventListener;
import com.alibaba.rocketmq.remoting.InvokeCallback;
import com.alibaba.rocketmq.remoting.RPCHook;
import com.alibaba.rocketmq.remoting.RemotingClient;
import com.alibaba.rocketmq.remoting.common.Pair;
import com.alibaba.rocketmq.remoting.common.RemotingHelper;
import com.alibaba.rocketmq.remoting.common.RemotingUtil;
import com.alibaba.rocketmq.remoting.exception.RemotingConnectException;
import com.alibaba.rocketmq.remoting.exception.RemotingSendRequestException;
import com.alibaba.rocketmq.remoting.exception.RemotingTimeoutException;
import com.alibaba.rocketmq.remoting.exception.RemotingTooMuchRequestException;
import com.alibaba.rocketmq.remoting.exception.SSLContextCreationException;
import com.alibaba.rocketmq.remoting.protocol.RemotingCommand;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPromise;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.ssl.SslHandler;
import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import io.netty.handler.timeout.IdleStateHandler;
import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.GlobalEventExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Remoting客户端实现
 *
 *

 *     Version 1.1 change note:
 *
Refactor to support of multiple connections between one client and one broker.

 *

 *
 * @author shijia.wxr<vintage.wang@gmail.com>, lizhanhui
 * @since 2013-7-13
 * @version 1.1
 */
public class NettyRemotingClient extends NettyRemotingAbstract implements RemotingClient {
    private static final Logger log = LoggerFactory.getLogger(RemotingHelper.RemotingLogName);

    private static final long LockTimeoutMillis = 3000;

    private final NettyClientConfig nettyClientConfig;
    private final Bootstrap bootstrap = new Bootstrap();
    private final EventLoopGroup eventLoopGroupWorker;
    private DefaultEventExecutorGroup defaultEventExecutorGroup;

    private final ConcurrentHashMap<String /* addr */, CompositeChannel> channelTables = new ConcurrentHashMap<String, CompositeChannel>();

    // 定时器
    private final Timer timer = new Timer("ClientHouseKeepingService", true);

    // Name server相关
    private final AtomicReference<List<String>> namesrvAddrList = new AtomicReference<List<String>>();
    private final AtomicReference<String> namesrvAddrChosen = new AtomicReference<String>();
    private final AtomicInteger namesrvIndex = new AtomicInteger(initValueIndex());

    // 处理Callback应答器
    private final ExecutorService publicExecutor;

    private final ChannelEventListener channelEventListener;

    private RPCHook rpcHook;

    class CompositeChannel {
        private volatile int parallelism;

        private int maxParallelism;

        private final String address;

        private final List<ChannelWrapper> channelWrappers;

        private final ReentrantLock lock = new ReentrantLock();

        private final AtomicLong channelSequencer = new AtomicLong(0L);

        private final ChannelGroup channelGroup;

        public CompositeChannel(String address, int maxParallelism) {
            this.address = address;
            this.maxParallelism = maxParallelism;
            channelWrappers = new ArrayList<ChannelWrapper>(maxParallelism);
            channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
        }

        public boolean containsChannel(Channel channel) {
            for (ChannelWrapper channelWrapper : channelWrappers) {
                if (null != channelWrapper && channelWrapper.getChannel() == channel) {
                    return true;
                }
            }

            return false;
        }

        public Channel createChannel() {

            if (!allowedToCreateChannel()) {
                return getChannel();
            }

            try {
                ChannelFuture channelFuture = null;
                if (lock.tryLock() || lock.tryLock(LockTimeoutMillis, TimeUnit.MILLISECONDS)) {
                    if (!allowedToCreateChannel()) {
                        return getChannel();
                    }

                    try {
                        channelFuture = bootstrap.connect(RemotingHelper.string2SocketAddress(address));
                        log.info("createChannel: begin to connect remote host[{}] asynchronously", address);
                        ChannelWrapper channelWrapper = new ChannelWrapper(channelFuture);
                        ++parallelism;
                        channelWrappers.add(channelWrapper);
                    } finally {
                        lock.unlock();
                    }
                } else {
                    log.warn("createChannel: try to lock composite channel, but timeout, {}ms", LockTimeoutMillis);
                }

                if (null != channelFuture) {
                    if (channelFuture.awaitUninterruptibly(nettyClientConfig.getConnectTimeoutMillis(), TimeUnit.MILLISECONDS)) {
                        if (null != channelFuture.channel() && channelFuture.channel().isActive()) {
                            log.info("createChannel: connect remote host[{}] success, {}", address, channelFuture.toString());
                            channelGroup.add(channelFuture.channel());
                            return channelFuture.channel();
                        }
                    } else {
                        log.warn("createChannel: connect remote host[" + address + "] failed, " + channelFuture.toString(), channelFuture.cause());
                    }
                }
            } catch (InterruptedException e) {
                log.error("Try to lock composite channel time out.", e);
            }
            return null;
        }

        public boolean closeChannel(Channel channel) {
            if (parallelism <= 0) {
                return false;
            }
            try {
                if (lock.tryLock() || lock.tryLock(LockTimeoutMillis, TimeUnit.MILLISECONDS)) {

                    if (parallelism <= 0) {
                        return false;
                    }

                    try {
                        Iterator<ChannelWrapper> iterator = channelWrappers.iterator();
                        ChannelWrapper channelWrapper;
                        while (iterator.hasNext()) {
                            channelWrapper = iterator.next();
                            if (null != channelWrapper && channelWrapper.getChannel() == channel) {
                                iterator.remove();
                                RemotingUtil.closeChannel(channel);
                                channelGroup.remove(channel);
                                --parallelism;
                                return true;
                            }
                        }
                    } finally {
                        lock.unlock();
                    }
                }
            } catch (InterruptedException e) {
                log.error("Try to lock composite channel timeout.", e);
            }
            return false;
        }

        public boolean isOK() {
            for (ChannelWrapper channelWrapper : channelWrappers) {
                if (channelWrapper.isOK()) {
                    return true;
                }
            }

            return false;
        }

        public boolean isWritable() {
            for (ChannelWrapper channelWrapper : channelWrappers) {
                if (channelWrapper.isWritable()) {
                    return true;
                }
            }
            return false;
        }

        public Channel getChannel() {

            if (1 == parallelism) {
                ChannelWrapper channelWrapper = channelWrappers.get(0);
                if (channelWrapper.isOK()) {
                    return channelWrapper.getChannel();
                } else {
                    if (channelWrapper.getChannelFuture().awaitUninterruptibly(nettyClientConfig.getConnectTimeoutMillis(), TimeUnit.MILLISECONDS)) {
                        return channelWrapper.getChannelFuture().channel();
                    } else {
                        log.info("Channel {} is not OK even after awaiting {}ms",
                                channelWrapper.getChannel().toString(),
                                nettyClientConfig.getConnectTimeoutMillis());
                        closeChannel(channelWrapper.getChannel());
                        return createChannel();
                    }
                }
            }

            if (allowedToCreateChannel()) {
                return createChannel();
            }

            ChannelWrapper channelWrapper = channelWrappers.get((int) (Math.abs(channelSequencer.getAndIncrement()) % channelWrappers.size()));

            if (channelWrapper.isOK()) {
                return channelWrapper.getChannel();
            } else if (channelWrapper.getChannelFuture().awaitUninterruptibly(nettyClientConfig.getConnectTimeoutMillis(), TimeUnit.MILLISECONDS)){
                return channelWrapper.getChannel();
            } else {
                log.info("Channel {} is not OK even after awaiting {}ms",
                        channelWrapper.getChannel().toString(),
                        nettyClientConfig.getConnectTimeoutMillis());
                closeChannel(channelWrapper.getChannel());
                return createChannel();
            }
        }

        public int getParallelism() {
            return parallelism;
        }

        public String getAddress() {
            return address;
        }

        public void close() {
            lock.lock();
            try {
                Iterator<ChannelWrapper> iterator = channelWrappers.iterator();
                while (iterator.hasNext()) {
                    ChannelWrapper channelWrapper = iterator.next();
                    channelWrapper.close();
                    iterator.remove();
                    --parallelism;
                }
            } finally {
                lock.unlock();
            }
        }

        public boolean allowedToCreateChannel() {
            return parallelism < maxParallelism;
        }

        public ChannelGroup getChannelGroup() {
            return channelGroup;
        }
    }

    class ChannelWrapper {
        private final ChannelFuture channelFuture;

        public ChannelWrapper(ChannelFuture channelFuture) {
            this.channelFuture = channelFuture;
        }

        public boolean isOK() {
            return (this.channelFuture.channel() != null && this.channelFuture.channel().isActive());
        }

        public boolean isWritable() {
            return this.channelFuture.channel().isWritable();
        }

        private Channel getChannel() {
            return this.channelFuture.channel();
        }

        public ChannelFuture getChannelFuture() {
            return channelFuture;
        }

        public void close() {
            RemotingUtil.closeChannel(getChannel());
        }
    }

    class NettyClientHandler extends SimpleChannelInboundHandler<RemotingCommand> {

        @Override
        protected void channelRead0(ChannelHandlerContext ctx, RemotingCommand msg) throws Exception {
            processMessageReceived(ctx, msg);

        }
    }

    class NettyConnectManageHandler extends ChannelDuplexHandler {
        @Override
        public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress,
                            SocketAddress localAddress, ChannelPromise promise) throws Exception {
            final String local = localAddress == null ? "UNKNOWN" : localAddress.toString();
            final String remote = remoteAddress == null ? "UNKNOWN" : remoteAddress.toString();
            log.info("NETTY CLIENT PIPELINE: CONNECT  {} => {}", local, remote);
            super.connect(ctx, remoteAddress, localAddress, promise);

            if (NettyRemotingClient.this.channelEventListener != null) {
                assert remoteAddress != null;
                NettyRemotingClient.this.putNettyEvent(new NettyEvent(NettyEventType.CONNECT, remoteAddress.toString(), ctx.channel()));
            }
        }

        @Override
        public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
            final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
            log.info("NETTY CLIENT PIPELINE: DISCONNECT {}", remoteAddress);
            closeChannel(ctx.channel());
            super.disconnect(ctx, promise);

            if (NettyRemotingClient.this.channelEventListener != null) {
                NettyRemotingClient.this.putNettyEvent(new NettyEvent(NettyEventType.CLOSE, remoteAddress,
                        ctx.channel()));
            }
        }

        @Override
        public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
            final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
            log.info("NETTY CLIENT PIPELINE: CLOSE {}", remoteAddress);
            closeChannel(ctx.channel());
            super.close(ctx, promise);

            if (NettyRemotingClient.this.channelEventListener != null) {
                NettyRemotingClient.this.putNettyEvent(new NettyEvent(NettyEventType.CLOSE, remoteAddress,
                        ctx.channel()));
            }
        }

        @Override
        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
            final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
            log.warn("NETTY CLIENT PIPELINE: exceptionCaught {}", remoteAddress);
            log.warn("NETTY CLIENT PIPELINE: exceptionCaught exception.", cause);
            closeChannel(ctx.channel());
            if (NettyRemotingClient.this.channelEventListener != null) {
                NettyRemotingClient.this.putNettyEvent(new NettyEvent(NettyEventType.EXCEPTION, remoteAddress,
                        ctx.channel()));
            }
        }

        @Override
        public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
            if (evt instanceof IdleStateEvent) {
                IdleStateEvent event = (IdleStateEvent) evt;
                if (event.state().equals(IdleState.ALL_IDLE)) {
                    final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
                    log.warn("NETTY CLIENT PIPELINE: IDLE exception [{}]", remoteAddress);
                    closeChannel(ctx.channel());
                    if (NettyRemotingClient.this.channelEventListener != null) {
                        NettyRemotingClient.this.putNettyEvent(new NettyEvent(NettyEventType.IDLE,
                                remoteAddress, ctx.channel()));
                    }
                }
            }

            ctx.fireUserEventTriggered(evt);
        }
    }

    private static int initValueIndex() {
        Random r = new Random();

        return Math.abs(r.nextInt() % 999) % 999;
    }

    public NettyRemotingClient(final NettyClientConfig nettyClientConfig) {
        this(nettyClientConfig, null);
    }

    public NettyRemotingClient(final NettyClientConfig nettyClientConfig,//
                               final ChannelEventListener channelEventListener) {
        super(nettyClientConfig.getClientOneWaySemaphoreValue(), nettyClientConfig
                .getClientAsyncSemaphoreValue());
        this.nettyClientConfig = nettyClientConfig;
        this.channelEventListener = channelEventListener;

        int publicThreadNums = nettyClientConfig.getClientCallbackExecutorThreads();
        if (publicThreadNums <= 0) {
            publicThreadNums = 4;
        }

        this.publicExecutor = Executors.newFixedThreadPool(publicThreadNums, new ThreadFactory() {
            private AtomicInteger threadIndex = new AtomicInteger(0);

            @Override
            public Thread newThread(Runnable r) {
                return new Thread(r, "NettyClientPublicExecutor_" + this.threadIndex.incrementAndGet());
            }
        });

        this.eventLoopGroupWorker = new NioEventLoopGroup(1, new ThreadFactory() {
            private AtomicInteger threadIndex = new AtomicInteger(0);

            @Override
            public Thread newThread(Runnable r) {
                return new Thread(r, String.format("NettyClientSelector_%d",
                        this.threadIndex.incrementAndGet()));
            }
        });

        if (nettyClientConfig.isSsl()) {
            try {
                sslContext = SslHelper.getSSLContext(SslRole.CLIENT);
            } catch (SSLContextCreationException e) {
                log.error("Failed to create SSL context.", e);
            }
        }
    }

    @Override
    public void start() {
        this.defaultEventExecutorGroup = new DefaultEventExecutorGroup(//
                nettyClientConfig.getClientWorkerThreads(), //
                new ThreadFactory() {

                    private AtomicInteger threadIndex = new AtomicInteger(0);

                    @Override
                    public Thread newThread(Runnable r) {
                        return new Thread(r, "NettyClientWorkerThread_" + this.threadIndex.incrementAndGet());
                    }
                });

        final Bootstrap handler = this.bootstrap.group(this.eventLoopGroupWorker).channel(NioSocketChannel.class)//
                //
                .option(ChannelOption.TCP_NODELAY, true)
                        //
                .option(ChannelOption.SO_KEEPALIVE, false)
                        //
                .option(ChannelOption.SO_SNDBUF, nettyClientConfig.getClientSocketSndBufSize())
                        //
                .option(ChannelOption.SO_RCVBUF, nettyClientConfig.getClientSocketRcvBufSize())
                        //
                .handler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    public void initChannel(SocketChannel ch) throws Exception {
                        if (null == sslContext) {
                            ch.pipeline().addLast(//
                                    defaultEventExecutorGroup, //
                                    new NettyEncoder(), //
                                    new NettyDecoder(), //
                                    new IdleStateHandler(0, 0, nettyClientConfig.getClientChannelMaxIdleTimeSeconds()),//
                                    new NettyConnectManageHandler(), //
                                    new NettyClientHandler());
                        } else {
                            ch.pipeline().addLast(//
                                    defaultEventExecutorGroup, //
                                    new SslHandler(SslHelper.getSSLEngine(sslContext, SslRole.CLIENT)),
                                    new NettyEncoder(), //
                                    new NettyDecoder(), //
                                    new IdleStateHandler(0, 0, nettyClientConfig.getClientChannelMaxIdleTimeSeconds()),//
                                    new NettyConnectManageHandler(), //
                                    new NettyClientHandler());
                        }
                    }
                });

        if (nettyClientConfig.isClientPooledByteBufAllocatorEnable()) {
            // 这个选项有可能会占用大量堆外内存,暂时不使用。
            handler.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
        }

        // 每隔1秒扫描下异步调用超时情况
        this.timer.scheduleAtFixedRate(new TimerTask() {

            @Override
            public void run() {
                try {
                    NettyRemotingClient.this.scanResponseTable();
                } catch (Exception e) {
                    log.error("scanResponseTable exception", e);
                }
            }
        }, 1000 * 3, 1000);

        if (this.channelEventListener != null) {
            this.nettyEventExecutor.start();
        }
    }

    @Override
    public void shutdown() {
        try {
            this.timer.cancel();

            for (CompositeChannel compositeChannel : this.channelTables.values()) {
                compositeChannel.close();
                channelTables.remove(compositeChannel.getAddress());
            }

            this.channelTables.clear();

            this.eventLoopGroupWorker.shutdownGracefully();

            if (this.nettyEventExecutor != null) {
                this.nettyEventExecutor.shutdown();
            }

            if (this.defaultEventExecutorGroup != null) {
                this.defaultEventExecutorGroup.shutdownGracefully();
            }
        } catch (Exception e) {
            log.error("NettyRemotingClient shutdown exception, ", e);
        }

        if (this.publicExecutor != null) {
            try {
                this.publicExecutor.shutdown();
            } catch (Exception e) {
                log.error("NettyRemotingServer shutdown exception, ", e);
            }
        }
    }

    private Channel getAndCreateChannel(final String address, int parallelism) throws InterruptedException {
        if (null == address) {
            return getAndCreateNameServerChannel();
        }

        CompositeChannel compositeChannel = this.channelTables.get(address);
        if (compositeChannel == null || compositeChannel.allowedToCreateChannel()) {
            return createChannel(address, parallelism);
        }

        return compositeChannel.getChannel();
    }

    private ChannelGroup getAndCreateChannelGroup(final String address) throws InterruptedException {
        CompositeChannel compositeChannel = this.channelTables.get(address);

        if (compositeChannel == null) {
            compositeChannel = new CompositeChannel(address, nettyClientConfig.getParallelism());
            if (null == this.channelTables.putIfAbsent(address, compositeChannel)) {
                compositeChannel = channelTables.get(address);
                if (compositeChannel.allowedToCreateChannel()) {
                    compositeChannel.createChannel();
                }
            }
        }

        return compositeChannel.getChannelGroup();
    }

    private Channel getAndCreateNameServerChannel() throws InterruptedException {
        String address = this.namesrvAddrChosen.get();
        if (address != null) {
            CompositeChannel compositeChannel = channelTables.get(address);
            if (null == compositeChannel) {
                compositeChannel = new CompositeChannel(address, 1);
                if (null == channelTables.putIfAbsent(address, compositeChannel)) {
                    return compositeChannel.createChannel();
                }
            } else {
                if (compositeChannel.allowedToCreateChannel()) {
                    return compositeChannel.createChannel();
                } else {
                    return compositeChannel.getChannel();
                }
            }
        }

        final List<String> addressList = this.namesrvAddrList.get();
        try {
            if (addressList != null && !addressList.isEmpty()) {
                for (int i = 0; i < addressList.size(); i++) {
                    int index = this.namesrvIndex.incrementAndGet();
                    index = Math.abs(index);
                    index = index % addressList.size();
                    String newAddr = addressList.get(index);
                    if (null != newAddr && !newAddr.isEmpty()) {
                        this.namesrvAddrChosen.set(newAddr);
                        return getAndCreateNameServerChannel();
                    }
                }
            }
        } catch (Exception e) {
            log.error("getAndCreateNameServerChannel: create name server channel exception", e);
        }

        log.error("Unable to create name server channel");
        return null;
    }

    private Channel createChannel(final String addr, int parallelism) throws InterruptedException {
        CompositeChannel compositeChannel = this.channelTables.get(addr);

        if (null == compositeChannel) {
            compositeChannel = new CompositeChannel(addr, parallelism);
            if (null != channelTables.putIfAbsent(addr, compositeChannel)) {
                compositeChannel = channelTables.get(addr);
            }
        }

        if (!compositeChannel.allowedToCreateChannel()) {
            return compositeChannel.getChannel();
        } else {
            return compositeChannel.createChannel();
        }
    }

    public void closeChannel(final String addr, final Channel channel) {
        if (null == channel)
            return;

        final String addrRemote = (null == addr) ? RemotingHelper.parseChannelRemoteAddr(channel) : addr;

        final CompositeChannel compositeChannel = this.channelTables.get(addrRemote);
        if (null != compositeChannel) {
            compositeChannel.closeChannel(channel);
        }
    }

    public void closeChannel(final Channel channel) {

        if (null == channel) {
            return;
        }

        try {
            CompositeChannel compositeChannel = null;
            String addrRemote = null;
            for (String key : channelTables.keySet()) {
                CompositeChannel prev = this.channelTables.get(key);
                if (null != prev && prev.containsChannel(channel)) {
                    compositeChannel = prev;
                    addrRemote = key;
                    break;
                }
            }

            if (null == compositeChannel) {
                log.info("eventCloseChannel: the channel[{}] has been removed from the channel table before", channel);
            } else {
                compositeChannel.closeChannel(channel);
                if (compositeChannel.getParallelism() == 0) {
                    channelTables.remove(addrRemote);
                    log.info("closeChannel: the channel[{}] was removed from channel table", addrRemote);
                }
            }
        } catch (Exception e) {
            log.error("closeChannel: close the channel exception", e);
        }
    }

    @Override
    public void registerProcessor(int requestCode, NettyRequestProcessor processor, ExecutorService executor) {
        ExecutorService executorThis = executor;
        if (null == executor) {
            executorThis = this.publicExecutor;
        }

        Pair<NettyRequestProcessor, ExecutorService> pair =
                new Pair<NettyRequestProcessor, ExecutorService>(processor, executorThis);
        this.processorTable.put(requestCode, pair);
    }

    @Override
    public RemotingCommand invokeSync(String addr, final RemotingCommand request, long timeoutMillis)
            throws InterruptedException, RemotingConnectException, RemotingSendRequestException,
            RemotingTimeoutException {
        final Channel channel = this.getAndCreateChannel(addr, nettyClientConfig.getParallelism());
        if (channel != null && channel.isActive()) {
            try {
                if (this.rpcHook != null) {
                    this.rpcHook.doBeforeRequest(addr, request);
                }
                RemotingCommand response = this.invokeSyncImpl(channel, request, timeoutMillis);
                if (this.rpcHook != null) {
                    this.rpcHook.doAfterResponse(request, response);
                }
                return response;
            } catch (RemotingSendRequestException e) {
                log.warn("invokeSync: send request exception, so close the channel[{}]", addr);
                this.closeChannel(addr, channel);
                throw e;
            } catch (RemotingTimeoutException e) {
                log.warn("invokeSync: wait response timeout exception, the channel[{}]", addr);
                // 超时异常如果关闭连接可能会产生连锁反应
                // this.closeChannel(addr, channel);
                throw e;
            }
        } else {
            this.closeChannel(addr, channel);
            throw new RemotingConnectException(addr);
        }
    }

    public RemotingCommand broadcastSync(final String addr,
                                         final RemotingCommand request,
                                         final long timeoutMillis)
            throws InterruptedException, RemotingConnectException, RemotingSendRequestException,
            RemotingTimeoutException {
        ChannelGroup channels = getAndCreateChannelGroup(addr);

        if (this.rpcHook != null) {
            this.rpcHook.doBeforeRequest(addr, request);
        }
        RemotingCommand response = this.broadcastSyncImpl(channels, request, timeoutMillis);
        if (this.rpcHook != null) {
            this.rpcHook.doAfterResponse(request, response);
        }
        return response;
    }

    @Override
    public void invokeAsync(String addr, RemotingCommand request, long timeoutMillis,
                            InvokeCallback invokeCallback) throws InterruptedException, RemotingConnectException,
            RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException {
        final Channel channel = this.getAndCreateChannel(addr, nettyClientConfig.getParallelism());
        if (channel != null && channel.isActive()) {
            try {
                if (this.rpcHook != null) {
                    this.rpcHook.doBeforeRequest(addr, request);
                }
                this.invokeAsyncImpl(channel, request, timeoutMillis, invokeCallback);
            } catch (RemotingSendRequestException e) {
                log.warn("invokeAsync: send request exception, so close the channel[{}]", addr);
                this.closeChannel(addr, channel);
                throw e;
            }
        } else {
            this.closeChannel(addr, channel);
            throw new RemotingConnectException(addr);
        }
    }

    @Override
    public void invokeOneWay(String addr, RemotingCommand request, long timeoutMillis)
            throws InterruptedException, RemotingConnectException, RemotingTooMuchRequestException,
            RemotingTimeoutException, RemotingSendRequestException {
        final Channel channel = this.getAndCreateChannel(addr, nettyClientConfig.getParallelism());
        if (channel != null && channel.isActive()) {
            try {
                if (this.rpcHook != null) {
                    this.rpcHook.doBeforeRequest(addr, request);
                }
                this.invokeOneWayImpl(channel, request, timeoutMillis);
            } catch (RemotingSendRequestException e) {
                log.warn("invokeOneWay: send request exception, so close the channel[{}]", addr);
                this.closeChannel(addr, channel);
                throw e;
            }
        } else {
            this.closeChannel(addr, channel);
            throw new RemotingConnectException(addr);
        }
    }

    @Override
    public ExecutorService getCallbackExecutor() {
        return this.publicExecutor;
    }

    @Override
    public void updateNameServerAddressList(List<String> addrs) {
        List<String> old = this.namesrvAddrList.get();
        boolean update = false;

        if (!addrs.isEmpty()) {
            if (null == old) {
                update = true;
            } else if (addrs.size() != old.size()) {
                update = true;
            } else {
                for (int i = 0; i < addrs.size() && !update; i++) {
                    if (!old.contains(addrs.get(i))) {
                        update = true;
                    }
                }
            }

            if (update) {
                Collections.shuffle(addrs);
                this.namesrvAddrList.set(addrs);
            }
        }
    }

    @Override
    public ChannelEventListener getChannelEventListener() {
        return channelEventListener;
    }

    public List<String> getNamesrvAddrList() {
        return namesrvAddrList.get();
    }

    @Override
    public List<String> getNameServerAddressList() {
        return this.namesrvAddrList.get();
    }

    public RPCHook getRpcHook() {
        return rpcHook;
    }

    @Override
    public void registerRPCHook(RPCHook rpcHook) {
        this.rpcHook = rpcHook;
    }

    @Override
    public RPCHook getRPCHook() {
        return this.rpcHook;
    }

    @Override
    public boolean isChannelWritable(String addr) {
        CompositeChannel compositeChannel = this.channelTables.get(addr);
        if (compositeChannel != null && compositeChannel.isOK()) {
            return compositeChannel.isWritable();
        }

        return false;
    }

    public NettyClientConfig getConfig() {
        return nettyClientConfig;
    }
}


text:
/* ========================================= */
/* == Alerts =============================== */

.alerts-boxes {
    position: fixed;
    right: 0;
    top: 20px;
    z-index: 10000;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    user-select: none;
}

.alert-box {
    position: relative;
    right: 10px;
    top: 0;
    width: 415px;
    color: #ffffff;
    z-index: 11000;
    overflow: hidden;
    border: 2px solid transparent;
    margin-bottom: 10px;
    vertical-align: top;
}

    .alert-box:hover {
        border: 2px solid #ffffff;
        border: 2px solid rgba(255, 255, 255, 0.6);
        cursor: pointer;
    }

    .alert-box .sb-text-icon {
        width: 73%;
        margin: 3px 0;
        display: inline-block;
    }

    .alert-box .sb-text {
        width: 92%;
        padding-left: 20px;
        display: inline-block;
    }

    .alert-box span {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 17px;
        font-weight: 300;
        display: block;
        margin: 4px 0;
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        -o-user-select: text;
        user-select: text;
    }

    .alert-box p {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 13px;
        margin-top: 2px;
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        -o-user-select: text;
        user-select: text;
    }

    .alert-box .ab-icon {
        display: inline-block;
        vertical-align: top;
        font-size: 50px;
        padding: 0 4px;
    }

    .alert-box .ab-small-icon {
        position: absolute;
        font-size: 20px;
        bottom: 2px;
        right: 4px;
    }

    /* ========================================= */
    /* == Alerts Colors ======================== */

    .alert-box.success {
        background-color: #47a447;
        /*background-color: #5cb85c;*/
        /*background-color: #739e73;*/
    }

    .alert-box.info {
        background-color: #3276b1;
        /*background-color: #428bca;*/
    }

    .alert-box.warning {
        /*background-color: #f0ad4e;*/
        background-color: #ed9c28;
        /*background-color: #c79121;*/
    }

    .alert-box.danger {
        background-color: #d9534f;
        /*background-color: #d2322d;*/
        /*background-color: #c46a69;*/
    }

    /* ========================================= */
    /* == Alerts Animations ==================== */

    .alert-box.ng-animate {
        -webkit-animation-duration: .4s;
        -moz-animation-duration: .4s;
        -ms-animation-duration: .4s;
        -o-animation-duration: .4s;
        animation-duration: .4s;
        -webkit-animation-fill-mode: both;
        -moz-animation-fill-mode: both;
        -ms-animation-fill-mode: both;
        -o-animation-fill-mode: both;
        animation-fill-mode: both;
        -webkit-transition-timing-function: ease-in-out;
        -moz-transition-timing-function: ease-in-out;
        -ms-transition-timing-function: ease-in-out;
        -o-transition-timing-function: ease-in-out;
        transition-timing-function: ease-in-out;
    }

    .alert-box.ng-enter {
        -webkit-animation-name: fadeInRight;
        -moz-animation-name: fadeInRight;
        -ms-animation-name: fadeInRight;
        -o-animation-name: fadeInRight;
        animation-name: fadeInRight;
    }

    .alert-box.ng-leave {
        -webkit-animation-duration: .8s;
        -moz-animation-duration: .8s;
        -ms-animation-duration: .8s;
        -o-animation-duration: .8s;
        animation-duration: .8s;
        -webkit-animation-name: fadeOutHeigth;
        -moz-animation-name: fadeOutHeigth;
        -ms-animation-name: fadeOutHeigth;
        -o-animation-name: fadeOutHeigth;
        animation-name: fadeOutHeigth;
    }


text:
#region Using

using System;
using System.Runtime.InteropServices;

#endregion

namespace StbTrueTypeSharp
{
    internal static unsafe class CRuntime
    {
        public static void* malloc(ulong size)
        {
            return malloc((long) size);
        }

        public static void* malloc(long size)
        {
            var ptr = Marshal.AllocHGlobal((int) size);

            return ptr.ToPointer();
        }

        public static void memcpy(void* a, void* b, long size)
        {
            var ap = (byte*) a;
            var bp = (byte*) b;
            for (long i = 0; i < size; ++i)
            {
                *ap++ = *bp++;
            }
        }

        public static void memcpy(void* a, void* b, ulong size)
        {
            memcpy(a, b, (long) size);
        }

        public static void free(void* a)
        {
            var ptr = new IntPtr(a);
            Marshal.FreeHGlobal(ptr);
        }

        public static void memset(void* ptr, int value, long size)
        {
            var bptr = (byte*) ptr;
            var bval = (byte) value;
            for (long i = 0; i < size; ++i)
            {
                *bptr++ = bval;
            }
        }

        public static void memset(void* ptr, int value, ulong size)
        {
            memset(ptr, value, (long) size);
        }

        public static double pow(double a, double b)
        {
            return Math.Pow(a, b);
        }

        public static float fabs(double a)
        {
            return (float) Math.Abs(a);
        }

        public static double ceil(double a)
        {
            return Math.Ceiling(a);
        }

        public static double floor(double a)
        {
            return Math.Floor(a);
        }

        public static double cos(double value)
        {
            return Math.Cos(value);
        }

        public static double acos(double value)
        {
            return Math.Acos(value);
        }

        public static double sin(double value)
        {
            return Math.Sin(value);
        }

        public static double sqrt(double val)
        {
            return Math.Sqrt(val);
        }

        public static double fmod(double x, double y)
        {
            return x % y;
        }

        public static ulong strlen(sbyte* str)
        {
            var ptr = str;

            while (*ptr != '\0')
                ptr++;

            return (ulong) ptr - (ulong) str - 1;
        }
    }
}


text:
package com.github.lukaszkusek.xml.comparator.comparators.children.cost.minimum;

import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

import com.github.lukaszkusek.xml.comparator.comparators.children.cost.CostEntry;
import com.github.lukaszkusek.xml.comparator.comparators.children.cost.CostMatrix;
import com.github.lukaszkusek.xml.comparator.node.INode;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;

class CostMatrixFilter {

    Optional<CostMatrix> filterAlreadyAssigned(CostMatrix childrenComparisonMatrix) {
        Set<INode> alreadyAssignedRowKeys = getAlreadyAssignedRows(childrenComparisonMatrix);
        Set<INode> alreadyAssignedColumnKeys = getAlreadyAssignedColumns(childrenComparisonMatrix);

        Collection<INode> filteredRowKeys =
                filterKeys(alreadyAssignedRowKeys, childrenComparisonMatrix.rowKeys());

        Collection<INode> filteredColumnKeys =
                filterKeys(alreadyAssignedColumnKeys, childrenComparisonMatrix.columnKeys());

        if (filteredRowKeys.size() == 0 || filteredColumnKeys.size() == 0) {
            return Optional.empty();
        }

        return Optional.of(filterChildrenComparisonMatrix(childrenComparisonMatrix, filteredRowKeys, filteredColumnKeys));
    }

    private CostMatrix filterChildrenComparisonMatrix(
            CostMatrix childrenComparisonMatrix,
            Collection<INode> filteredRowKeys,
            Collection<INode> filteredColumnKeys) {

        CostMatrix filtered = CostMatrix.create(filteredRowKeys, filteredColumnKeys);

        filtered.getCellSet().forEach(
                cell ->
                        filtered.put(
                                cell.getRowKey(),
                                cell.getColumnKey(),
                                childrenComparisonMatrix.getDifferenceDetails(
                                        cell.getRowKey(),
                                        cell.getColumnKey()))
        );

        return filtered;
    }

    private Collection<INode> filterKeys(Set<INode> alreadyAssignedKeyNodes, List<INode> keyNodes) {
        return Sets.difference(Sets.newHashSet(keyNodes), alreadyAssignedKeyNodes);
    }

    private Set<INode> getAlreadyAssignedRows(CostMatrix costMatrix) {
        return getAlreadyAssignedNodes(costMatrix, cell -> cell.getRowKey());
    }

    private Set<INode> getAlreadyAssignedColumns(CostMatrix costMatrix) {
        return getAlreadyAssignedNodes(costMatrix, cell -> cell.getColumnKey());
    }

    private Set<INode> getAlreadyAssignedNodes(
            CostMatrix costMatrix, Function<Table.Cell<INode, INode, CostEntry>, INode> mapper) {

        return costMatrix.getCellSet().stream()
                .filter(cell -> cell.getValue().isAssigned())
                .map(mapper)
                .collect(Collectors.toSet());
    }

}


text:
template<class ElementType, class MemoryAllocator = allocator<ElementType> >
class gtPtrVector : public gtVector<ElementType, MemoryAllocator>
{
public:
    gtPtrVector() {};
    gtPtrVector(const gtPtrVector& other) : gtVector<ElementType, MemoryAllocator>(other) {};
    virtual ~gtPtrVector() { deleteElementsAndClear(); };

    // ---------------------------------------------------------------------------
    // Name:        gtPtrVector::deleteElementsAndClear
    // Description: Deletes all the elements pointed by this vector and clears the vector.
    // Author:      AMD Developer Tools Team
    // Date:        4/4/2005
    // ---------------------------------------------------------------------------
    void deleteElementsAndClear()
    {
        // Delete the elements pointed by this vector:
        typename gtVector<ElementType, MemoryAllocator>::iterator endIter = gtPtrVector::end();
        typename gtVector<ElementType, MemoryAllocator>::iterator iter = gtPtrVector::begin();

        while (iter != endIter)
        {
            delete *iter;
            iter++;
        }

        // Clear the vector:
        gtPtrVector::clear();
    };

    void removeItem(int index)
    {
        // Move the items above the removed item one place back:
        ElementType pItemData = (*this)[index];

        for (unsigned i = index; i < (*this).size() - 1; i++)
        {
            (*this)[i] = (*this)[i + 1];

        }

        // Release data of the removed item:
        delete pItemData;

        // Pop the top item:
        (*this).pop_back();
    }

    void push_front(const ElementType& el)
    {
        // Push the element back:
        push_back(el);

        // Move the item step by step until it gets to the front:
        for (unsigned i = this->size() - 1; i > 0 ; i--)
        {
            ElementType pTemp = (*this)[i];
            (*this)[i] = (*this)[i - 1];
            (*this)[i - 1] = pTemp;
        }
    }
};

#endif  // __GTPTRVECTOR