31 #include <sys/param.h>
32 #else
33 #include <malloc.h>
34 #endif
35 #include <mlib_types.h>
36 #include <mlib_sys_proto.h>
37 #include "mlib_SysMath.h"
38
39 /***************************************************************/
40
41 #if ! defined ( __MEDIALIB_OLD_NAMES )
42 #if defined ( __SUNPRO_C )
43
44 #pragma weak mlib_memmove = __mlib_memmove
45 #pragma weak mlib_malloc = __mlib_malloc
46 #pragma weak mlib_realloc = __mlib_realloc
47 #pragma weak mlib_free = __mlib_free
48 #pragma weak mlib_memset = __mlib_memset
49 #pragma weak mlib_memcpy = __mlib_memcpy
50
51 #ifdef MLIB_NO_LIBSUNMATH
52 #pragma weak mlib_sincosf = __mlib_sincosf
53 #endif /* MLIB_NO_LIBSUNMATH */
54
55 #elif defined ( __GNUC__ ) /* defined ( __SUNPRO_C ) */
56
57 __typeof__ ( __mlib_memmove) mlib_memmove
58 __attribute__ ((weak,alias("__mlib_memmove")));
59 __typeof__ ( __mlib_malloc) mlib_malloc
60 __attribute__ ((weak,alias("__mlib_malloc")));
61 __typeof__ ( __mlib_realloc) mlib_realloc
62 __attribute__ ((weak,alias("__mlib_realloc")));
63 __typeof__ ( __mlib_free) mlib_free
64 __attribute__ ((weak,alias("__mlib_free")));
65 __typeof__ ( __mlib_memset) mlib_memset
66 __attribute__ ((weak,alias("__mlib_memset")));
67 __typeof__ ( __mlib_memcpy) mlib_memcpy
68 __attribute__ ((weak,alias("__mlib_memcpy")));
69
70 #ifdef MLIB_NO_LIBSUNMATH
71
72 void __mlib_sincosf (float x, float *s, float *c);
73
74 __typeof__ ( __mlib_sincosf) mlib_sincosf
75 __attribute__ ((weak,alias("__mlib_sincosf")));
76 #endif /* MLIB_NO_LIBSUNMATH */
77
78 #else /* defined ( __SUNPRO_C ) */
79
80 #error "unknown platform"
81
82 #endif /* defined ( __SUNPRO_C ) */
83 #endif /* ! defined ( __MEDIALIB_OLD_NAMES ) */
84
85 /***************************************************************/
86
87 void *__mlib_malloc(mlib_u32 size)
88 {
89 #if defined(_MSC_VER) || defined(AIX)
90 /*
91 * Currently, all MS C compilers for Win32 platforms default to 8 byte
92 * alignment. -- from stdlib.h of MS VC++5.0.
93 *
94 * On AIX, the malloc subroutine returns a pointer to space suitably
95 * aligned for the storage of any type of object (see 'man malloc').
96 */
110 void __mlib_free(void *ptr)
111 {
112 free(ptr);
113 }
114
115 void *__mlib_memset(void *s, mlib_s32 c, mlib_u32 n)
116 {
117 return memset(s, c, n);
118 }
119
120 void *__mlib_memcpy(void *s1, void *s2, mlib_u32 n)
121 {
122 return memcpy(s1, s2, n);
123 }
124
125 void *__mlib_memmove(void *s1, void *s2, mlib_u32 n)
126 {
127 return memmove(s1, s2, n);
128 }
129
130 #ifdef MLIB_NO_LIBSUNMATH
131
132 void __mlib_sincosf (mlib_f32 x, mlib_f32 *s, mlib_f32 *c)
133 {
134 *s = (mlib_f32)sin(x);
135 *c = (mlib_f32)cos(x);
136 }
137
138 #endif /* MLIB_NO_LIBSUNMATH */
|
31 #include <sys/param.h>
32 #else
33 #include <malloc.h>
34 #endif
35 #include <mlib_types.h>
36 #include <mlib_sys_proto.h>
37 #include "mlib_SysMath.h"
38
39 /***************************************************************/
40
41 #if ! defined ( __MEDIALIB_OLD_NAMES )
42 #if defined ( __SUNPRO_C )
43
44 #pragma weak mlib_memmove = __mlib_memmove
45 #pragma weak mlib_malloc = __mlib_malloc
46 #pragma weak mlib_realloc = __mlib_realloc
47 #pragma weak mlib_free = __mlib_free
48 #pragma weak mlib_memset = __mlib_memset
49 #pragma weak mlib_memcpy = __mlib_memcpy
50
51 #pragma weak mlib_sincosf = __mlib_sincosf
52
53 #elif defined ( __GNUC__ ) /* defined ( __SUNPRO_C ) */
54
55 __typeof__ ( __mlib_memmove) mlib_memmove
56 __attribute__ ((weak,alias("__mlib_memmove")));
57 __typeof__ ( __mlib_malloc) mlib_malloc
58 __attribute__ ((weak,alias("__mlib_malloc")));
59 __typeof__ ( __mlib_realloc) mlib_realloc
60 __attribute__ ((weak,alias("__mlib_realloc")));
61 __typeof__ ( __mlib_free) mlib_free
62 __attribute__ ((weak,alias("__mlib_free")));
63 __typeof__ ( __mlib_memset) mlib_memset
64 __attribute__ ((weak,alias("__mlib_memset")));
65 __typeof__ ( __mlib_memcpy) mlib_memcpy
66 __attribute__ ((weak,alias("__mlib_memcpy")));
67
68 void __mlib_sincosf (float x, float *s, float *c);
69
70 __typeof__ ( __mlib_sincosf) mlib_sincosf
71 __attribute__ ((weak,alias("__mlib_sincosf")));
72
73 #else /* defined ( __SUNPRO_C ) */
74
75 #error "unknown platform"
76
77 #endif /* defined ( __SUNPRO_C ) */
78 #endif /* ! defined ( __MEDIALIB_OLD_NAMES ) */
79
80 /***************************************************************/
81
82 void *__mlib_malloc(mlib_u32 size)
83 {
84 #if defined(_MSC_VER) || defined(AIX)
85 /*
86 * Currently, all MS C compilers for Win32 platforms default to 8 byte
87 * alignment. -- from stdlib.h of MS VC++5.0.
88 *
89 * On AIX, the malloc subroutine returns a pointer to space suitably
90 * aligned for the storage of any type of object (see 'man malloc').
91 */
105 void __mlib_free(void *ptr)
106 {
107 free(ptr);
108 }
109
110 void *__mlib_memset(void *s, mlib_s32 c, mlib_u32 n)
111 {
112 return memset(s, c, n);
113 }
114
115 void *__mlib_memcpy(void *s1, void *s2, mlib_u32 n)
116 {
117 return memcpy(s1, s2, n);
118 }
119
120 void *__mlib_memmove(void *s1, void *s2, mlib_u32 n)
121 {
122 return memmove(s1, s2, n);
123 }
124
125 void __mlib_sincosf (mlib_f32 x, mlib_f32 *s, mlib_f32 *c)
126 {
127 *s = (mlib_f32)sin(x);
128 *c = (mlib_f32)cos(x);
129 }
|