Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:14:08

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 /*
0011     stdlib.h synopsis
0012 
0013 Macros:
0014 
0015     EXIT_FAILURE
0016     EXIT_SUCCESS
0017     MB_CUR_MAX
0018     NULL
0019     RAND_MAX
0020 
0021 Types:
0022 
0023     size_t
0024     div_t
0025     ldiv_t
0026     lldiv_t                                                               // C99
0027 
0028 double    atof (const char* nptr);
0029 int       atoi (const char* nptr);
0030 long      atol (const char* nptr);
0031 long long atoll(const char* nptr);                                        // C99
0032 double             strtod  (const char* restrict nptr, char** restrict endptr);
0033 float              strtof  (const char* restrict nptr, char** restrict endptr); // C99
0034 long double        strtold (const char* restrict nptr, char** restrict endptr); // C99
0035 long               strtol  (const char* restrict nptr, char** restrict endptr, int base);
0036 long long          strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
0037 unsigned long      strtoul (const char* restrict nptr, char** restrict endptr, int base);
0038 unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
0039 int rand(void);
0040 void srand(unsigned int seed);
0041 void* calloc(size_t nmemb, size_t size);
0042 void free(void* ptr);
0043 void* malloc(size_t size);
0044 void* realloc(void* ptr, size_t size);
0045 void abort(void);
0046 int atexit(void (*func)(void));
0047 void exit(int status);
0048 void _Exit(int status);
0049 char* getenv(const char* name);
0050 int system(const char* string);
0051 void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
0052               int (*compar)(const void *, const void *));
0053 void qsort(void* base, size_t nmemb, size_t size,
0054            int (*compar)(const void *, const void *));
0055 int         abs(      int j);
0056 long        abs(     long j);
0057 long long   abs(long long j);                                             // C++0X
0058 long       labs(     long j);
0059 long long llabs(long long j);                                             // C99
0060 div_t     div(      int numer,       int denom);
0061 ldiv_t    div(     long numer,      long denom);
0062 lldiv_t   div(long long numer, long long denom);                          // C++0X
0063 ldiv_t   ldiv(     long numer,      long denom);
0064 lldiv_t lldiv(long long numer, long long denom);                          // C99
0065 int mblen(const char* s, size_t n);
0066 int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
0067 int wctomb(char* s, wchar_t wchar);
0068 size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
0069 size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
0070 int at_quick_exit(void (*func)(void))                                     // C++11
0071 void quick_exit(int status);                                              // C++11
0072 void *aligned_alloc(size_t alignment, size_t size);                       // C11
0073 
0074 */
0075 
0076 #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0077 #  include <__cxx03/stdlib.h>
0078 #else
0079 #  include <__config>
0080 
0081 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0082 #    pragma GCC system_header
0083 #  endif
0084 
0085 // The inclusion of the system's <stdlib.h> is intentionally done once outside of any include
0086 // guards because some code expects to be able to include the underlying system header multiple
0087 // times to get different definitions based on the macros that are set before inclusion.
0088 #  if __has_include_next(<stdlib.h>)
0089 #    include_next <stdlib.h>
0090 #  endif
0091 
0092 #  if !defined(_LIBCPP_STDLIB_H)
0093 #    define _LIBCPP_STDLIB_H
0094 
0095 #    ifdef __cplusplus
0096 extern "C++" {
0097 // abs
0098 
0099 #      ifdef abs
0100 #        undef abs
0101 #      endif
0102 #      ifdef labs
0103 #        undef labs
0104 #      endif
0105 #      ifdef llabs
0106 #        undef llabs
0107 #      endif
0108 
0109 // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
0110 #      if !defined(_LIBCPP_MSVCRT)
0111 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); }
0112 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); }
0113 #      endif // !defined(_LIBCPP_MSVCRT)
0114 
0115 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float abs(float __lcpp_x) _NOEXCEPT {
0116   return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h
0117 }
0118 
0119 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double abs(double __lcpp_x) _NOEXCEPT {
0120   return __builtin_fabs(__lcpp_x);
0121 }
0122 
0123 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT {
0124   return __builtin_fabsl(__lcpp_x);
0125 }
0126 
0127 // div
0128 
0129 #      ifdef div
0130 #        undef div
0131 #      endif
0132 #      ifdef ldiv
0133 #        undef ldiv
0134 #      endif
0135 #      ifdef lldiv
0136 #        undef lldiv
0137 #      endif
0138 
0139 // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
0140 #      if !defined(_LIBCPP_MSVCRT)
0141 inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); }
0142 #        if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED))
0143 inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); }
0144 #        endif
0145 #      endif // _LIBCPP_MSVCRT
0146 } // extern "C++"
0147 #    endif   // __cplusplus
0148 #  endif     // _LIBCPP_STDLIB_H
0149 
0150 #endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)