forked from KolibriOS/kolibrios
libc.obj: Fixed div, ldiv, lldiv ( problem with the compatibility of returned structures in functions between tcc and gcc) thanks to Boppan).
git-svn-id: svn://kolibrios.org@9233 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3bd9001d45
commit
82ddf447d5
Binary file not shown.
@ -20,13 +20,35 @@ extern int _FUNC(abs)(int);
|
|||||||
extern long _FUNC(labs)(long);
|
extern long _FUNC(labs)(long);
|
||||||
extern long long _FUNC(llabs)(long long);
|
extern long long _FUNC(llabs)(long long);
|
||||||
|
|
||||||
typedef struct { int quot, rem; } div_t;
|
typedef struct {
|
||||||
typedef struct { long quot, rem; } ldiv_t;
|
int quot;
|
||||||
typedef struct { long long quot, rem; } lldiv_t;
|
int rem;
|
||||||
|
} div_t;
|
||||||
|
|
||||||
extern div_t _FUNC(div)(int, int);
|
typedef struct {
|
||||||
extern ldiv_t _FUNC(ldiv)(long, long);
|
long quot;
|
||||||
extern lldiv_t _FUNC(lldiv)(long long, long long);
|
long rem;
|
||||||
|
} ldiv_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
long long quot;
|
||||||
|
long long rem;
|
||||||
|
} lldiv_t;
|
||||||
|
|
||||||
|
static inline
|
||||||
|
div_t div(int num, int den) {
|
||||||
|
return (div_t){ num/den, num%den };
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
ldiv_t ldiv(long num, long den) {
|
||||||
|
return (ldiv_t){ num/den, num%den };
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
lldiv_t lldiv(long long num, long long den) {
|
||||||
|
return (lldiv_t){ num/den, num%den };
|
||||||
|
}
|
||||||
|
|
||||||
extern void* _FUNC(malloc)(size_t size);
|
extern void* _FUNC(malloc)(size_t size);
|
||||||
extern void* _FUNC(calloc)(size_t num, size_t size);
|
extern void* _FUNC(calloc)(size_t num, size_t size);
|
||||||
|
@ -82,7 +82,6 @@
|
|||||||
#include "string/memmove.c"
|
#include "string/memmove.c"
|
||||||
|
|
||||||
#include "stdlib/calloc.c"
|
#include "stdlib/calloc.c"
|
||||||
#include "stdlib/lldiv.c"
|
|
||||||
#include "stdlib/malloc.c"
|
#include "stdlib/malloc.c"
|
||||||
#include "stdlib/atoll.c"
|
#include "stdlib/atoll.c"
|
||||||
#include "stdlib/free.c"
|
#include "stdlib/free.c"
|
||||||
@ -91,9 +90,7 @@
|
|||||||
#include "stdlib/atoi.c"
|
#include "stdlib/atoi.c"
|
||||||
#include "stdlib/labs.c"
|
#include "stdlib/labs.c"
|
||||||
#include "stdlib/realloc.c"
|
#include "stdlib/realloc.c"
|
||||||
#include "stdlib/ldiv.c"
|
|
||||||
#include "stdlib/abs.c"
|
#include "stdlib/abs.c"
|
||||||
#include "stdlib/div.c"
|
|
||||||
#include "stdlib/atol.c"
|
#include "stdlib/atol.c"
|
||||||
#include "stdlib/itoa.c"
|
#include "stdlib/itoa.c"
|
||||||
#include "stdlib/strtol.c"
|
#include "stdlib/strtol.c"
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
div_t div(int num, int den)
|
|
||||||
{
|
|
||||||
return (div_t){ num/den, num%den };
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
ldiv_t ldiv(long num, long den)
|
|
||||||
{
|
|
||||||
return (ldiv_t){ num/den, num%den };
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
lldiv_t lldiv(long long num, long long den)
|
|
||||||
{
|
|
||||||
return (lldiv_t){ num/den, num%den };
|
|
||||||
}
|
|
@ -49,14 +49,11 @@ atol
|
|||||||
atoll
|
atoll
|
||||||
atof
|
atof
|
||||||
calloc
|
calloc
|
||||||
div
|
|
||||||
exit
|
exit
|
||||||
free
|
free
|
||||||
itoa
|
itoa
|
||||||
labs
|
labs
|
||||||
ldiv
|
|
||||||
llabs
|
llabs
|
||||||
lldiv
|
|
||||||
malloc
|
malloc
|
||||||
realloc
|
realloc
|
||||||
strtol
|
strtol
|
||||||
|
Loading…
Reference in New Issue
Block a user