kolibri-libc

- Added srand and rand
- Added _libc_get_version 
- Update libc.obj.a binary

git-svn-id: svn://kolibrios.org@8743 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-05-25 00:16:29 +00:00
parent 5f66f54df7
commit 4bc3d82296
6 changed files with 40 additions and 3 deletions

View File

@ -0,0 +1,10 @@
#ifndef _LIBC_VERSION_H_
#define _LIBC_VERSION_H_
#include <stddef.h>
#define _LIBC_VERSION 8743
extern unsigned _FUNC(_libc_get_version)();
#endif

View File

@ -37,4 +37,7 @@ extern long int _FUNC(strtol)(const char* str, char** endptr, int base);
extern void _FUNC(exit)(int status); extern void _FUNC(exit)(int status);
extern void _FUNC(srand)(unsigned s);
extern int _FUNC(rand)(void);
#endif #endif

View File

@ -1,3 +1,9 @@
#include <libc_version.h>
unsigned _libc_get_version(){
return _LIBC_VERSION;
}
#include "ctype/is.c" #include "ctype/is.c"
#include "ctype/tolower.c" #include "ctype/tolower.c"
#include "ctype/toupper.c" #include "ctype/toupper.c"
@ -99,6 +105,7 @@
#include "stdlib/itoa.c" #include "stdlib/itoa.c"
#include "stdlib/time.c" #include "stdlib/time.c"
#include "stdlib/strtol.c" #include "stdlib/strtol.c"
#include "stdlib/rand.c"
#include "math/acosh.c" #include "math/acosh.c"
#include "math/asinh.c" #include "math/asinh.c"
@ -110,7 +117,6 @@
#include "math/sinh.c" #include "math/sinh.c"
#include "math/tanh.c" #include "math/tanh.c"
__asm__( __asm__(
".include \"math/acos.s\"\n\t" ".include \"math/acos.s\"\n\t"
".include \"math/asin.s\"\n\t" ".include \"math/asin.s\"\n\t"
@ -136,5 +142,4 @@ __asm__(
); );
#include "stdlib/___chkstk_ms.c" #include "stdlib/___chkstk_ms.c"
#include "exports/exports.c" #include "exports/exports.c"

View File

@ -0,0 +1,15 @@
#include <stdlib.h>
#include <stdint.h>
static uint64_t seed;
void srand(unsigned s)
{
seed = s-1;
}
int rand(void)
{
seed = 6364136223846793005ULL*seed + 1;
return seed>>33;
}

View File

@ -62,6 +62,8 @@ mktime
realloc realloc
strtol strtol
time time
srand
rand
!____STRING____ !____STRING____
memcpy memcpy
memchr memchr
@ -130,3 +132,5 @@ tolower
toupper toupper
!___CONIO___ !___CONIO___
con_set_title con_set_title
!___LIBC_VERSION___
_libc_get_version