From fda5ad66dbf959e35b388db984bc5fe5d4c0a391 Mon Sep 17 00:00:00 2001 From: vitalkrilov Date: Wed, 20 Apr 2022 17:08:10 +0000 Subject: [PATCH] libc.obj: added log2, log10, round functions git-svn-id: svn://kolibrios.org@9772 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/ktcc/trunk/libc.obj/include/math.h | 4 +++- programs/develop/ktcc/trunk/libc.obj/source/libc.c | 7 ++++++- programs/develop/ktcc/trunk/libc.obj/source/math/log10.s | 9 +++++++++ programs/develop/ktcc/trunk/libc.obj/source/math/log2.s | 7 +++++++ programs/develop/ktcc/trunk/libc.obj/source/math/round.s | 7 +++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 programs/develop/ktcc/trunk/libc.obj/source/math/log10.s create mode 100755 programs/develop/ktcc/trunk/libc.obj/source/math/log2.s create mode 100755 programs/develop/ktcc/trunk/libc.obj/source/math/round.s diff --git a/programs/develop/ktcc/trunk/libc.obj/include/math.h b/programs/develop/ktcc/trunk/libc.obj/include/math.h index b2373f5709..70312c58cd 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/math.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/math.h @@ -20,9 +20,11 @@ extern double _FUNC(fmod)(double _x, double _y); extern double _FUNC(frexp)(double _x, int* _pexp); extern double _FUNC(ldexp)(double _x, int _exp); extern double _FUNC(log)(double _y); +extern double _FUNC(log2)(double _x); extern double _FUNC(log10)(double _x); extern double _FUNC(modf)(double _x, double* _pint); extern double _FUNC(pow)(double _x, double _y); +extern double _FUNC(round)(double _x); extern double _FUNC(sin)(double _x); extern double _FUNC(sinh)(double _x); extern double _FUNC(sqrt)(double _x); @@ -61,4 +63,4 @@ struct exception { int err; }; -#endif /* _MATH_H_ */ \ No newline at end of file +#endif /* _MATH_H_ */ diff --git a/programs/develop/ktcc/trunk/libc.obj/source/libc.c b/programs/develop/ktcc/trunk/libc.obj/source/libc.c index 293fe5f1c0..a5e5d5e099 100644 --- a/programs/develop/ktcc/trunk/libc.obj/source/libc.c +++ b/programs/develop/ktcc/trunk/libc.obj/source/libc.c @@ -131,11 +131,14 @@ __asm__( ".include \"math/floor.s\"\n\t" ".include \"math/fmod.s\"\n\t" ".include \"math/log.s\"\n\t" + ".include \"math/log2.s\"\n\t" + ".include \"math/log10.s\"\n\t" ".include \"math/modf.s\"\n\t" ".include \"math/modfl.s\"\n\t" ".include \"math/pow.s\"\n\t" ".include \"math/pow2.s\"\n\t" ".include \"math/pow10.s\"\n\t" + ".include \"math/round.s\"\n\t" ".include \"math/sqrt.s\"\n\t" ".include \"math/sin.s\"\n\t" ".include \"math/tan.s\"\n\t"); @@ -258,7 +261,6 @@ ksys_dll_t EXPORTS[] = { { "acosh", &acosh }, { "asinh", &asinh }, { "atanh", &atanh }, - { "acosh", &acosh }, { "frexp", &frexp }, { "hypot", &hypot }, { "ldexp", &ldexp }, @@ -279,6 +281,9 @@ ksys_dll_t EXPORTS[] = { { "floor", &floor }, { "fmod", &fmod }, { "log", &log }, + { "log2", &log2 }, + { "log10", &log10 }, + { "round", &round }, { "modf", &modf }, { "modfl", &modfl }, { "pow", &pow }, diff --git a/programs/develop/ktcc/trunk/libc.obj/source/math/log10.s b/programs/develop/ktcc/trunk/libc.obj/source/math/log10.s new file mode 100755 index 0000000000..fa1b90239d --- /dev/null +++ b/programs/develop/ktcc/trunk/libc.obj/source/math/log10.s @@ -0,0 +1,9 @@ +.global log10; + +log10: + fld1 + fldl 4(%esp) + fyl2x + fldl2t + fdivp + ret diff --git a/programs/develop/ktcc/trunk/libc.obj/source/math/log2.s b/programs/develop/ktcc/trunk/libc.obj/source/math/log2.s new file mode 100755 index 0000000000..88abab3dc0 --- /dev/null +++ b/programs/develop/ktcc/trunk/libc.obj/source/math/log2.s @@ -0,0 +1,7 @@ +.global log2; + +log2: + fld1 + fldl 4(%esp) + fyl2x + ret diff --git a/programs/develop/ktcc/trunk/libc.obj/source/math/round.s b/programs/develop/ktcc/trunk/libc.obj/source/math/round.s new file mode 100755 index 0000000000..04815eb097 --- /dev/null +++ b/programs/develop/ktcc/trunk/libc.obj/source/math/round.s @@ -0,0 +1,7 @@ +.global round; + +round: + fldl 4(%esp) + fistp 4(%esp) + fild 4(%esp) + ret