1 /*
2 * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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 #ifdef _MSC_VER
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 return (void *) malloc(size);
95 #elif defined(MACOSX)
96 return valloc(size);
97 #else
98 return (void *) memalign(8, size);
99 #endif /* _MSC_VER */
100 }
101
102 void *__mlib_realloc(void *ptr, mlib_u32 size)
103 {
104 return realloc(ptr, size);
105 }
106
107 void __mlib_free(void *ptr)
108 {
109 free(ptr);
110 }
111
112 void *__mlib_memset(void *s, mlib_s32 c, mlib_u32 n)
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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 */
97 return (void *) malloc(size);
98 #elif defined(MACOSX)
99 return valloc(size);
100 #else
101 return (void *) memalign(8, size);
102 #endif /* _MSC_VER */
103 }
104
105 void *__mlib_realloc(void *ptr, mlib_u32 size)
106 {
107 return realloc(ptr, size);
108 }
109
110 void __mlib_free(void *ptr)
111 {
112 free(ptr);
113 }
114
115 void *__mlib_memset(void *s, mlib_s32 c, mlib_u32 n)
|