4 FILE_LICENCE ( GPL2_OR_LATER );
9 /*****************************************************************************
13 ****************************************************************************
16 static inline int strtoul_base ( const char **pp, int base )
25 if ( ( *p | 0x20 ) == 'x' ) {
37 extern unsigned int strtoul_charval ( unsigned int charval );
38 extern unsigned long strtoul ( const char *p, char **endp, int base );
39 extern unsigned long long strtoull ( const char *p, char **endp, int base );
42 /*****************************************************************************
46 ****************************************************************************
49 extern void * __malloc malloc ( size_t size );
50 extern void * realloc ( void *old_ptr, size_t new_size );
51 extern void free ( void *ptr );
52 extern void * __malloc zalloc ( size_t len );
55 * Allocate cleared memory
57 * @v nmemb Number of members
58 * @v size Size of each member
59 * @ret ptr Allocated memory
61 * Allocate memory as per malloc(), and zero it.
63 * This is implemented as a static inline, with the body of the
64 * function in zalloc(), since in most cases @c nmemb will be 1 and
65 * doing the multiply is just wasteful.
67 static inline void * __malloc calloc ( size_t nmemb, size_t size ) {
68 return zalloc ( nmemb * size );
71 /*****************************************************************************
73 * Random number generation
75 ****************************************************************************
78 extern long int random ( void );
79 extern void srandom ( unsigned int seed );
81 static inline int rand ( void ) {
85 static inline void srand ( unsigned int seed ) {
89 /*****************************************************************************
93 ****************************************************************************
96 static inline __attribute__ (( always_inline )) int abs ( int value ) {
97 return __builtin_abs ( value );
100 extern int system ( const char *command );
101 extern __asmcall int main ( void );
103 #endif /* STDLIB_H */