diff --git a/lib/libc/include/aarch64-macos.13-none/arm/_limits.h b/lib/libc/include/aarch64-macos.13-none/arm/_limits.h new file mode 100644 index 0000000000..8cb2759402 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/_limits.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + */ +#ifndef _ARM__LIMITS_H_ +#define _ARM__LIMITS_H_ + +#if defined (__arm__) || defined (__arm64__) + +#define __DARWIN_CLK_TCK 100 /* ticks per second */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _ARM__LIMITS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/_mcontext.h b/lib/libc/include/aarch64-macos.13-none/arm/_mcontext.h new file mode 100644 index 0000000000..26b83ce221 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/_mcontext.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2003-2012 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +#ifndef __ARM_MCONTEXT_H_ +#define __ARM_MCONTEXT_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include /* __DARWIN_UNIX03 */ +#include +#include + +#ifndef _STRUCT_MCONTEXT32 +#if __DARWIN_UNIX03 +#define _STRUCT_MCONTEXT32 struct __darwin_mcontext32 +_STRUCT_MCONTEXT32 +{ + _STRUCT_ARM_EXCEPTION_STATE __es; + _STRUCT_ARM_THREAD_STATE __ss; + _STRUCT_ARM_VFP_STATE __fs; +}; + +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_MCONTEXT32 struct mcontext32 +_STRUCT_MCONTEXT32 +{ + _STRUCT_ARM_EXCEPTION_STATE es; + _STRUCT_ARM_THREAD_STATE ss; + _STRUCT_ARM_VFP_STATE fs; +}; + +#endif /* __DARWIN_UNIX03 */ +#endif /* _STRUCT_MCONTEXT32 */ + + +#ifndef _STRUCT_MCONTEXT64 +#if __DARWIN_UNIX03 +#define _STRUCT_MCONTEXT64 struct __darwin_mcontext64 +_STRUCT_MCONTEXT64 +{ + _STRUCT_ARM_EXCEPTION_STATE64 __es; + _STRUCT_ARM_THREAD_STATE64 __ss; + _STRUCT_ARM_NEON_STATE64 __ns; +}; + +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_MCONTEXT64 struct mcontext64 +_STRUCT_MCONTEXT64 +{ + _STRUCT_ARM_EXCEPTION_STATE64 es; + _STRUCT_ARM_THREAD_STATE64 ss; + _STRUCT_ARM_NEON_STATE64 ns; +}; +#endif /* __DARWIN_UNIX03 */ +#endif /* _STRUCT_MCONTEXT32 */ + +#ifndef _MCONTEXT_T +#define _MCONTEXT_T +#if defined(__arm64__) +typedef _STRUCT_MCONTEXT64 *mcontext_t; +#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64 +#else +typedef _STRUCT_MCONTEXT32 *mcontext_t; +#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32 +#endif +#endif /* _MCONTEXT_T */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* __ARM_MCONTEXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/_param.h b/lib/libc/include/aarch64-macos.13-none/arm/_param.h new file mode 100644 index 0000000000..10b9edf2f3 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/_param.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2006-2007 Apple Inc. All rights reserved. + */ + +#ifndef _ARM__PARAM_H_ +#define _ARM__PARAM_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include + +/* + * Round p (pointer or byte index) up to a correctly-aligned value for all + * data types (int, long, ...). The result is unsigned int and must be + * cast to any desired pointer type. + */ +#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1) +#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES) + +#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1) +#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32) + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _ARM__PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/_types.h b/lib/libc/include/aarch64-macos.13-none/arm/_types.h new file mode 100644 index 0000000000..403ec44048 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/_types.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + */ +#ifndef _BSD_ARM__TYPES_H_ +#define _BSD_ARM__TYPES_H_ + +#if defined (__arm__) || defined (__arm64__) + +/* + * This header file contains integer types. It's intended to also contain + * flotaing point and other arithmetic types, as needed, later. + */ + +#ifdef __GNUC__ +typedef __signed char __int8_t; +#else /* !__GNUC__ */ +typedef char __int8_t; +#endif /* !__GNUC__ */ +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef long long __int64_t; +typedef unsigned long long __uint64_t; + +typedef long __darwin_intptr_t; +typedef unsigned int __darwin_natural_t; + +/* + * The rune type below is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it + * here, you lose a bit of ANSI conformance, but your programs will still + * work. + * + * NOTE: rune_t is not covered by ANSI nor other standards, and should not + * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and + * rune_t must be the same type. Also wint_t must be no narrower than + * wchar_t, and should also be able to hold all members of the largest + * character set plus one extra value (WEOF). wint_t must be at least 16 bits. + */ + +typedef int __darwin_ct_rune_t; /* ct_rune_t */ + +/* + * mbstate_t is an opaque object to keep conversion state, during multibyte + * stream conversions. The content must not be referenced by user programs. + */ +typedef union { + char __mbstate8[128]; + long long _mbstateL; /* for alignment */ +} __mbstate_t; + +typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */ + +#if defined(__PTRDIFF_TYPE__) +typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */ +#elif defined(__LP64__) +typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */ +#else +typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */ +#endif /* __GNUC__ */ + +#if defined(__SIZE_TYPE__) +typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */ +#else +typedef unsigned long __darwin_size_t; /* sizeof() */ +#endif + +#if (__GNUC__ > 2) +typedef __builtin_va_list __darwin_va_list; /* va_list */ +#else +typedef void * __darwin_va_list; /* va_list */ +#endif + +#if defined(__WCHAR_TYPE__) +typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */ +#else +typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */ +#endif + +typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */ + +#if defined(__WINT_TYPE__) +typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */ +#else +typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */ +#endif + +typedef unsigned long __darwin_clock_t; /* clock() */ +typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */ +typedef long __darwin_ssize_t; /* byte count or error */ +typedef long __darwin_time_t; /* time() */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _BSD_ARM__TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/gethostuuid.h b/lib/libc/include/aarch64-macos.13-none/arm/arch.h similarity index 50% rename from lib/libc/include/x86_64-macos.10-none/gethostuuid.h rename to lib/libc/include/aarch64-macos.13-none/arm/arch.h index cc7f473118..b8b25e55d3 100644 --- a/lib/libc/include/x86_64-macos.10-none/gethostuuid.h +++ b/lib/libc/include/aarch64-macos.13-none/arm/arch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Apple Inc. All rights reserved. + * Copyright (c) 2007 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -25,18 +25,47 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +#ifndef _ARM_ARCH_H +#define _ARM_ARCH_H -#ifndef __GETHOSTUUID_H -#define __GETHOSTUUID_H +#if defined (__arm__) || defined (__arm64__) -#include -#include -#include - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0) -int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0, "gethostuuid() is no longer supported"); -#else -int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA); +/* Collect the __ARM_ARCH_*__ compiler flags into something easier to use. */ +#if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7S__) || defined (__ARM_ARCH_7F__) || defined (__ARM_ARCH_7K__) +#define _ARM_ARCH_7 #endif -#endif /* __GETHOSTUUID_H */ \ No newline at end of file +#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__) +#define _ARM_ARCH_6K +#endif + +#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__) +#define _ARM_ARCH_6Z +#endif + +#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \ + defined (_ARM_ARCH_6Z) || defined (_ARM_ARCH_6K) +#define _ARM_ARCH_6 +#endif + +#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5E__) || \ + defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__) +#define _ARM_ARCH_5E +#endif + +#if defined (_ARM_ARCH_5E) || defined (__ARM_ARCH_5__) || \ + defined (__ARM_ARCH_5T__) +#define _ARM_ARCH_5 +#endif + +#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__) +#define _ARM_ARCH_4T +#endif + +#if defined (_ARM_ARCH_4T) || defined (__ARM_ARCH_4__) +#define _ARM_ARCH_4 +#endif + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/endian.h b/lib/libc/include/aarch64-macos.13-none/arm/endian.h new file mode 100644 index 0000000000..851f2eafe2 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/endian.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + */ +/* + * Copyright 1995 NeXT Computer, Inc. All rights reserved. + */ +/* + * Copyright (c) 1987, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)endian.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef _ARM__ENDIAN_H_ +#define _ARM__ENDIAN_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include +/* + * Define _NOQUAD if the compiler does NOT support 64-bit integers. + */ +/* #define _NOQUAD */ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define __DARWIN_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define __DARWIN_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define __DARWIN_PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN + +#if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) + +#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN +#define BIG_ENDIAN __DARWIN_BIG_ENDIAN +#define PDP_ENDIAN __DARWIN_PDP_ENDIAN + +#define BYTE_ORDER __DARWIN_BYTE_ORDER + +#include + +#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ +#endif /* defined (__arm__) || defined (__arm64__) */ +#endif /* !_ARM__ENDIAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/limits.h b/lib/libc/include/aarch64-macos.13-none/arm/limits.h new file mode 100644 index 0000000000..21de9a758b --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/limits.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + */ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + */ + +#ifndef _ARM_LIMITS_H_ +#define _ARM_LIMITS_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include +#include + +#define CHAR_BIT 8 /* number of bits in a char */ +#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +#define CLK_TCK __DARWIN_CLK_TCK /* ticks per second */ +#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + +/* + * According to ANSI (section 2.2.4.2), the values below must be usable by + * #if preprocessing directives. Additionally, the expression must have the + * same type as would an expression that is an object of the corresponding + * type converted according to the integral promotions. The subtraction for + * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an + * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values + * are written as hex so that GCC will be quiet about large integer constants. + */ +#define SCHAR_MAX 127 /* min value for a signed char */ +#define SCHAR_MIN (-128) /* max value for a signed char */ + +#define UCHAR_MAX 255 /* max value for an unsigned char */ +#define CHAR_MAX 127 /* max value for a char */ +#define CHAR_MIN (-128) /* min value for a char */ + +#define USHRT_MAX 65535 /* max value for an unsigned short */ +#define SHRT_MAX 32767 /* max value for a short */ +#define SHRT_MIN (-32768) /* min value for a short */ + +#define UINT_MAX 0xffffffff /* max value for an unsigned int */ +#define INT_MAX 2147483647 /* max value for an int */ +#define INT_MIN (-2147483647-1) /* min value for an int */ + +#ifdef __LP64__ +#define ULONG_MAX 0xffffffffffffffffUL /* max unsigned long */ +#define LONG_MAX 0x7fffffffffffffffL /* max signed long */ +#define LONG_MIN (-0x7fffffffffffffffL-1) /* min signed long */ +#else /* !__LP64__ */ +#define ULONG_MAX 0xffffffffUL /* max unsigned long */ +#define LONG_MAX 2147483647L /* max signed long */ +#define LONG_MIN (-2147483647L-1) /* min signed long */ +#endif /* __LP64__ */ + +#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */ +#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */ +#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */ + +#if !defined(_ANSI_SOURCE) +#ifdef __LP64__ +#define LONG_BIT 64 +#else /* !__LP64__ */ +#define LONG_BIT 32 +#endif /* __LP64__ */ +#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ +#define WORD_BIT 32 + +#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) +#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */ + +#define UQUAD_MAX ULLONG_MAX +#define QUAD_MAX LLONG_MAX +#define QUAD_MIN LLONG_MIN + +#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _ARM_LIMITS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/param.h b/lib/libc/include/aarch64-macos.13-none/arm/param.h new file mode 100644 index 0000000000..f36fa322cb --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/param.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2000-2010 Apple Inc. All rights reserved. + */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)param.h 8.1 (Berkeley) 4/4/95 + */ + +/* + * Machine dependent constants for ARM + */ + +#ifndef _ARM_PARAM_H_ +#define _ARM_PARAM_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include + +/* + * Round p (pointer or byte index) up to a correctly-aligned value for all + * data types (int, long, ...). The result is unsigned int and must be + * cast to any desired pointer type. + */ +#define ALIGNBYTES __DARWIN_ALIGNBYTES +#define ALIGN(p) __DARWIN_ALIGN(p) + +#define NBPG 4096 /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte offset into page */ +#define PGSHIFT 12 /* LOG2(NBPG) */ + +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ + +#define CLSIZE 1 +#define CLSIZELOG2 0 + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * on machines that exchange pages of input or output buffers with mbuf + * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple + * of the hardware page size. + */ +#define MSIZESHIFT 8 /* 256 */ +#define MSIZE (1 << MSIZESHIFT) /* size of an mbuf */ +#define MCLSHIFT 11 /* 2048 */ +#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */ +#define MBIGCLSHIFT 12 /* 4096 */ +#define MBIGCLBYTES (1 << MBIGCLSHIFT) /* size of a big cluster */ +#define M16KCLSHIFT 14 /* 16384 */ +#define M16KCLBYTES (1 << M16KCLSHIFT) /* size of a jumbo cluster */ + +#define MCLOFSET (MCLBYTES - 1) +#ifndef NMBCLUSTERS +#define NMBCLUSTERS CONFIG_NMBCLUSTERS /* cl map size */ +#endif + +/* + * Some macros for units conversion + */ +/* Core clicks (NeXT_page_size bytes) to segments and vice versa */ +#define ctos(x) (x) +#define stoc(x) (x) + +/* Core clicks (4096 bytes) to disk blocks */ +#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) +#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) +#define dtob(x) ((x)<>PGSHIFT) + +#ifdef __APPLE__ +#define btodb(bytes, devBlockSize) \ + ((unsigned)(bytes) / devBlockSize) +#define dbtob(db, devBlockSize) \ + ((unsigned)(db) * devBlockSize) +#else +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + ((unsigned)(bytes) >> DEV_BSHIFT) +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((unsigned)(db) << DEV_BSHIFT) +#endif + +/* + * Map a ``block device block'' to a file system block. + * This should be device dependent, and will be if we + * add an entry to cdevsw/bdevsw for that purpose. + * For now though just use DEV_BSIZE. + */ +#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) + +/* + * Macros to decode (and encode) processor status word. + */ +#define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl)) +#define USERMODE(x) (((x) & 3) == 3) +#define BASEPRI(x) (((x) & (255 << 8)) == 0) + + +#if defined(KERNEL) || defined(STANDALONE) +#define DELAY(n) delay(n) + +#else /* defined(KERNEL) || defined(STANDALONE) */ +#define DELAY(n) { int N = (n); while (--N > 0); } +#endif /* defined(KERNEL) || defined(STANDALONE) */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _ARM_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/signal.h b/lib/libc/include/aarch64-macos.13-none/arm/signal.h new file mode 100644 index 0000000000..4a8b96b383 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/signal.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2000-2009 Apple, Inc. All rights reserved. + */ +/* + * Copyright (c) 1992 NeXT Computer, Inc. + * + */ + +#ifndef _ARM_SIGNAL_ +#define _ARM_SIGNAL_ 1 + +#if defined (__arm__) || defined (__arm64__) + +#include + +#ifndef _ANSI_SOURCE +typedef int sig_atomic_t; +#endif /* ! _ANSI_SOURCE */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _ARM_SIGNAL_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/arm/types.h b/lib/libc/include/aarch64-macos.13-none/arm/types.h new file mode 100644 index 0000000000..6cc1f453c9 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/arm/types.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2000-2008 Apple Inc. All rights reserved. + */ +/* + * Copyright 1995 NeXT Computer, Inc. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.3 (Berkeley) 1/5/94 + */ + +#ifndef _ARM_MACHTYPES_H_ +#define _ARM_MACHTYPES_H_ +#define _MACHTYPES_H_ + +#if defined (__arm__) || defined (__arm64__) + +#ifndef __ASSEMBLER__ +#include +#include +/* + * Basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#include +#include +#include +#include + +#include +#include +#include +#include + +#if __LP64__ +typedef int64_t register_t; +#else +typedef int32_t register_t; +#endif + +#include +#include + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +/* These types are used for reserving the largest possible size. */ +#ifdef __arm64__ +typedef u_int64_t user_addr_t; +typedef u_int64_t user_size_t; +typedef int64_t user_ssize_t; +typedef int64_t user_long_t; +typedef u_int64_t user_ulong_t; +typedef int64_t user_time_t; +typedef int64_t user_off_t; +#else +typedef u_int32_t user_addr_t; +typedef u_int32_t user_size_t; +typedef int32_t user_ssize_t; +typedef int32_t user_long_t; +typedef u_int32_t user_ulong_t; +typedef int32_t user_time_t; +typedef int64_t user_off_t; +#endif + +#define USER_ADDR_NULL ((user_addr_t) 0) +#define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)((uintptr_t)(a_ptr))) + + +#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + +/* This defines the size of syscall arguments after copying into the kernel: */ +#if defined(__arm__) +typedef u_int32_t syscall_arg_t; +#elif defined(__arm64__) +typedef u_int64_t syscall_arg_t; +#else +#error Unknown architecture. +#endif + +#endif /* __ASSEMBLER__ */ +#endif /* defined (__arm__) || defined (__arm64__) */ +#endif /* _ARM_MACHTYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/OSAtomic.h b/lib/libc/include/aarch64-macos.13-none/libkern/OSAtomic.h similarity index 100% rename from lib/libc/include/x86_64-macos.10-none/libkern/OSAtomic.h rename to lib/libc/include/aarch64-macos.13-none/libkern/OSAtomic.h diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/OSAtomicDeprecated.h b/lib/libc/include/aarch64-macos.13-none/libkern/OSAtomicDeprecated.h similarity index 93% rename from lib/libc/include/x86_64-macos.10-none/libkern/OSAtomicDeprecated.h rename to lib/libc/include/aarch64-macos.13-none/libkern/OSAtomicDeprecated.h index aef009bc04..6dc880b0d4 100644 --- a/lib/libc/include/x86_64-macos.10-none/libkern/OSAtomicDeprecated.h +++ b/lib/libc/include/aarch64-macos.13-none/libkern/OSAtomicDeprecated.h @@ -35,13 +35,14 @@ * is preferred. */ +#include + #if !(defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED) #include #include #include #include -#include #ifndef OSATOMIC_DEPRECATED #define OSATOMIC_DEPRECATED 1 @@ -161,7 +162,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) int32_t OSAtomicAdd32Barrier( int32_t __theAmount, volatile int32_t *__theValue ); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT /*! @abstract Atomically increments a 32-bit value. @result Returns the new value. @@ -248,7 +249,7 @@ int64_t OSAtomicAdd64Barrier( int64_t __theAmount, volatile OSAtomic_int64_aligned64_t *__theValue ); -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT /*! @abstract Atomically increments a 64-bit value. @result Returns the new value. @@ -361,7 +362,7 @@ int32_t OSAtomicOr32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); This function performs the bitwise OR of the value given by __theMask with the value in the memory location referenced by __theValue, storing the result back to that memory location atomically. - + This function is equivalent to {@link OSAtomicOr32Orig} except that it also introduces a barrier. @result Returns the original value referenced by __theValue. @@ -481,7 +482,7 @@ int32_t OSAtomicXor32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) int32_t OSAtomicXor32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue ); - + /*! @group Compare and swap * Functions in this group return true if the swap occured. There are several versions, @@ -587,7 +588,7 @@ bool OSAtomicCompareAndSwapIntBarrier( int __oldValue, int __newValue, volatile match, this function stores the value from __newValue into that memory location atomically. - This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, + This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, or {@link OSAtomicCompareAndSwap64} on 64-bit architectures. @result Returns TRUE on a match, FALSE otherwise. */ @@ -606,7 +607,7 @@ bool OSAtomicCompareAndSwapLong( long __oldValue, long __newValue, volatile long This function is equivalent to {@link OSAtomicCompareAndSwapLong} except that it also introduces a barrier. - This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, + This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, or {@link OSAtomicCompareAndSwap64} on 64-bit architectures. @result Returns TRUE on a match, FALSE otherwise. */ @@ -706,7 +707,7 @@ bool OSAtomicTestAndSetBarrier( uint32_t __n, volatile void *__theAddress ); For example, if __theAddress points to a 64-bit value, to compare the value of the most significant bit, you would specify 56 for __n. - + @result Returns the original value of the bit being tested. */ @@ -719,15 +720,15 @@ bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress ); @discussion This function tests a bit in the value referenced by __theAddress and if it is not cleared, clears it. - + The bit is chosen by the value of __n such that the operation will be performed on bit (0x80 >> (__n & 7)) of byte ((char *)__theAddress + (n >> 3)). - + For example, if __theAddress points to a 64-bit value, to compare the value of the most significant bit, you would specify 56 for __n. - + This function is equivalent to {@link OSAtomicTestAndSet} except that it also introduces a barrier. @result @@ -736,7 +737,7 @@ bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress ); OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) bool OSAtomicTestAndClearBarrier( uint32_t __n, volatile void *__theAddress ); - + /*! @group Memory barriers */ @@ -1174,4 +1175,92 @@ __END_DECLS #endif // defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED +#if TARGET_OS_OSX || TARGET_OS_DRIVERKIT + +__BEGIN_DECLS + +/*! @group Lockless atomic fifo enqueue and dequeue + * These routines manipulate singly-linked FIFO lists. + * + * This API is deprecated and no longer recommended + */ + +/*! @abstract The data structure for a fifo queue head. + @discussion + You should always initialize a fifo queue head structure with the + initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use. + */ +#if defined(__LP64__) + +typedef volatile struct { + void *opaque1; + void *opaque2; + int opaque3; +} __attribute__ ((aligned (16))) OSFifoQueueHead; + +#else + +typedef volatile struct { + void *opaque1; + void *opaque2; + int opaque3; +} OSFifoQueueHead; + +#endif +/*! @abstract The initialization vector for a fifo queue head. */ +#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, NULL, 0 } + +/*! @abstract Enqueue an element onto a list. + @discussion + Memory barriers are incorporated as needed to permit thread-safe access + to the queue element. + @param __list + The list on which you want to enqueue the element. + @param __new + The element to add. + @param __offset + The "offset" parameter is the offset (in bytes) of the link field + from the beginning of the data structure being queued (__new). + The link field should be a pointer type. + The __offset value needs to be same for all enqueuing and + dequeuing operations on the same list, even if different structure types + are enqueued on that list. The use of offsetset(), defined in + stddef.h is the common way to specify the __offset + value. + + @note + This API is deprecated and no longer recommended + */ +__API_DEPRECATED("No longer supported", macos(10.7, 11.0)) +void OSAtomicFifoEnqueue( OSFifoQueueHead *__list, void *__new, size_t __offset); + +/*! @abstract Dequeue an element from a list. + @discussion + Memory barriers are incorporated as needed to permit thread-safe access + to the queue element. + @param __list + The list from which you want to dequeue an element. + @param __offset + The "offset" parameter is the offset (in bytes) of the link field + from the beginning of the data structure being dequeued (__new). + The link field should be a pointer type. + The __offset value needs to be same for all enqueuing and + dequeuing operations on the same list, even if different structure types + are enqueued on that list. The use of offsetset(), defined in + stddef.h is the common way to specify the __offset + value. + @result + Returns the oldest enqueued element, or NULL if the + list is empty. + + @note + This API is deprecated and no longer recommended + */ +__API_DEPRECATED("No longer supported", macos(10.7, 11.0)) +void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset); + +__END_DECLS + +#endif /* TARGET_OS_OSX || TARGET_OS_DRIVERKIT */ + #endif /* _OSATOMIC_DEPRECATED_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/OSAtomicQueue.h b/lib/libc/include/aarch64-macos.13-none/libkern/OSAtomicQueue.h similarity index 59% rename from lib/libc/include/x86_64-macos.10-none/libkern/OSAtomicQueue.h rename to lib/libc/include/aarch64-macos.13-none/libkern/OSAtomicQueue.h index 3f673861e3..66033fc834 100644 --- a/lib/libc/include/x86_64-macos.10-none/libkern/OSAtomicQueue.h +++ b/lib/libc/include/aarch64-macos.13-none/libkern/OSAtomicQueue.h @@ -28,6 +28,7 @@ #include #include #include +#include "OSAtomicDeprecated.h" #include @@ -109,83 +110,6 @@ void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset); __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0) void* OSAtomicDequeue( OSQueueHead *__list, size_t __offset); -#if defined(__x86_64__) || defined(__i386__) - -/*! @group Lockless atomic fifo enqueue and dequeue - * These routines manipulate singly-linked FIFO lists. - */ - -/*! @abstract The data structure for a fifo queue head. - @discussion - You should always initialize a fifo queue head structure with the - initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use. - */ -#if defined(__x86_64__) - -typedef volatile struct { - void *opaque1; - void *opaque2; - int opaque3; -} __attribute__ ((aligned (16))) OSFifoQueueHead; - -#else - -typedef volatile struct { - void *opaque1; - void *opaque2; - int opaque3; -} OSFifoQueueHead; - -#endif - -/*! @abstract The initialization vector for a fifo queue head. */ -#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, NULL, 0 } - -/*! @abstract Enqueue an element onto a list. - @discussion - Memory barriers are incorporated as needed to permit thread-safe access - to the queue element. - @param __list - The list on which you want to enqueue the element. - @param __new - The element to add. - @param __offset - The "offset" parameter is the offset (in bytes) of the link field - from the beginning of the data structure being queued (__new). - The link field should be a pointer type. - The __offset value needs to be same for all enqueuing and - dequeuing operations on the same list, even if different structure types - are enqueued on that list. The use of offsetset(), defined in - stddef.h is the common way to specify the __offset - value. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) -void OSAtomicFifoEnqueue( OSFifoQueueHead *__list, void *__new, size_t __offset); - -/*! @abstract Dequeue an element from a list. - @discussion - Memory barriers are incorporated as needed to permit thread-safe access - to the queue element. - @param __list - The list from which you want to dequeue an element. - @param __offset - The "offset" parameter is the offset (in bytes) of the link field - from the beginning of the data structure being dequeued (__new). - The link field should be a pointer type. - The __offset value needs to be same for all enqueuing and - dequeuing operations on the same list, even if different structure types - are enqueued on that list. The use of offsetset(), defined in - stddef.h is the common way to specify the __offset - value. - @result - Returns the oldest enqueued element, or NULL if the - list is empty. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA) -void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset); - -#endif /* __i386__ || __x86_64__ */ - __END_DECLS #endif /* _OSATOMICQUEUE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/OSSpinLockDeprecated.h b/lib/libc/include/aarch64-macos.13-none/libkern/OSSpinLockDeprecated.h similarity index 100% rename from lib/libc/include/x86_64-macos.10-none/libkern/OSSpinLockDeprecated.h rename to lib/libc/include/aarch64-macos.13-none/libkern/OSSpinLockDeprecated.h diff --git a/lib/libc/include/aarch64-macos.13-none/libkern/arm/OSByteOrder.h b/lib/libc/include/aarch64-macos.13-none/libkern/arm/OSByteOrder.h new file mode 100644 index 0000000000..f89a24b53f --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/libkern/arm/OSByteOrder.h @@ -0,0 +1,216 @@ +/* + * Copyright (c) 1999-2007 Apple Inc. All rights reserved. + */ + +#ifndef _OS_OSBYTEORDERARM_H +#define _OS_OSBYTEORDERARM_H + +#include +#include /* for _ARM_ARCH_6 */ + +/* Generic byte swapping functions. */ + +__DARWIN_OS_INLINE +uint16_t +_OSSwapInt16( + uint16_t _data + ) +{ + /* Reduces to 'rev16' with clang */ + return (uint16_t)(_data << 8 | _data >> 8); +} + +__DARWIN_OS_INLINE +uint32_t +_OSSwapInt32( + uint32_t _data + ) +{ +#if defined(__llvm__) + _data = __builtin_bswap32(_data); +#else + /* This actually generates the best code */ + _data = (((_data ^ (_data >> 16 | (_data << 16))) & 0xFF00FFFF) >> 8) ^ (_data >> 8 | _data << 24); +#endif + + return _data; +} + +__DARWIN_OS_INLINE +uint64_t +_OSSwapInt64( + uint64_t _data + ) +{ +#if defined(__llvm__) + return __builtin_bswap64(_data); +#else + union { + uint64_t _ull; + uint32_t _ul[2]; + } _u; + + /* This actually generates the best code */ + _u._ul[0] = (uint32_t)(_data >> 32); + _u._ul[1] = (uint32_t)(_data & 0xffffffff); + _u._ul[0] = _OSSwapInt32(_u._ul[0]); + _u._ul[1] = _OSSwapInt32(_u._ul[1]); + return _u._ull; +#endif +} + +/* Functions for byte reversed loads. */ + +struct _OSUnalignedU16 { + volatile uint16_t __val; +} __attribute__((__packed__)); + +struct _OSUnalignedU32 { + volatile uint32_t __val; +} __attribute__((__packed__)); + +struct _OSUnalignedU64 { + volatile uint64_t __val; +} __attribute__((__packed__)); + +#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +__DARWIN_OS_INLINE +uint16_t +_OSReadSwapInt16( + const volatile void * _base, + uintptr_t _offset + ) +{ + return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val); +} +#else +__DARWIN_OS_INLINE +uint16_t +OSReadSwapInt16( + const volatile void * _base, + uintptr_t _offset + ) +{ + return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val); +} +#endif + +#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +__DARWIN_OS_INLINE +uint32_t +_OSReadSwapInt32( + const volatile void * _base, + uintptr_t _offset + ) +{ + return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val); +} +#else +__DARWIN_OS_INLINE +uint32_t +OSReadSwapInt32( + const volatile void * _base, + uintptr_t _offset + ) +{ + return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val); +} +#endif + +#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +__DARWIN_OS_INLINE +uint64_t +_OSReadSwapInt64( + const volatile void * _base, + uintptr_t _offset + ) +{ + return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val); +} +#else +__DARWIN_OS_INLINE +uint64_t +OSReadSwapInt64( + const volatile void * _base, + uintptr_t _offset + ) +{ + return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val); +} +#endif + +/* Functions for byte reversed stores. */ + +#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +__DARWIN_OS_INLINE +void +_OSWriteSwapInt16( + volatile void * _base, + uintptr_t _offset, + uint16_t _data + ) +{ + ((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data); +} +#else +__DARWIN_OS_INLINE +void +OSWriteSwapInt16( + volatile void * _base, + uintptr_t _offset, + uint16_t _data + ) +{ + ((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data); +} +#endif + +#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +__DARWIN_OS_INLINE +void +_OSWriteSwapInt32( + volatile void * _base, + uintptr_t _offset, + uint32_t _data + ) +{ + ((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data); +} +#else +__DARWIN_OS_INLINE +void +OSWriteSwapInt32( + volatile void * _base, + uintptr_t _offset, + uint32_t _data + ) +{ + ((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data); +} +#endif + +#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) +__DARWIN_OS_INLINE +void +_OSWriteSwapInt64( + volatile void * _base, + uintptr_t _offset, + uint64_t _data + ) +{ + ((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data); +} +#else +__DARWIN_OS_INLINE +void +OSWriteSwapInt64( + volatile void * _base, + uintptr_t _offset, + uint64_t _data + ) +{ + ((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data); +} +#endif + +#endif /* ! _OS_OSBYTEORDERARM_H */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/mach/arm/_structs.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/_structs.h new file mode 100644 index 0000000000..5bc9ee2f2d --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/_structs.h @@ -0,0 +1,683 @@ +/* + * Copyright (c) 2004-2007 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * @OSF_COPYRIGHT@ + */ +#ifndef _MACH_ARM__STRUCTS_H_ +#define _MACH_ARM__STRUCTS_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include /* __DARWIN_UNIX03 */ +#include /* __uint32_t */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_EXCEPTION_STATE struct __darwin_arm_exception_state +_STRUCT_ARM_EXCEPTION_STATE +{ + __uint32_t __exception; /* number of arm exception taken */ + __uint32_t __fsr; /* Fault status */ + __uint32_t __far; /* Virtual Fault Address */ +}; +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_EXCEPTION_STATE struct arm_exception_state +_STRUCT_ARM_EXCEPTION_STATE +{ + __uint32_t exception; /* number of arm exception taken */ + __uint32_t fsr; /* Fault status */ + __uint32_t far; /* Virtual Fault Address */ +}; +#endif /* __DARWIN_UNIX03 */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_EXCEPTION_STATE64 struct __darwin_arm_exception_state64 +_STRUCT_ARM_EXCEPTION_STATE64 +{ + __uint64_t __far; /* Virtual Fault Address */ + __uint32_t __esr; /* Exception syndrome */ + __uint32_t __exception; /* number of arm exception taken */ +}; +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64 +_STRUCT_ARM_EXCEPTION_STATE64 +{ + __uint64_t far; /* Virtual Fault Address */ + __uint32_t esr; /* Exception syndrome */ + __uint32_t exception; /* number of arm exception taken */ +}; +#endif /* __DARWIN_UNIX03 */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_THREAD_STATE struct __darwin_arm_thread_state +_STRUCT_ARM_THREAD_STATE +{ + __uint32_t __r[13]; /* General purpose register r0-r12 */ + __uint32_t __sp; /* Stack pointer r13 */ + __uint32_t __lr; /* Link register r14 */ + __uint32_t __pc; /* Program counter r15 */ + __uint32_t __cpsr; /* Current program status register */ +}; +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_THREAD_STATE struct arm_thread_state +_STRUCT_ARM_THREAD_STATE +{ + __uint32_t r[13]; /* General purpose register r0-r12 */ + __uint32_t sp; /* Stack pointer r13 */ + __uint32_t lr; /* Link register r14 */ + __uint32_t pc; /* Program counter r15 */ + __uint32_t cpsr; /* Current program status register */ +}; +#endif /* __DARWIN_UNIX03 */ + + +/* + * By default, the pointer fields in the arm_thread_state64_t structure are + * opaque on the arm64e architecture and require the use of accessor macros. + * This mode can also be enabled on the arm64 architecture by building with + * -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1. + */ +#if defined(__arm64__) && defined(__LP64__) + +#if __has_feature(ptrauth_calls) +#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1 +#define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1 +#endif /* __has_feature(ptrauth_calls) */ + +#ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64 +#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0 +#endif + +#else /* defined(__arm64__) && defined(__LP64__) */ + +#undef __DARWIN_OPAQUE_ARM_THREAD_STATE64 +#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0 + +#endif /* defined(__arm64__) && defined(__LP64__) */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_THREAD_STATE64 struct __darwin_arm_thread_state64 +#if __DARWIN_OPAQUE_ARM_THREAD_STATE64 +_STRUCT_ARM_THREAD_STATE64 +{ + __uint64_t __x[29]; /* General purpose registers x0-x28 */ + void* __opaque_fp; /* Frame pointer x29 */ + void* __opaque_lr; /* Link register x30 */ + void* __opaque_sp; /* Stack pointer x31 */ + void* __opaque_pc; /* Program counter */ + __uint32_t __cpsr; /* Current program status register */ + __uint32_t __opaque_flags; /* Flags describing structure format */ +}; +#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */ +_STRUCT_ARM_THREAD_STATE64 +{ + __uint64_t __x[29]; /* General purpose registers x0-x28 */ + __uint64_t __fp; /* Frame pointer x29 */ + __uint64_t __lr; /* Link register x30 */ + __uint64_t __sp; /* Stack pointer x31 */ + __uint64_t __pc; /* Program counter */ + __uint32_t __cpsr; /* Current program status register */ + __uint32_t __pad; /* Same size for 32-bit or 64-bit clients */ +}; +#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */ +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64 +#if __DARWIN_OPAQUE_ARM_THREAD_STATE64 +_STRUCT_ARM_THREAD_STATE64 +{ + __uint64_t x[29]; /* General purpose registers x0-x28 */ + void* __opaque_fp; /* Frame pointer x29 */ + void* __opaque_lr; /* Link register x30 */ + void* __opaque_sp; /* Stack pointer x31 */ + void* __opaque_pc; /* Program counter */ + __uint32_t cpsr; /* Current program status register */ + __uint32_t __opaque_flags; /* Flags describing structure format */ +}; +#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */ +_STRUCT_ARM_THREAD_STATE64 +{ + __uint64_t x[29]; /* General purpose registers x0-x28 */ + __uint64_t fp; /* Frame pointer x29 */ + __uint64_t lr; /* Link register x30 */ + __uint64_t sp; /* Stack pointer x31 */ + __uint64_t pc; /* Program counter */ + __uint32_t cpsr; /* Current program status register */ + __uint32_t __pad; /* Same size for 32-bit or 64-bit clients */ +}; +#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */ +#endif /* __DARWIN_UNIX03 */ + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) + +/* Accessor macros for arm_thread_state64_t pointer fields */ + +#if __has_feature(ptrauth_calls) && defined(__LP64__) +#include + +#if !__DARWIN_OPAQUE_ARM_THREAD_STATE64 || !__DARWIN_PTRAUTH_ARM_THREAD_STATE64 +#error "Invalid configuration" +#endif + +#define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1 +#define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2 +#define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC 0x4 +#define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR 0x8 + +#define __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK 0xff000000 + +/* Return pc field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_pc(ts) \ + __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + (uintptr_t)(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \ + ptrauth_auth_data(__tsp->__opaque_pc, \ + ptrauth_key_process_independent_code, \ + ((__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC) == 0 && \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \ + ptrauth_blend_discriminator((void *)(unsigned long) \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \ + ptrauth_string_discriminator("pc")) : \ + ptrauth_string_discriminator("pc")) : __tsp->__opaque_pc); }) +/* Return pc field of arm_thread_state64_t as a function pointer. May return + * NULL if a valid function pointer cannot be constructed, the caller should + * fall back to the __darwin_arm_thread_state64_get_pc() macro in that case. */ +#define __darwin_arm_thread_state64_get_pc_fptr(ts) \ + __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + (__tsp->__opaque_pc && !(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \ + ptrauth_auth_function(__tsp->__opaque_pc, \ + ptrauth_key_process_independent_code, \ + ((__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC) == 0 && \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \ + ptrauth_blend_discriminator((void *)(unsigned long) \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \ + ptrauth_string_discriminator("pc")) : \ + ptrauth_string_discriminator("pc")) : NULL); }) +/* Set pc field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \ + __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + __typeof__(fptr) __f = (fptr); __tsp->__opaque_pc = \ + (__f ? (!(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \ + ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \ + ptrauth_key_process_independent_code, \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK) ? \ + ptrauth_blend_discriminator((void *)(unsigned long) \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \ + ptrauth_string_discriminator("pc")) : \ + ptrauth_string_discriminator("pc")) : ptrauth_auth_data(__f, \ + ptrauth_key_function_pointer, 0)) : __f); \ + __tsp->__opaque_flags &= \ + ~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC; }) +/* Return lr field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_lr(ts) \ + __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + (uintptr_t)(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \ + ptrauth_auth_data(__tsp->__opaque_lr, \ + ptrauth_key_process_independent_code, \ + ((__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR) == 0 && \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \ + ptrauth_blend_discriminator((void *)(unsigned long) \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \ + ptrauth_string_discriminator("lr")) : \ + ptrauth_string_discriminator("lr")) : __tsp->__opaque_lr); }) +/* Return lr field of arm_thread_state64_t as a function pointer. May return + * NULL if a valid function pointer cannot be constructed, the caller should + * fall back to the __darwin_arm_thread_state64_get_lr() macro in that case. */ +#define __darwin_arm_thread_state64_get_lr_fptr(ts) \ + __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + (__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \ + ptrauth_auth_function(__tsp->__opaque_lr, \ + ptrauth_key_process_independent_code, \ + ((__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR) == 0 && \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \ + ptrauth_blend_discriminator((void *)(unsigned long) \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \ + ptrauth_string_discriminator("lr")) : \ + ptrauth_string_discriminator("lr")) : NULL); }) +/* Set lr field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \ + __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + __typeof__(fptr) __f = (fptr); __tsp->__opaque_lr = \ + (__f ? (!(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? (__tsp->__opaque_flags \ + &= ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR , \ + ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \ + ptrauth_key_process_independent_code, \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK) ? \ + ptrauth_blend_discriminator((void *)(unsigned long) \ + (__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \ + ptrauth_string_discriminator("lr")) : \ + ptrauth_string_discriminator("lr"))) : ptrauth_auth_data(__f, \ + ptrauth_key_function_pointer, 0)) : __f); __tsp->__opaque_flags &= \ + ~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR; }) +/* Return sp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_sp(ts) \ + __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + (uintptr_t)(__tsp->__opaque_sp && !(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \ + ptrauth_auth_data(__tsp->__opaque_sp, \ + ptrauth_key_process_independent_data, \ + ptrauth_string_discriminator("sp")) : __tsp->__opaque_sp); }) +/* Set sp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_sp(ts, ptr) \ + __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_sp = \ + (__p && !(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \ + ptrauth_sign_unauthenticated(__p, \ + ptrauth_key_process_independent_data, \ + ptrauth_string_discriminator("sp")) : __p); }) +/* Return fp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_fp(ts) \ + __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + (uintptr_t)(__tsp->__opaque_fp && !(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \ + ptrauth_auth_data(__tsp->__opaque_fp, \ + ptrauth_key_process_independent_data, \ + ptrauth_string_discriminator("fp")) : __tsp->__opaque_fp); }) +/* Set fp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_fp(ts, ptr) \ + __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_fp = \ + (__p && !(__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \ + ptrauth_sign_unauthenticated(__p, \ + ptrauth_key_process_independent_data, \ + ptrauth_string_discriminator("fp")) : __p); }) + +/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */ +#define __darwin_arm_thread_state64_ptrauth_strip(ts) \ + __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + __tsp->__opaque_pc = ((__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_pc : \ + ptrauth_strip(__tsp->__opaque_pc, ptrauth_key_process_independent_code)); \ + __tsp->__opaque_lr = ((__tsp->__opaque_flags & \ + (__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? __tsp->__opaque_lr : \ + ptrauth_strip(__tsp->__opaque_lr, ptrauth_key_process_independent_code)); \ + __tsp->__opaque_sp = ((__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_sp : \ + ptrauth_strip(__tsp->__opaque_sp, ptrauth_key_process_independent_data)); \ + __tsp->__opaque_fp = ((__tsp->__opaque_flags & \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_fp : \ + ptrauth_strip(__tsp->__opaque_fp, ptrauth_key_process_independent_data)); \ + __tsp->__opaque_flags |= \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH; __tsp->__opaque_flags &= \ + ~(__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC | \ + __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR); }) + +#else /* __has_feature(ptrauth_calls) && defined(__LP64__) */ + +#if __DARWIN_OPAQUE_ARM_THREAD_STATE64 + +#ifndef __LP64__ +#error "Invalid configuration" +#endif + +/* Return pc field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_pc(ts) \ + ((uintptr_t)((ts).__opaque_pc)) +/* Return pc field of arm_thread_state64_t as a function pointer */ +#define __darwin_arm_thread_state64_get_pc_fptr(ts) \ + ((ts).__opaque_pc) +/* Set pc field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \ + ((ts).__opaque_pc = (fptr)) +/* Return lr field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_lr(ts) \ + ((uintptr_t)((ts).__opaque_lr)) +/* Return lr field of arm_thread_state64_t as a function pointer */ +#define __darwin_arm_thread_state64_get_lr_fptr(ts) \ + ((ts).__opaque_lr) +/* Set lr field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \ + ((ts).__opaque_lr = (fptr)) +/* Return sp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_sp(ts) \ + ((uintptr_t)((ts).__opaque_sp)) +/* Set sp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_sp(ts, ptr) \ + ((ts).__opaque_sp = (void*)(uintptr_t)(ptr)) +/* Return fp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_fp(ts) \ + ((uintptr_t)((ts).__opaque_fp)) +/* Set fp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_fp(ts, ptr) \ + ((ts).__opaque_fp = (void*)(uintptr_t)(ptr)) +/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */ +#define __darwin_arm_thread_state64_ptrauth_strip(ts) \ + (void)(ts) + +#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */ +#if __DARWIN_UNIX03 + +/* Return pc field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_pc(ts) \ + ((ts).__pc) +/* Return pc field of arm_thread_state64_t as a function pointer */ +#define __darwin_arm_thread_state64_get_pc_fptr(ts) \ + ((void*)(uintptr_t)((ts).__pc)) +/* Set pc field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \ + ((ts).__pc = (uintptr_t)(fptr)) +/* Return lr field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_lr(ts) \ + ((ts).__lr) +/* Return lr field of arm_thread_state64_t as a function pointer */ +#define __darwin_arm_thread_state64_get_lr_fptr(ts) \ + ((void*)(uintptr_t)((ts).__lr)) +/* Set lr field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \ + ((ts).__lr = (uintptr_t)(fptr)) +/* Return sp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_sp(ts) \ + ((ts).__sp) +/* Set sp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_sp(ts, ptr) \ + ((ts).__sp = (uintptr_t)(ptr)) +/* Return fp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_fp(ts) \ + ((ts).__fp) +/* Set fp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_fp(ts, ptr) \ + ((ts).__fp = (uintptr_t)(ptr)) +/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */ +#define __darwin_arm_thread_state64_ptrauth_strip(ts) \ + (void)(ts) + +#else /* __DARWIN_UNIX03 */ + +/* Return pc field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_pc(ts) \ + ((ts).pc) +/* Return pc field of arm_thread_state64_t as a function pointer */ +#define __darwin_arm_thread_state64_get_pc_fptr(ts) \ + ((void*)(uintptr_t)((ts).pc)) +/* Set pc field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \ + ((ts).pc = (uintptr_t)(fptr)) +/* Return lr field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_lr(ts) \ + ((ts).lr) +/* Return lr field of arm_thread_state64_t as a function pointer */ +#define __darwin_arm_thread_state64_get_lr_fptr(ts) \ + ((void*)(uintptr_t)((ts).lr)) +/* Set lr field of arm_thread_state64_t to a function pointer */ +#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \ + ((ts).lr = (uintptr_t)(fptr)) +/* Return sp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_sp(ts) \ + ((ts).sp) +/* Set sp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_sp(ts, ptr) \ + ((ts).sp = (uintptr_t)(ptr)) +/* Return fp field of arm_thread_state64_t as a data pointer value */ +#define __darwin_arm_thread_state64_get_fp(ts) \ + ((ts).fp) +/* Set fp field of arm_thread_state64_t to a data pointer value */ +#define __darwin_arm_thread_state64_set_fp(ts, ptr) \ + ((ts).fp = (uintptr_t)(ptr)) +/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */ +#define __darwin_arm_thread_state64_ptrauth_strip(ts) \ + (void)(ts) + +#endif /* __DARWIN_UNIX03 */ +#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */ + +#endif /* __has_feature(ptrauth_calls) && defined(__LP64__) */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_VFP_STATE struct __darwin_arm_vfp_state +_STRUCT_ARM_VFP_STATE +{ + __uint32_t __r[64]; + __uint32_t __fpscr; +}; +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_VFP_STATE struct arm_vfp_state +_STRUCT_ARM_VFP_STATE +{ + __uint32_t r[64]; + __uint32_t fpscr; +}; +#endif /* __DARWIN_UNIX03 */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_NEON_STATE64 struct __darwin_arm_neon_state64 +#define _STRUCT_ARM_NEON_STATE struct __darwin_arm_neon_state + +#if defined(__arm64__) +_STRUCT_ARM_NEON_STATE64 +{ + __uint128_t __v[32]; + __uint32_t __fpsr; + __uint32_t __fpcr; +}; + +_STRUCT_ARM_NEON_STATE +{ + __uint128_t __v[16]; + __uint32_t __fpsr; + __uint32_t __fpcr; +}; +#elif defined(__arm__) +/* + * No 128-bit intrinsic for ARM; leave it opaque for now. + */ +_STRUCT_ARM_NEON_STATE64 +{ + char opaque[(32 * 16) + (2 * sizeof(__uint32_t))]; +} __attribute__((aligned(16))); + +_STRUCT_ARM_NEON_STATE +{ + char opaque[(16 * 16) + (2 * sizeof(__uint32_t))]; +} __attribute__((aligned(16))); + +#else +#error Unknown architecture. +#endif + +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_NEON_STATE64 struct arm_neon_state64 +#define _STRUCT_ARM_NEON_STATE struct arm_neon_state + +#if defined(__arm64__) +_STRUCT_ARM_NEON_STATE64 +{ + __uint128_t q[32]; + uint32_t fpsr; + uint32_t fpcr; +}; + +_STRUCT_ARM_NEON_STATE +{ + __uint128_t q[16]; + uint32_t fpsr; + uint32_t fpcr; +}; +#elif defined(__arm__) +/* + * No 128-bit intrinsic for ARM; leave it opaque for now. + */ +_STRUCT_ARM_NEON_STATE64 +{ + char opaque[(32 * 16) + (2 * sizeof(__uint32_t))]; +} __attribute__((aligned(16))); + +_STRUCT_ARM_NEON_STATE +{ + char opaque[(16 * 16) + (2 * sizeof(__uint32_t))]; +} __attribute__((aligned(16))); + +#else +#error Unknown architecture. +#endif + +#endif /* __DARWIN_UNIX03 */ + + +#define _STRUCT_ARM_PAGEIN_STATE struct __arm_pagein_state +_STRUCT_ARM_PAGEIN_STATE +{ + int __pagein_error; +}; + +/* + * Debug State + */ +#if defined(__arm__) +/* Old-fashioned debug state is only for ARM */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_DEBUG_STATE struct __darwin_arm_debug_state +_STRUCT_ARM_DEBUG_STATE +{ + __uint32_t __bvr[16]; + __uint32_t __bcr[16]; + __uint32_t __wvr[16]; + __uint32_t __wcr[16]; +}; +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_DEBUG_STATE struct arm_debug_state +_STRUCT_ARM_DEBUG_STATE +{ + __uint32_t bvr[16]; + __uint32_t bcr[16]; + __uint32_t wvr[16]; + __uint32_t wcr[16]; +}; +#endif /* __DARWIN_UNIX03 */ + +#elif defined(__arm64__) + +/* ARM's arm_debug_state is ARM64's arm_legacy_debug_state */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct __arm_legacy_debug_state +_STRUCT_ARM_LEGACY_DEBUG_STATE +{ + __uint32_t __bvr[16]; + __uint32_t __bcr[16]; + __uint32_t __wvr[16]; + __uint32_t __wcr[16]; +}; +#else /* __DARWIN_UNIX03 */ +#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state +_STRUCT_ARM_LEGACY_DEBUG_STATE +{ + __uint32_t bvr[16]; + __uint32_t bcr[16]; + __uint32_t wvr[16]; + __uint32_t wcr[16]; +}; +#endif /* __DARWIN_UNIX03 */ +#else +#error unknown architecture +#endif + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_DEBUG_STATE32 struct __darwin_arm_debug_state32 +_STRUCT_ARM_DEBUG_STATE32 +{ + __uint32_t __bvr[16]; + __uint32_t __bcr[16]; + __uint32_t __wvr[16]; + __uint32_t __wcr[16]; + __uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */ +}; + +#define _STRUCT_ARM_DEBUG_STATE64 struct __darwin_arm_debug_state64 +_STRUCT_ARM_DEBUG_STATE64 +{ + __uint64_t __bvr[16]; + __uint64_t __bcr[16]; + __uint64_t __wvr[16]; + __uint64_t __wcr[16]; + __uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */ +}; +#else /* !__DARWIN_UNIX03 */ +#define _STRUCT_ARM_DEBUG_STATE32 struct arm_debug_state32 +_STRUCT_ARM_DEBUG_STATE32 +{ + __uint32_t bvr[16]; + __uint32_t bcr[16]; + __uint32_t wvr[16]; + __uint32_t wcr[16]; + __uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */ +}; + +#define _STRUCT_ARM_DEBUG_STATE64 struct arm_debug_state64 +_STRUCT_ARM_DEBUG_STATE64 +{ + __uint64_t bvr[16]; + __uint64_t bcr[16]; + __uint64_t wvr[16]; + __uint64_t wcr[16]; + __uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */ +}; +#endif /* __DARWIN_UNIX03 */ + +#if __DARWIN_UNIX03 +#define _STRUCT_ARM_CPMU_STATE64 struct __darwin_arm_cpmu_state64 +_STRUCT_ARM_CPMU_STATE64 +{ + __uint64_t __ctrs[16]; +}; +#else /* __DARWIN_UNIX03 */ +#define _STRUCT_ARM_CPMU_STATE64 struct arm_cpmu_state64 +_STRUCT_ARM_CPMU_STATE64 +{ + __uint64_t ctrs[16]; +}; +#endif /* !__DARWIN_UNIX03 */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM__STRUCTS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/vm_param.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/boolean.h similarity index 85% rename from lib/libc/include/x86_64-macos.10-none/mach/vm_param.h rename to lib/libc/include/aarch64-macos.13-none/mach/arm/boolean.h index f2ebe0a3ec..9cdf7c237e 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/vm_param.h +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/boolean.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -30,7 +30,7 @@ */ /* * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University + * Copyright (c) 1991,1990,1989 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its @@ -55,19 +55,20 @@ */ /* */ + /* - * File: mach/vm_param.h - * Author: Avadis Tevanian, Jr., Michael Wayne Young - * Date: 1985 - * - * Machine independent virtual memory parameters. + * File: boolean.h * + * Boolean type, for ARM. */ -#ifndef _MACH_VM_PARAM_H_ -#define _MACH_VM_PARAM_H_ +#ifndef _MACH_ARM_BOOLEAN_H_ +#define _MACH_ARM_BOOLEAN_H_ -#include +#if defined (__arm__) || defined (__arm64__) +typedef int boolean_t; -#endif /* _MACH_VM_PARAM_H_ */ \ No newline at end of file +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_BOOLEAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/mach/arm/exception.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/exception.h new file mode 100644 index 0000000000..c27dec1b56 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/exception.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2007 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +#ifndef _MACH_ARM_EXCEPTION_H_ +#define _MACH_ARM_EXCEPTION_H_ + +#if defined (__arm__) || defined (__arm64__) + +#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ + +#define EXC_MASK_MACHINE 0 + +#define EXCEPTION_CODE_MAX 2 /* code and subcode */ + + +/* + * Trap numbers as defined by the hardware exception vectors. + */ + +/* + * EXC_BAD_INSTRUCTION + */ + +#define EXC_ARM_UNDEFINED 1 /* Undefined */ + +/* + * EXC_ARITHMETIC + */ + +#define EXC_ARM_FP_UNDEFINED 0 /* Undefined Floating Point Exception */ +#define EXC_ARM_FP_IO 1 /* Invalid Floating Point Operation */ +#define EXC_ARM_FP_DZ 2 /* Floating Point Divide by Zero */ +#define EXC_ARM_FP_OF 3 /* Floating Point Overflow */ +#define EXC_ARM_FP_UF 4 /* Floating Point Underflow */ +#define EXC_ARM_FP_IX 5 /* Inexact Floating Point Result */ +#define EXC_ARM_FP_ID 6 /* Floating Point Denormal Input */ + +/* + * EXC_BAD_ACCESS + * Note: do not conflict with kern_return_t values returned by vm_fault + */ + +#define EXC_ARM_DA_ALIGN 0x101 /* Alignment Fault */ +#define EXC_ARM_DA_DEBUG 0x102 /* Debug (watch/break) Fault */ +#define EXC_ARM_SP_ALIGN 0x103 /* SP Alignment Fault */ +#define EXC_ARM_SWP 0x104 /* SWP instruction */ +#define EXC_ARM_PAC_FAIL 0x105 /* PAC authentication failure */ + +/* + * EXC_BREAKPOINT + */ + +#define EXC_ARM_BREAKPOINT 1 /* breakpoint trap */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_EXCEPTION_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/thread_special_ports.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/kern_return.h similarity index 72% rename from lib/libc/include/x86_64-macos.10-none/mach/thread_special_ports.h rename to lib/libc/include/aarch64-macos.13-none/mach/arm/kern_return.h index f777e0060c..bfa07951b3 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/thread_special_ports.h +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/kern_return.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -30,7 +30,7 @@ */ /* * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University + * Copyright (c) 1991,1990,1989 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its @@ -55,29 +55,24 @@ */ /* */ -/* - * File: mach/thread_special_ports.h - * - * Defines codes for special_purpose thread ports. These are NOT - * port identifiers - they are only used for the thread_get_special_port - * and thread_set_special_port routines. - * - */ - -#ifndef _MACH_THREAD_SPECIAL_PORTS_H_ -#define _MACH_THREAD_SPECIAL_PORTS_H_ - -#define THREAD_KERNEL_PORT 1 /* Represents the thread to the outside - * world.*/ /* - * Definitions for ease of use + * File: kern_return.h + * Author: Avadis Tevanian, Jr., Michael Wayne Young + * Date: 1985 + * + * Machine-dependent kernel return definitions. */ -#define thread_get_kernel_port(thread, port) \ - (thread_get_special_port((thread), THREAD_KERNEL_PORT, (port))) +#ifndef _MACH_ARM_KERN_RETURN_H_ +#define _MACH_ARM_KERN_RETURN_H_ -#define thread_set_kernel_port(thread, port) \ - (thread_set_special_port((thread), THREAD_KERNEL_PORT, (port))) +#if defined (__arm__) || defined (__arm64__) -#endif /* _MACH_THREAD_SPECIAL_PORTS_H_ */ \ No newline at end of file +#ifndef ASSEMBLER +typedef int kern_return_t; +#endif /* ASSEMBLER */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_KERN_RETURN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/mach/arm/processor_info.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/processor_info.h new file mode 100644 index 0000000000..a302fbfcd3 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/processor_info.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2007-2018 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +#ifndef _MACH_ARM_PROCESSOR_INFO_H_ +#define _MACH_ARM_PROCESSOR_INFO_H_ + +#if defined (__arm__) || defined (__arm64__) + +#define PROCESSOR_CPU_STAT 0x10000003 /* Low-level CPU statistics */ +#define PROCESSOR_CPU_STAT64 0x10000004 /* Low-level CPU statistics, in full 64-bit */ + +#include /* uint32_t, uint64_t */ + +struct processor_cpu_stat { + uint32_t irq_ex_cnt; + uint32_t ipi_cnt; + uint32_t timer_cnt; + uint32_t undef_ex_cnt; + uint32_t unaligned_cnt; + uint32_t vfp_cnt; + uint32_t vfp_shortv_cnt; + uint32_t data_ex_cnt; + uint32_t instr_ex_cnt; +}; + +typedef struct processor_cpu_stat processor_cpu_stat_data_t; +typedef struct processor_cpu_stat *processor_cpu_stat_t; +#define PROCESSOR_CPU_STAT_COUNT ((mach_msg_type_number_t) \ + (sizeof(processor_cpu_stat_data_t) / sizeof(natural_t))) + +struct processor_cpu_stat64 { + uint64_t irq_ex_cnt; + uint64_t ipi_cnt; + uint64_t timer_cnt; + uint64_t undef_ex_cnt; + uint64_t unaligned_cnt; + uint64_t vfp_cnt; + uint64_t vfp_shortv_cnt; + uint64_t data_ex_cnt; + uint64_t instr_ex_cnt; + uint64_t pmi_cnt; +} __attribute__((packed, aligned(4))); + +typedef struct processor_cpu_stat64 processor_cpu_stat64_data_t; +typedef struct processor_cpu_stat64 *processor_cpu_stat64_t; +#define PROCESSOR_CPU_STAT64_COUNT ((mach_msg_type_number_t) \ + (sizeof(processor_cpu_stat64_data_t) / sizeof(integer_t))) + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_PROCESSOR_INFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/rpc.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/rpc.h similarity index 86% rename from lib/libc/include/x86_64-macos.10-none/mach/machine/rpc.h rename to lib/libc/include/aarch64-macos.13-none/mach/arm/rpc.h index 7d6ccee5f8..cb100ece01 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/rpc.h +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/rpc.h @@ -25,14 +25,15 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +/* + * @OSF_COPYRIGHT@ + */ -#ifndef _MACH_MACHINE_RPC_H_ -#define _MACH_MACHINE_RPC_H_ +#ifndef _MACH_ARM_RPC_H_ +#define _MACH_ARM_RPC_H_ -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/rpc.h" -#else -#error architecture not supported -#endif +#if defined (__arm__) || defined (__arm64__) -#endif /* _MACH_MACHINE_RPC_H_ */ \ No newline at end of file +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_RPC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/types.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/thread_state.h similarity index 78% rename from lib/libc/include/x86_64-macos.10-none/machine/types.h rename to lib/libc/include/aarch64-macos.13-none/mach/arm/thread_state.h index 5d1a1e575f..d72a3c2013 100644 --- a/lib/libc/include/x86_64-macos.10-none/machine/types.h +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/thread_state.h @@ -26,15 +26,17 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* - * Copyright 1995 NeXT Computer, Inc. All rights reserved. + * @OSF_COPYRIGHT@ */ -#ifndef _BSD_MACHINE_TYPES_H_ -#define _BSD_MACHINE_TYPES_H_ -#if defined (__i386__) || defined(__x86_64__) -#include "i386/types.h" -#else -#error architecture not supported -#endif +#ifndef _MACH_ARM_THREAD_STATE_H_ +#define _MACH_ARM_THREAD_STATE_H_ -#endif /* _BSD_MACHINE_TYPES_H_ */ \ No newline at end of file +#if defined (__arm__) || defined (__arm64__) + +/* Size of maximum exported thread state in words */ +#define ARM_THREAD_STATE_MAX (1296) /* Size of biggest state possible */ + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_THREAD_STATE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/mach/arm/thread_status.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/thread_status.h new file mode 100644 index 0000000000..f270b61fc6 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/thread_status.h @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2007 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * FILE_ID: thread_status.h + */ + + +#ifndef _ARM_THREAD_STATUS_H_ +#define _ARM_THREAD_STATUS_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include +#include +#include +#include + + +/* + * Support for determining the state of a thread + */ + + +/* + * Flavors + */ + +#define ARM_THREAD_STATE 1 +#define ARM_UNIFIED_THREAD_STATE ARM_THREAD_STATE +#define ARM_VFP_STATE 2 +#define ARM_EXCEPTION_STATE 3 +#define ARM_DEBUG_STATE 4 /* pre-armv8 */ +#define THREAD_STATE_NONE 5 +#define ARM_THREAD_STATE64 6 +#define ARM_EXCEPTION_STATE64 7 +// ARM_THREAD_STATE_LAST 8 /* legacy */ +#define ARM_THREAD_STATE32 9 + + +/* API */ +#define ARM_DEBUG_STATE32 14 +#define ARM_DEBUG_STATE64 15 +#define ARM_NEON_STATE 16 +#define ARM_NEON_STATE64 17 +#define ARM_CPMU_STATE64 18 + + +#define ARM_PAGEIN_STATE 27 + +#ifndef ARM_STATE_FLAVOR_IS_OTHER_VALID +#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0 +#endif + +#define VALID_THREAD_STATE_FLAVOR(x) \ + ((x == ARM_THREAD_STATE) || \ + (x == ARM_VFP_STATE) || \ + (x == ARM_EXCEPTION_STATE) || \ + (x == ARM_DEBUG_STATE) || \ + (x == THREAD_STATE_NONE) || \ + (x == ARM_THREAD_STATE32) || \ + (x == ARM_THREAD_STATE64) || \ + (x == ARM_EXCEPTION_STATE64) || \ + (x == ARM_NEON_STATE) || \ + (x == ARM_NEON_STATE64) || \ + (x == ARM_DEBUG_STATE32) || \ + (x == ARM_DEBUG_STATE64) || \ + (x == ARM_PAGEIN_STATE) || \ + (ARM_STATE_FLAVOR_IS_OTHER_VALID(x))) + +struct arm_state_hdr { + uint32_t flavor; + uint32_t count; +}; +typedef struct arm_state_hdr arm_state_hdr_t; + +typedef _STRUCT_ARM_THREAD_STATE arm_thread_state_t; +typedef _STRUCT_ARM_THREAD_STATE arm_thread_state32_t; +typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t; + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) + +/* Accessor macros for arm_thread_state64_t pointer fields */ + +/* Return pc field of arm_thread_state64_t as a data pointer value */ +#define arm_thread_state64_get_pc(ts) \ + __darwin_arm_thread_state64_get_pc(ts) +/* Return pc field of arm_thread_state64_t as a function pointer. May return + * NULL if a valid function pointer cannot be constructed, the caller should + * fall back to the arm_thread_state64_get_pc() macro in that case. */ +#define arm_thread_state64_get_pc_fptr(ts) \ + __darwin_arm_thread_state64_get_pc_fptr(ts) +/* Set pc field of arm_thread_state64_t to a function pointer */ +#define arm_thread_state64_set_pc_fptr(ts, fptr) \ + __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) +/* Return lr field of arm_thread_state64_t as a data pointer value */ +#define arm_thread_state64_get_lr(ts) \ + __darwin_arm_thread_state64_get_lr(ts) +/* Return lr field of arm_thread_state64_t as a function pointer. May return + * NULL if a valid function pointer cannot be constructed, the caller should + * fall back to the arm_thread_state64_get_lr() macro in that case. */ +#define arm_thread_state64_get_lr_fptr(ts) \ + __darwin_arm_thread_state64_get_lr_fptr(ts) +/* Set lr field of arm_thread_state64_t to a function pointer */ +#define arm_thread_state64_set_lr_fptr(ts, fptr) \ + __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) +/* Return sp field of arm_thread_state64_t as a data pointer value */ +#define arm_thread_state64_get_sp(ts) \ + __darwin_arm_thread_state64_get_sp(ts) +/* Set sp field of arm_thread_state64_t to a data pointer value */ +#define arm_thread_state64_set_sp(ts, ptr) \ + __darwin_arm_thread_state64_set_sp(ts, ptr) +/* Return fp field of arm_thread_state64_t as a data pointer value */ +#define arm_thread_state64_get_fp(ts) \ + __darwin_arm_thread_state64_get_fp(ts) +/* Set fp field of arm_thread_state64_t to a data pointer value */ +#define arm_thread_state64_set_fp(ts, ptr) \ + __darwin_arm_thread_state64_set_fp(ts, ptr) +/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */ +#define arm_thread_state64_ptrauth_strip(ts) \ + __darwin_arm_thread_state64_ptrauth_strip(ts) + +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */ + +struct arm_unified_thread_state { + arm_state_hdr_t ash; + union { + arm_thread_state32_t ts_32; + arm_thread_state64_t ts_64; + } uts; +}; +#define ts_32 uts.ts_32 +#define ts_64 uts.ts_64 +typedef struct arm_unified_thread_state arm_unified_thread_state_t; + +#define ARM_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_thread_state_t)/sizeof(uint32_t))) +#define ARM_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_thread_state32_t)/sizeof(uint32_t))) +#define ARM_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_thread_state64_t)/sizeof(uint32_t))) +#define ARM_UNIFIED_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_unified_thread_state_t)/sizeof(uint32_t))) + + +typedef _STRUCT_ARM_VFP_STATE arm_vfp_state_t; +typedef _STRUCT_ARM_NEON_STATE arm_neon_state_t; +typedef _STRUCT_ARM_NEON_STATE arm_neon_state32_t; +typedef _STRUCT_ARM_NEON_STATE64 arm_neon_state64_t; + + +typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state_t; +typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state32_t; +typedef _STRUCT_ARM_EXCEPTION_STATE64 arm_exception_state64_t; + +typedef _STRUCT_ARM_DEBUG_STATE32 arm_debug_state32_t; +typedef _STRUCT_ARM_DEBUG_STATE64 arm_debug_state64_t; + +typedef _STRUCT_ARM_PAGEIN_STATE arm_pagein_state_t; + +/* + * Otherwise not ARM64 kernel and we must preserve legacy ARM definitions of + * arm_debug_state for binary compatability of userland consumers of this file. + */ +#if defined(__arm__) +typedef _STRUCT_ARM_DEBUG_STATE arm_debug_state_t; +#elif defined(__arm64__) +typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_debug_state_t; +#else /* defined(__arm__) */ +#error Undefined architecture +#endif /* defined(__arm__) */ + +#define ARM_VFP_STATE_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_vfp_state_t)/sizeof(uint32_t))) + +#define ARM_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_exception_state_t)/sizeof(uint32_t))) + +#define ARM_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_exception_state64_t)/sizeof(uint32_t))) + +#define ARM_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_debug_state_t)/sizeof(uint32_t))) + +#define ARM_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_debug_state32_t)/sizeof(uint32_t))) + +#define ARM_PAGEIN_STATE_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_pagein_state_t)/sizeof(uint32_t))) + +#define ARM_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_debug_state64_t)/sizeof(uint32_t))) + +#define ARM_NEON_STATE_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_neon_state_t)/sizeof(uint32_t))) + +#define ARM_NEON_STATE64_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_neon_state64_t)/sizeof(uint32_t))) + +#define MACHINE_THREAD_STATE ARM_THREAD_STATE +#define MACHINE_THREAD_STATE_COUNT ARM_UNIFIED_THREAD_STATE_COUNT + + +/* + * Largest state on this machine: + */ +#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX + + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _ARM_THREAD_STATUS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/mach/arm/vm_param.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/vm_param.h new file mode 100644 index 0000000000..6915e15f85 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/vm_param.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2007 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * FILE_ID: vm_param.h + */ + +/* + * ARM machine dependent virtual memory parameters. + */ + +#ifndef _MACH_ARM_VM_PARAM_H_ +#define _MACH_ARM_VM_PARAM_H_ + +#if defined (__arm__) || defined (__arm64__) + + + +#if !defined (KERNEL) && !defined (__ASSEMBLER__) +#include +#endif + +#define BYTE_SIZE 8 /* byte size in bits */ + + +#define PAGE_SHIFT vm_page_shift +#define PAGE_SIZE vm_page_size +#define PAGE_MASK vm_page_mask + +#define VM_PAGE_SIZE vm_page_size + +#define machine_ptob(x) ((x) << PAGE_SHIFT) + + +#define PAGE_MAX_SHIFT 14 +#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT) +#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1) + +#define PAGE_MIN_SHIFT 12 +#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT) +#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1) + +#define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS + +#ifndef __ASSEMBLER__ + + +#if defined (__arm__) + +#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000) +#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000) + +/* system-wide values */ +#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0) +#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS) + +#elif defined (__arm64__) + +#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL) +#define VM_MAX_ADDRESS ((vm_address_t) 0x00000000F0000000ULL) + +/* system-wide values */ +#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL +#define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL + +#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW) +#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW) + +#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW 0x0000001000000000ULL +#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW 0x0000007000000000ULL +#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW) +#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW) + +#else /* defined(__arm64__) */ +#error architecture not supported +#endif + +#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS +#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS + + +#endif /* !__ASSEMBLER__ */ + +#define SWI_SYSCALL 0x80 + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_VM_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/aarch64-macos.13-none/mach/arm/vm_types.h b/lib/libc/include/aarch64-macos.13-none/mach/arm/vm_types.h new file mode 100644 index 0000000000..396923d4c2 --- /dev/null +++ b/lib/libc/include/aarch64-macos.13-none/mach/arm/vm_types.h @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * @OSF_COPYRIGHT@ + */ +/* + * Mach Operating System + * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + */ + +/* + * File: vm_types.h + * Author: Avadis Tevanian, Jr. + * Date: 1985 + * + * Header file for VM data types. ARM version. + */ + +#ifndef _MACH_ARM_VM_TYPES_H_ +#define _MACH_ARM_VM_TYPES_H_ + +#if defined (__arm__) || defined (__arm64__) + +#ifndef ASSEMBLER + +#include +#include +#include +#include + +/* + * natural_t and integer_t are Mach's legacy types for machine- + * independent integer types (unsigned, and signed, respectively). + * Their original purpose was to define other types in a machine/ + * compiler independent way. + * + * They also had an implicit "same size as pointer" characteristic + * to them (i.e. Mach's traditional types are very ILP32 or ILP64 + * centric). We will likely support x86 ABIs that do not follow + * either ofthese models (specifically LP64). Therefore, we had to + * make a choice between making these types scale with pointers or stay + * tied to integers. Because their use is predominantly tied to + * to the size of an integer, we are keeping that association and + * breaking free from pointer size guarantees. + * + * New use of these types is discouraged. + */ +typedef __darwin_natural_t natural_t; +typedef int integer_t; + +/* + * A vm_offset_t is a type-neutral pointer, + * e.g. an offset into a virtual memory space. + */ +#ifdef __LP64__ +typedef uintptr_t vm_offset_t __kernel_ptr_semantics; +typedef uintptr_t vm_size_t; + +typedef uint64_t mach_vm_address_t __kernel_ptr_semantics; +typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics; +typedef uint64_t mach_vm_size_t; + +typedef uint64_t vm_map_offset_t __kernel_ptr_semantics; +typedef uint64_t vm_map_address_t __kernel_ptr_semantics; +typedef uint64_t vm_map_size_t; +#else +typedef natural_t vm_offset_t __kernel_ptr_semantics; +/* + * A vm_size_t is the proper type for e.g. + * expressing the difference between two + * vm_offset_t entities. + */ +typedef natural_t vm_size_t; + +/* + * This new type is independent of a particular vm map's + * implementation size - and represents appropriate types + * for all possible maps. This is used for interfaces + * where the size of the map is not known - or we don't + * want to have to distinguish. + */ +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0) +typedef uint32_t mach_vm_address_t; +typedef uint32_t mach_vm_offset_t; +typedef uint32_t mach_vm_size_t; +#else +typedef uint64_t mach_vm_address_t __kernel_ptr_semantics; +typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics; +typedef uint64_t mach_vm_size_t; +#endif + +typedef uint32_t vm_map_offset_t __kernel_ptr_semantics; +typedef uint32_t vm_map_address_t __kernel_ptr_semantics; +typedef uint32_t vm_map_size_t; +#endif /* __LP64__ */ + + +typedef uint32_t vm32_offset_t; +typedef uint32_t vm32_address_t; +typedef uint32_t vm32_size_t; + +typedef vm_offset_t mach_port_context_t; + + +#endif /* ASSEMBLER */ + +/* + * If composing messages by hand (please do not) + */ +#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32 + +#endif /* defined (__arm__) || defined (__arm64__) */ + +#endif /* _MACH_ARM_VM_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.12-any/TargetConditionals.h b/lib/libc/include/any-macos-any/TargetConditionals.h similarity index 100% rename from lib/libc/include/any-macos.12-any/TargetConditionals.h rename to lib/libc/include/any-macos-any/TargetConditionals.h diff --git a/lib/libc/include/any-macos.12-any/mach/mach_init.h b/lib/libc/include/any-macos-any/mach/mach_init.h similarity index 100% rename from lib/libc/include/any-macos.12-any/mach/mach_init.h rename to lib/libc/include/any-macos-any/mach/mach_init.h diff --git a/lib/libc/include/any-macos.12-any/mach/task_info.h b/lib/libc/include/any-macos-any/mach/task_info.h similarity index 100% rename from lib/libc/include/any-macos.12-any/mach/task_info.h rename to lib/libc/include/any-macos-any/mach/task_info.h diff --git a/lib/libc/include/any-macos.12-any/spawn.h b/lib/libc/include/any-macos-any/spawn.h similarity index 100% rename from lib/libc/include/any-macos.12-any/spawn.h rename to lib/libc/include/any-macos-any/spawn.h diff --git a/lib/libc/include/any-macos.12-any/sys/attr.h b/lib/libc/include/any-macos-any/sys/attr.h similarity index 100% rename from lib/libc/include/any-macos.12-any/sys/attr.h rename to lib/libc/include/any-macos-any/sys/attr.h diff --git a/lib/libc/include/any-macos-any/sys/stdio.h b/lib/libc/include/any-macos-any/sys/stdio.h index c51c1b9c7d..da56fdf6c9 100644 --- a/lib/libc/include/any-macos-any/sys/stdio.h +++ b/lib/libc/include/any-macos-any/sys/stdio.h @@ -31,6 +31,14 @@ #include +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define RENAME_SECLUDE 0x00000001 +#define RENAME_SWAP 0x00000002 +#define RENAME_EXCL 0x00000004 +#define RENAME_RESERVED1 0x00000008 +#define RENAME_NOFOLLOW_ANY 0x00000010 +#endif + #if __DARWIN_C_LEVEL >= 200809L #include @@ -40,9 +48,6 @@ int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING( #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define RENAME_SECLUDE 0x00000001 -#define RENAME_SWAP 0x00000002 -#define RENAME_EXCL 0x00000004 int renamex_np(const char *, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int renameatx_np(int, const char *, int, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); diff --git a/lib/libc/include/any-macos.12-any/time.h b/lib/libc/include/any-macos-any/time.h similarity index 100% rename from lib/libc/include/any-macos.12-any/time.h rename to lib/libc/include/any-macos-any/time.h diff --git a/lib/libc/include/any-macos-any/copyfile.h b/lib/libc/include/any-macos.11-any/copyfile.h similarity index 100% rename from lib/libc/include/any-macos-any/copyfile.h rename to lib/libc/include/any-macos.11-any/copyfile.h diff --git a/lib/libc/include/any-macos.12-any/sys/stdio.h b/lib/libc/include/any-macos.11-any/sys/stdio.h similarity index 91% rename from lib/libc/include/any-macos.12-any/sys/stdio.h rename to lib/libc/include/any-macos.11-any/sys/stdio.h index da56fdf6c9..c51c1b9c7d 100644 --- a/lib/libc/include/any-macos.12-any/sys/stdio.h +++ b/lib/libc/include/any-macos.11-any/sys/stdio.h @@ -31,14 +31,6 @@ #include -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define RENAME_SECLUDE 0x00000001 -#define RENAME_SWAP 0x00000002 -#define RENAME_EXCL 0x00000004 -#define RENAME_RESERVED1 0x00000008 -#define RENAME_NOFOLLOW_ANY 0x00000010 -#endif - #if __DARWIN_C_LEVEL >= 200809L #include @@ -48,6 +40,9 @@ int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING( #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define RENAME_SECLUDE 0x00000001 +#define RENAME_SWAP 0x00000002 +#define RENAME_EXCL 0x00000004 int renamex_np(const char *, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); int renameatx_np(int, const char *, int, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); diff --git a/lib/libc/include/any-macos-any/sys/unistd.h b/lib/libc/include/any-macos.11-any/sys/unistd.h similarity index 100% rename from lib/libc/include/any-macos-any/sys/unistd.h rename to lib/libc/include/any-macos.11-any/sys/unistd.h diff --git a/lib/libc/include/x86_64-macos.10-none/Availability.h b/lib/libc/include/any-macos.13-any/Availability.h similarity index 77% rename from lib/libc/include/x86_64-macos.10-none/Availability.h rename to lib/libc/include/any-macos.13-any/Availability.h index bdfd794d89..2780aa571f 100644 --- a/lib/libc/include/x86_64-macos.10-none/Availability.h +++ b/lib/libc/include/any-macos.13-any/Availability.h @@ -132,130 +132,37 @@ #define __API_TO_BE_DEPRECATED 100000 #endif -#ifndef __MAC_10_0 -#define __MAC_10_0 1000 -#define __MAC_10_1 1010 -#define __MAC_10_2 1020 -#define __MAC_10_3 1030 -#define __MAC_10_4 1040 -#define __MAC_10_5 1050 -#define __MAC_10_6 1060 -#define __MAC_10_7 1070 -#define __MAC_10_8 1080 -#define __MAC_10_9 1090 -#define __MAC_10_10 101000 -#define __MAC_10_10_2 101002 -#define __MAC_10_10_3 101003 -#define __MAC_10_11 101100 -#define __MAC_10_11_2 101102 -#define __MAC_10_11_3 101103 -#define __MAC_10_11_4 101104 -#define __MAC_10_12 101200 -#define __MAC_10_12_1 101201 -#define __MAC_10_12_2 101202 -#define __MAC_10_12_4 101204 -#define __MAC_10_13 101300 -#define __MAC_10_13_1 101301 -#define __MAC_10_13_2 101302 -#define __MAC_10_13_4 101304 -#define __MAC_10_14 101400 -#define __MAC_10_14_1 101401 -#define __MAC_10_14_4 101404 -#define __MAC_10_15 101500 -#define __MAC_10_15_1 101501 -#define __MAC_10_15_4 101504 -/* __MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */ +#ifndef __API_TO_BE_DEPRECATED_MACOS +#define __API_TO_BE_DEPRECATED_MACOS 100000 +#endif -#define __IPHONE_2_0 20000 -#define __IPHONE_2_1 20100 -#define __IPHONE_2_2 20200 -#define __IPHONE_3_0 30000 -#define __IPHONE_3_1 30100 -#define __IPHONE_3_2 30200 -#define __IPHONE_4_0 40000 -#define __IPHONE_4_1 40100 -#define __IPHONE_4_2 40200 -#define __IPHONE_4_3 40300 -#define __IPHONE_5_0 50000 -#define __IPHONE_5_1 50100 -#define __IPHONE_6_0 60000 -#define __IPHONE_6_1 60100 -#define __IPHONE_7_0 70000 -#define __IPHONE_7_1 70100 -#define __IPHONE_8_0 80000 -#define __IPHONE_8_1 80100 -#define __IPHONE_8_2 80200 -#define __IPHONE_8_3 80300 -#define __IPHONE_8_4 80400 -#define __IPHONE_9_0 90000 -#define __IPHONE_9_1 90100 -#define __IPHONE_9_2 90200 -#define __IPHONE_9_3 90300 -#define __IPHONE_10_0 100000 -#define __IPHONE_10_1 100100 -#define __IPHONE_10_2 100200 -#define __IPHONE_10_3 100300 -#define __IPHONE_11_0 110000 -#define __IPHONE_11_1 110100 -#define __IPHONE_11_2 110200 -#define __IPHONE_11_3 110300 -#define __IPHONE_11_4 110400 -#define __IPHONE_12_0 120000 -#define __IPHONE_12_1 120100 -#define __IPHONE_12_2 120200 -#define __IPHONE_12_3 120300 -#define __IPHONE_13_0 130000 -#define __IPHONE_13_1 130100 -#define __IPHONE_13_2 130200 -#define __IPHONE_13_3 130300 -#define __IPHONE_13_4 130400 -#define __IPHONE_13_5 130500 -#define __IPHONE_13_6 130600 -/* __IPHONE_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */ +#ifndef __API_TO_BE_DEPRECATED_IOS +#define __API_TO_BE_DEPRECATED_IOS 100000 +#endif -#define __TVOS_9_0 90000 -#define __TVOS_9_1 90100 -#define __TVOS_9_2 90200 -#define __TVOS_10_0 100000 -#define __TVOS_10_0_1 100001 -#define __TVOS_10_1 100100 -#define __TVOS_10_2 100200 -#define __TVOS_11_0 110000 -#define __TVOS_11_1 110100 -#define __TVOS_11_2 110200 -#define __TVOS_11_3 110300 -#define __TVOS_11_4 110400 -#define __TVOS_12_0 120000 -#define __TVOS_12_1 120100 -#define __TVOS_12_2 120200 -#define __TVOS_12_3 120300 -#define __TVOS_13_0 130000 -#define __TVOS_13_2 130200 -#define __TVOS_13_3 130300 -#define __TVOS_13_4 130400 +#ifndef __API_TO_BE_DEPRECATED_TVOS +#define __API_TO_BE_DEPRECATED_TVOS 100000 +#endif -#define __WATCHOS_1_0 10000 -#define __WATCHOS_2_0 20000 -#define __WATCHOS_2_1 20100 -#define __WATCHOS_2_2 20200 -#define __WATCHOS_3_0 30000 -#define __WATCHOS_3_1 30100 -#define __WATCHOS_3_1_1 30101 -#define __WATCHOS_3_2 30200 -#define __WATCHOS_4_0 40000 -#define __WATCHOS_4_1 40100 -#define __WATCHOS_4_2 40200 -#define __WATCHOS_4_3 40300 -#define __WATCHOS_5_0 50000 -#define __WATCHOS_5_1 50100 -#define __WATCHOS_5_2 50200 -#define __WATCHOS_6_0 60000 -#define __WATCHOS_6_1 60100 -#define __WATCHOS_6_2 60200 +#ifndef __API_TO_BE_DEPRECATED_WATCHOS +#define __API_TO_BE_DEPRECATED_WATCHOS 100000 +#endif -#define __DRIVERKIT_19_0 190000 -#endif /* __MAC_10_0 */ +#ifndef __API_TO_BE_DEPRECATED_BRIDGEOS +#endif + +#ifndef __API_TO_BE_DEPRECATED_MACCATALYST +#define __API_TO_BE_DEPRECATED_MACCATALYST 100000 +#endif + +#ifndef __API_TO_BE_DEPRECATED_DRIVERKIT +#define __API_TO_BE_DEPRECATED_DRIVERKIT 100000 +#endif + + + +#include #include #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED @@ -454,6 +361,8 @@ #endif + + /* for use marking APIs unavailable for swift */ #if defined(__has_feature) #if __has_feature(attribute_availability_swift) @@ -501,9 +410,9 @@ * __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0)) * __API_AVAILABLE(driverkit(19.0)) */ - #define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__) + #define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE8, __API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__) - #define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__) + #define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN8, __API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__) #define __API_AVAILABLE_END _Pragma("clang attribute pop") /* @@ -522,13 +431,13 @@ * __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0)) * __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0)) */ - #define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__) - #define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__) + #define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG9, __API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__) + #define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP9,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__) - #define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__) + #define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG9, __API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__) #define __API_DEPRECATED_END _Pragma("clang attribute pop") - #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP9, __API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__) #define __API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop") /* @@ -539,9 +448,9 @@ * __API_UNAVAILABLE(macos) * __API_UNAVAILABLE(watchos, tvos) */ - #define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__) + #define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE8,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__) - #define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__) + #define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN8,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__) #define __API_UNAVAILABLE_END _Pragma("clang attribute pop") #else diff --git a/lib/libc/include/x86_64-macos.10-none/AvailabilityInternal.h b/lib/libc/include/any-macos.13-any/AvailabilityInternal.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/AvailabilityInternal.h rename to lib/libc/include/any-macos.13-any/AvailabilityInternal.h index 11e6d1ed17..4e1e72d8e8 100644 --- a/lib/libc/include/x86_64-macos.10-none/AvailabilityInternal.h +++ b/lib/libc/include/any-macos.13-any/AvailabilityInternal.h @@ -45,6 +45,9 @@ #ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ /* compiler sets __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ when -miphoneos-version-min is used */ #define __IPHONE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ + /* set to 1 when RC_FALLBACK_PLATFORM=iphoneos */ + #elif 0 + #define __IPHONE_OS_VERSION_MIN_REQUIRED 0 #endif #endif /* __IPHONE_OS_VERSION_MIN_REQUIRED */ @@ -52,7 +55,7 @@ #ifdef __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ /* compiler sets __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ when -mtvos-version-min is used */ #define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ - #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_13_0 + #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_16_1 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000 #endif @@ -62,7 +65,7 @@ #ifdef __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ /* compiler sets __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ when -mwatchos-version-min is used */ #define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ - #define __WATCH_OS_VERSION_MAX_ALLOWED 60000 + #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_9_1 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000 #endif @@ -72,7 +75,7 @@ #ifdef __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ #define __BRIDGE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ - #define __BRIDGE_OS_VERSION_MAX_ALLOWED 20000 + #define __BRIDGE_OS_VERSION_MAX_ALLOWED 70100 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED 110000 #endif @@ -87,14 +90,14 @@ #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED /* make sure a default max version is set */ #ifndef __MAC_OS_X_VERSION_MAX_ALLOWED - #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_15 + #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_13_0 #endif #endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */ #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED /* make sure a default max version is set */ #ifndef __IPHONE_OS_VERSION_MAX_ALLOWED - #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_13_0 + #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_16_1 #endif /* make sure a valid min is set */ #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0 @@ -2887,7 +2890,7 @@ #if __has_builtin(__is_target_environment) #if __has_builtin(__is_target_variant_os) #if __has_builtin(__is_target_variant_environment) - #if (__is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi)) + #if ((__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi)) #define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION __attribute__((availability(ios,introduced=4.0))) #define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION __attribute__((availability(ios,unavailable))) #define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION_MSG(_msg) __attribute__((availability(ios,unavailable))) @@ -4452,6 +4455,7 @@ #endif #define __API_AVAILABLE_PLATFORM_driverkit(x) driverkit,introduced=x + #if defined(__has_attribute) #if __has_attribute(availability) #define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x))) @@ -4469,7 +4473,8 @@ #define __API_AVAILABLE5(x,y,z,t,b) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) #define __API_AVAILABLE6(x,y,z,t,b,m) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m) #define __API_AVAILABLE7(x,y,z,t,b,m,d) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m) __API_A(d) - #define __API_AVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_AVAILABLE8(x,y,z,t,b,m,d,l) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m) __API_A(d) __API_A(l) + #define __API_AVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME #define __API_APPLY_TO any(record, enum, enum_constant, function, objc_method, objc_category, objc_protocol, objc_interface, objc_property, type_alias, variable, field) #define __API_RANGE_STRINGIFY(x) __API_RANGE_STRINGIFY2(x) @@ -4484,7 +4489,8 @@ #define __API_AVAILABLE_BEGIN5(a,b,c,d,e) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) #define __API_AVAILABLE_BEGIN6(a,b,c,d,e,f) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f) #define __API_AVAILABLE_BEGIN7(a,b,c,d,e,f,g) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f) __API_A_BEGIN(g) - #define __API_AVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_AVAILABLE_BEGIN8(a,b,c,d,e,f,g,h) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f) __API_A_BEGIN(g) __API_A_BEGIN(h) + #define __API_AVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME #define __API_DEPRECATED_PLATFORM_macos(x,y) macos,introduced=x,deprecated=y @@ -4500,6 +4506,7 @@ #endif #define __API_DEPRECATED_PLATFORM_driverkit(x,y) driverkit,introduced=x,deprecated=y + #if defined(__has_attribute) #if __has_attribute(availability) #define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg))) @@ -4517,7 +4524,8 @@ #define __API_DEPRECATED_MSG6(msg,x,y,z,t,b) __API_DEPRECATED_MSG5(msg,x,y,z,t) __API_D(msg,b) #define __API_DEPRECATED_MSG7(msg,x,y,z,t,b,m) __API_DEPRECATED_MSG6(msg,x,y,z,t,b) __API_D(msg,m) #define __API_DEPRECATED_MSG8(msg,x,y,z,t,b,m,d) __API_DEPRECATED_MSG7(msg,x,y,z,t,b,m) __API_D(msg,d) - #define __API_DEPRECATED_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_MSG9(msg,x,y,z,t,b,m,d,l) __API_DEPRECATED_MSG8(msg,x,y,z,t,b,m,d) __API_D(msg,l) + #define __API_DEPRECATED_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME #define __API_D_BEGIN(msg, x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg))), apply_to = __API_APPLY_TO))) @@ -4528,7 +4536,8 @@ #define __API_DEPRECATED_BEGIN_MSG6(msg,a,b,c,d,e) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) #define __API_DEPRECATED_BEGIN_MSG7(msg,a,b,c,d,e,f) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f) #define __API_DEPRECATED_BEGIN_MSG8(msg,a,b,c,d,e,f,g) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f) __API_D_BEGIN(msg,g) - #define __API_DEPRECATED_BEGIN_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_BEGIN_MSG9(msg,a,b,c,d,e,f,g,h) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f) __API_D_BEGIN(msg,g) __API_D_BEGIN(msg,h) + #define __API_DEPRECATED_BEGIN_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME #if __has_feature(attribute_availability_with_replacement) #define __API_R(rep,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,replacement=rep))) @@ -4543,7 +4552,8 @@ #define __API_DEPRECATED_REP6(rep,x,y,z,t,b) __API_DEPRECATED_REP5(rep,x,y,z,t) __API_R(rep,b) #define __API_DEPRECATED_REP7(rep,x,y,z,t,b,m) __API_DEPRECATED_REP6(rep,x,y,z,t,b) __API_R(rep,m) #define __API_DEPRECATED_REP8(rep,x,y,z,t,b,m,d) __API_DEPRECATED_REP7(rep,x,y,z,t,b,m) __API_R(rep,d) - #define __API_DEPRECATED_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_REP9(rep,x,y,z,t,b,m,d,l) __API_DEPRECATED_REP8(rep,x,y,z,t,b,m,d) __API_R(rep,l) + #define __API_DEPRECATED_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME #if __has_feature(attribute_availability_with_replacement) #define __API_R_BEGIN(rep,x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_DEPRECATED_PLATFORM_##x,replacement=rep))), apply_to = __API_APPLY_TO))) @@ -4558,7 +4568,9 @@ #define __API_DEPRECATED_BEGIN_REP6(rep,a,b,c,d,e) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) #define __API_DEPRECATED_BEGIN_REP7(rep,a,b,c,d,e,f) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f) #define __API_DEPRECATED_BEGIN_REP8(rep,a,b,c,d,e,f,g) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f) __API_R_BEGIN(rep,g) - #define __API_DEPRECATED_BEGIN_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_BEGIN_REP9(rep,a,b,c,d,e,f,g,h) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f) __API_R_BEGIN(rep,g) __API_R_BEGIN(rep,h) + + #define __API_DEPRECATED_BEGIN_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME /* * API Unavailability @@ -4581,6 +4593,7 @@ #endif #define __API_UNAVAILABLE_PLATFORM_driverkit driverkit,unavailable + #if defined(__has_attribute) #if __has_attribute(availability) #define __API_U(x) __attribute__((availability(__API_UNAVAILABLE_PLATFORM_##x))) @@ -4598,7 +4611,8 @@ #define __API_UNAVAILABLE5(x,y,z,t,b) __API_UNAVAILABLE4(x,y,z,t) __API_U(b) #define __API_UNAVAILABLE6(x,y,z,t,b,m) __API_UNAVAILABLE5(x,y,z,t,b) __API_U(m) #define __API_UNAVAILABLE7(x,y,z,t,b,m,d) __API_UNAVAILABLE6(x,y,z,t,b,m) __API_U(d) - #define __API_UNAVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_UNAVAILABLE8(x,y,z,t,b,m,d,l) __API_UNAVAILABLE7(x,y,z,t,b,m,d) __API_U(l) + #define __API_UNAVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME #define __API_U_BEGIN(x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_UNAVAILABLE_PLATFORM_##x))), apply_to = __API_APPLY_TO))) @@ -4608,8 +4622,9 @@ #define __API_UNAVAILABLE_BEGIN4(a,b,c,d) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) #define __API_UNAVAILABLE_BEGIN5(a,b,c,d,e) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) #define __API_UNAVAILABLE_BEGIN6(a,b,c,d,e,f) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) - #define __API_UNAVAILABLE_BEGIN7(a,b,c,d,e,f) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g) - #define __API_UNAVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_UNAVAILABLE_BEGIN7(a,b,c,d,e,f,g) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g) + #define __API_UNAVAILABLE_BEGIN8(a,b,c,d,e,f,g,h) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g) __API_U_BEGIN(h) + #define __API_UNAVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME #else /* @@ -4643,7 +4658,7 @@ /* * Swift compiler version - * Allows for project-agnostic “epochs” for frameworks imported into Swift via the Clang importer, like #if _compiler_version for Swift + * Allows for project-agnostic "epochs" for frameworks imported into Swift via the Clang importer, like #if _compiler_version for Swift * Example: * * #if __swift_compiler_version_at_least(800, 2, 20) diff --git a/lib/libc/include/x86_64-macos.10-none/AvailabilityMacros.h b/lib/libc/include/any-macos.13-any/AvailabilityMacros.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/AvailabilityMacros.h rename to lib/libc/include/any-macos.13-any/AvailabilityMacros.h index 9cc7100ffe..313d37c4cc 100644 --- a/lib/libc/include/x86_64-macos.10-none/AvailabilityMacros.h +++ b/lib/libc/include/any-macos.13-any/AvailabilityMacros.h @@ -117,9 +117,14 @@ #define MAC_OS_X_VERSION_10_14_1 101401 #define MAC_OS_X_VERSION_10_14_4 101404 #define MAC_OS_X_VERSION_10_15 101500 -#define MAC_OS_X_VERSION_10_15_1 101501 +#define MAC_OS_VERSION_11_0 110000 +#define MAC_OS_VERSION_11_1 110100 +#define MAC_OS_VERSION_11_3 110300 +#define MAC_OS_VERSION_12_0 120000 +#define MAC_OS_VERSION_13_0 130000 +#define MAC_OS_VERSION_13_1 130100 -/* +/* * If min OS not specified, assume 10.4 for intel * Note: compiler driver may set _ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED_ based on MACOSX_DEPLOYMENT_TARGET environment variable */ @@ -144,10 +149,10 @@ * if max OS not specified, assume larger of (10.15, min) */ #ifndef MAC_OS_X_VERSION_MAX_ALLOWED - #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_15 + #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_13_1 #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED #else - #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_15 + #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_13_1 #endif #endif diff --git a/lib/libc/include/any-macos.13-any/AvailabilityVersions.h b/lib/libc/include/any-macos.13-any/AvailabilityVersions.h new file mode 100644 index 0000000000..f889a84b18 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/AvailabilityVersions.h @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2019 by Apple Inc.. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef __AVAILABILITY_VERSIONS__ +#define __AVAILABILITY_VERSIONS__ + +#define __MAC_10_0 1000 +#define __MAC_10_1 1010 +#define __MAC_10_2 1020 +#define __MAC_10_3 1030 +#define __MAC_10_4 1040 +#define __MAC_10_5 1050 +#define __MAC_10_6 1060 +#define __MAC_10_7 1070 +#define __MAC_10_8 1080 +#define __MAC_10_9 1090 +#define __MAC_10_10 101000 +#define __MAC_10_10_2 101002 +#define __MAC_10_10_3 101003 +#define __MAC_10_11 101100 +#define __MAC_10_11_2 101102 +#define __MAC_10_11_3 101103 +#define __MAC_10_11_4 101104 +#define __MAC_10_12 101200 +#define __MAC_10_12_1 101201 +#define __MAC_10_12_2 101202 +#define __MAC_10_12_4 101204 +#define __MAC_10_13 101300 +#define __MAC_10_13_1 101301 +#define __MAC_10_13_2 101302 +#define __MAC_10_13_4 101304 +#define __MAC_10_14 101400 +#define __MAC_10_14_1 101401 +#define __MAC_10_14_4 101404 +#define __MAC_10_14_6 101406 +#define __MAC_10_15 101500 +#define __MAC_10_15_1 101501 +#define __MAC_10_15_4 101504 +#define __MAC_10_16 101600 +#define __MAC_11_0 110000 +#define __MAC_11_1 110100 +#define __MAC_11_3 110300 +#define __MAC_11_4 110400 +#define __MAC_11_5 110500 +#define __MAC_11_6 110600 +#define __MAC_12_0 120000 +#define __MAC_12_1 120100 +#define __MAC_12_2 120200 +#define __MAC_12_3 120300 +#define __MAC_13_0 130000 +/* __MAC_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ + +#define __IPHONE_2_0 20000 +#define __IPHONE_2_1 20100 +#define __IPHONE_2_2 20200 +#define __IPHONE_3_0 30000 +#define __IPHONE_3_1 30100 +#define __IPHONE_3_2 30200 +#define __IPHONE_4_0 40000 +#define __IPHONE_4_1 40100 +#define __IPHONE_4_2 40200 +#define __IPHONE_4_3 40300 +#define __IPHONE_5_0 50000 +#define __IPHONE_5_1 50100 +#define __IPHONE_6_0 60000 +#define __IPHONE_6_1 60100 +#define __IPHONE_7_0 70000 +#define __IPHONE_7_1 70100 +#define __IPHONE_8_0 80000 +#define __IPHONE_8_1 80100 +#define __IPHONE_8_2 80200 +#define __IPHONE_8_3 80300 +#define __IPHONE_8_4 80400 +#define __IPHONE_9_0 90000 +#define __IPHONE_9_1 90100 +#define __IPHONE_9_2 90200 +#define __IPHONE_9_3 90300 +#define __IPHONE_10_0 100000 +#define __IPHONE_10_1 100100 +#define __IPHONE_10_2 100200 +#define __IPHONE_10_3 100300 +#define __IPHONE_11_0 110000 +#define __IPHONE_11_1 110100 +#define __IPHONE_11_2 110200 +#define __IPHONE_11_3 110300 +#define __IPHONE_11_4 110400 +#define __IPHONE_12_0 120000 +#define __IPHONE_12_1 120100 +#define __IPHONE_12_2 120200 +#define __IPHONE_12_3 120300 +#define __IPHONE_12_4 120400 +#define __IPHONE_13_0 130000 +#define __IPHONE_13_1 130100 +#define __IPHONE_13_2 130200 +#define __IPHONE_13_3 130300 +#define __IPHONE_13_4 130400 +#define __IPHONE_13_5 130500 +#define __IPHONE_13_6 130600 +#define __IPHONE_13_7 130700 +#define __IPHONE_14_0 140000 +#define __IPHONE_14_1 140100 +#define __IPHONE_14_2 140200 +#define __IPHONE_14_3 140300 +#define __IPHONE_14_5 140500 +#define __IPHONE_14_6 140600 +#define __IPHONE_14_7 140700 +#define __IPHONE_14_8 140800 +#define __IPHONE_15_0 150000 +#define __IPHONE_15_1 150100 +#define __IPHONE_15_2 150200 +#define __IPHONE_15_3 150300 +#define __IPHONE_15_4 150400 +#define __IPHONE_16_0 160000 +#define __IPHONE_16_1 160100 +/* __IPHONE_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ + +#define __TVOS_9_0 90000 +#define __TVOS_9_1 90100 +#define __TVOS_9_2 90200 +#define __TVOS_10_0 100000 +#define __TVOS_10_0_1 100001 +#define __TVOS_10_1 100100 +#define __TVOS_10_2 100200 +#define __TVOS_11_0 110000 +#define __TVOS_11_1 110100 +#define __TVOS_11_2 110200 +#define __TVOS_11_3 110300 +#define __TVOS_11_4 110400 +#define __TVOS_12_0 120000 +#define __TVOS_12_1 120100 +#define __TVOS_12_2 120200 +#define __TVOS_12_3 120300 +#define __TVOS_12_4 120400 +#define __TVOS_13_0 130000 +#define __TVOS_13_2 130200 +#define __TVOS_13_3 130300 +#define __TVOS_13_4 130400 +#define __TVOS_14_0 140000 +#define __TVOS_14_1 140100 +#define __TVOS_14_2 140200 +#define __TVOS_14_3 140300 +#define __TVOS_14_5 140500 +#define __TVOS_14_6 140600 +#define __TVOS_14_7 140700 +#define __TVOS_15_0 150000 +#define __TVOS_15_1 150100 +#define __TVOS_15_2 150200 +#define __TVOS_15_3 150300 +#define __TVOS_15_4 150400 +#define __TVOS_16_0 160000 +#define __TVOS_16_1 160100 + +#define __WATCHOS_1_0 10000 +#define __WATCHOS_2_0 20000 +#define __WATCHOS_2_1 20100 +#define __WATCHOS_2_2 20200 +#define __WATCHOS_3_0 30000 +#define __WATCHOS_3_1 30100 +#define __WATCHOS_3_1_1 30101 +#define __WATCHOS_3_2 30200 +#define __WATCHOS_4_0 40000 +#define __WATCHOS_4_1 40100 +#define __WATCHOS_4_2 40200 +#define __WATCHOS_4_3 40300 +#define __WATCHOS_5_0 50000 +#define __WATCHOS_5_1 50100 +#define __WATCHOS_5_2 50200 +#define __WATCHOS_5_3 50300 +#define __WATCHOS_6_0 60000 +#define __WATCHOS_6_1 60100 +#define __WATCHOS_6_2 60200 +#define __WATCHOS_7_0 70000 +#define __WATCHOS_7_1 70100 +#define __WATCHOS_7_2 70200 +#define __WATCHOS_7_3 70300 +#define __WATCHOS_7_4 70400 +#define __WATCHOS_7_5 70500 +#define __WATCHOS_7_6 70600 +#define __WATCHOS_8_0 80000 +#define __WATCHOS_8_1 80100 +#define __WATCHOS_8_3 80300 +#define __WATCHOS_8_4 80400 +#define __WATCHOS_8_5 80500 +#define __WATCHOS_9_0 90000 +#define __WATCHOS_9_1 90100 + +/* + * Set up standard Mac OS X versions + */ + +#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) + +#define MAC_OS_X_VERSION_10_0 1000 +#define MAC_OS_X_VERSION_10_1 1010 +#define MAC_OS_X_VERSION_10_2 1020 +#define MAC_OS_X_VERSION_10_3 1030 +#define MAC_OS_X_VERSION_10_4 1040 +#define MAC_OS_X_VERSION_10_5 1050 +#define MAC_OS_X_VERSION_10_6 1060 +#define MAC_OS_X_VERSION_10_7 1070 +#define MAC_OS_X_VERSION_10_8 1080 +#define MAC_OS_X_VERSION_10_9 1090 +#define MAC_OS_X_VERSION_10_10 101000 +#define MAC_OS_X_VERSION_10_10_2 101002 +#define MAC_OS_X_VERSION_10_10_3 101003 +#define MAC_OS_X_VERSION_10_11 101100 +#define MAC_OS_X_VERSION_10_11_2 101102 +#define MAC_OS_X_VERSION_10_11_3 101103 +#define MAC_OS_X_VERSION_10_11_4 101104 +#define MAC_OS_X_VERSION_10_12 101200 +#define MAC_OS_X_VERSION_10_12_1 101201 +#define MAC_OS_X_VERSION_10_12_2 101202 +#define MAC_OS_X_VERSION_10_12_4 101204 +#define MAC_OS_X_VERSION_10_13 101300 +#define MAC_OS_X_VERSION_10_13_1 101301 +#define MAC_OS_X_VERSION_10_13_2 101302 +#define MAC_OS_X_VERSION_10_13_4 101304 +#define MAC_OS_X_VERSION_10_14 101400 +#define MAC_OS_X_VERSION_10_14_1 101401 +#define MAC_OS_X_VERSION_10_14_4 101404 +#define MAC_OS_X_VERSION_10_14_6 101406 +#define MAC_OS_X_VERSION_10_15 101500 +#define MAC_OS_X_VERSION_10_15_1 101501 +#define MAC_OS_X_VERSION_10_16 101600 +#define MAC_OS_VERSION_11_0 110000 +#define MAC_OS_VERSION_12_0 120000 +#define MAC_OS_VERSION_13_0 130000 + +#endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */ + +#define __DRIVERKIT_19_0 190000 +#define __DRIVERKIT_20_0 200000 +#define __DRIVERKIT_21_0 210000 + +#endif /* __AVAILABILITY_VERSIONS__ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/Block.h b/lib/libc/include/any-macos.13-any/Block.h new file mode 100644 index 0000000000..e381a9585f --- /dev/null +++ b/lib/libc/include/any-macos.13-any/Block.h @@ -0,0 +1,65 @@ +/* + * Block.h + * + * Copyright (c) 2008-2010 Apple Inc. All rights reserved. + * + * @APPLE_LLVM_LICENSE_HEADER@ + * + */ + +#ifndef _Block_H_ +#define _Block_H_ + +#if !defined(BLOCK_EXPORT) +# if defined(__cplusplus) +# define BLOCK_EXPORT extern "C" +# else +# define BLOCK_EXPORT extern +# endif +#endif + +#include +#include +#include + +#if __cplusplus +extern "C" { +#endif + +// Create a heap based copy of a Block or simply add a reference to an existing one. +// This must be paired with Block_release to recover memory, even when running +// under Objective-C Garbage Collection. +BLOCK_EXPORT void *__single _Block_copy(const void *__single aBlock) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); + +// Lose the reference, and if heap based and last reference, recover the memory +BLOCK_EXPORT void _Block_release(const void *__single aBlock) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); + + +// Used by the compiler. Do not call this function yourself. +BLOCK_EXPORT void _Block_object_assign(void *, const void *, const int) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); + +// Used by the compiler. Do not call this function yourself. +BLOCK_EXPORT void _Block_object_dispose(const void *, const int) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); + +// Used by the compiler. Do not use these variables yourself. +BLOCK_EXPORT void * _NSConcreteGlobalBlock[32] + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +BLOCK_EXPORT void * _NSConcreteStackBlock[32] + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); + + +#if __cplusplus +} +#endif + +// Type correct macros + +#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__))) +#define Block_release(...) _Block_release((const void *)(__VA_ARGS__)) + + +#endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/copyfile.h b/lib/libc/include/any-macos.13-any/copyfile.h new file mode 100644 index 0000000000..2d3bc9ccf8 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/copyfile.h @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2004-2021 Apple, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +#ifndef _COPYFILE_H_ /* version 0.1 */ +#define _COPYFILE_H_ + +/* + * This API facilitates the copying of files and their associated + * metadata. There are several open source projects that need + * modifications to support preserving extended attributes and ACLs + * and this API collapses several hundred lines of modifications into + * one or two calls. + */ + +/* private */ +#include +#include + +__BEGIN_DECLS +__ptrcheck_abi_assume_single() +struct _copyfile_state; +typedef struct _copyfile_state * copyfile_state_t; +typedef uint32_t copyfile_flags_t; + +/* public */ + +/* receives: + * from path to source file system object + * to path to destination file system object + * state opaque blob for future extensibility + * Must be NULL in current implementation + * flags (described below) + * returns: + * int negative for error + */ + +int copyfile(const char *__unsafe_indexable from, const char *__unsafe_indexable to, copyfile_state_t state, copyfile_flags_t flags); +int fcopyfile(int from_fd, int to_fd, copyfile_state_t, copyfile_flags_t flags); + +int copyfile_state_free(copyfile_state_t); +copyfile_state_t copyfile_state_alloc(void); + + +int copyfile_state_get(copyfile_state_t s, uint32_t flag, void * dst); +int copyfile_state_set(copyfile_state_t s, uint32_t flag, const void * src); + +typedef int (*copyfile_callback_t)(int, int, copyfile_state_t, const char *__unsafe_indexable, const char *__unsafe_indexable, void *); + +#define COPYFILE_STATE_SRC_FD 1 +#define COPYFILE_STATE_SRC_FILENAME 2 +#define COPYFILE_STATE_DST_FD 3 +#define COPYFILE_STATE_DST_FILENAME 4 +#define COPYFILE_STATE_QUARANTINE 5 +#define COPYFILE_STATE_STATUS_CB 6 +#define COPYFILE_STATE_STATUS_CTX 7 +#define COPYFILE_STATE_COPIED 8 +#define COPYFILE_STATE_XATTRNAME 9 +#define COPYFILE_STATE_WAS_CLONED 10 +#define COPYFILE_STATE_SRC_BSIZE 11 +#define COPYFILE_STATE_DST_BSIZE 12 +#define COPYFILE_STATE_BSIZE 13 + + +#define COPYFILE_DISABLE_VAR "COPYFILE_DISABLE" + +/* flags for copyfile */ + +#define COPYFILE_ACL (1<<0) +#define COPYFILE_STAT (1<<1) +#define COPYFILE_XATTR (1<<2) +#define COPYFILE_DATA (1<<3) + +#define COPYFILE_SECURITY (COPYFILE_STAT | COPYFILE_ACL) +#define COPYFILE_METADATA (COPYFILE_SECURITY | COPYFILE_XATTR) +#define COPYFILE_ALL (COPYFILE_METADATA | COPYFILE_DATA) + +#define COPYFILE_RECURSIVE (1<<15) /* Descend into hierarchies */ +#define COPYFILE_CHECK (1<<16) /* return flags for xattr or acls if set */ +#define COPYFILE_EXCL (1<<17) /* fail if destination exists */ +#define COPYFILE_NOFOLLOW_SRC (1<<18) /* don't follow if source is a symlink */ +#define COPYFILE_NOFOLLOW_DST (1<<19) /* don't follow if dst is a symlink */ +#define COPYFILE_MOVE (1<<20) /* unlink src after copy */ +#define COPYFILE_UNLINK (1<<21) /* unlink dst before copy */ +#define COPYFILE_NOFOLLOW (COPYFILE_NOFOLLOW_SRC | COPYFILE_NOFOLLOW_DST) + +#define COPYFILE_PACK (1<<22) +#define COPYFILE_UNPACK (1<<23) + +#define COPYFILE_CLONE (1<<24) +#define COPYFILE_CLONE_FORCE (1<<25) + +#define COPYFILE_RUN_IN_PLACE (1<<26) + +#define COPYFILE_DATA_SPARSE (1<<27) + +#define COPYFILE_PRESERVE_DST_TRACKED (1<<28) + +#define COPYFILE_VERBOSE (1<<30) + +#define COPYFILE_RECURSE_ERROR 0 +#define COPYFILE_RECURSE_FILE 1 +#define COPYFILE_RECURSE_DIR 2 +#define COPYFILE_RECURSE_DIR_CLEANUP 3 +#define COPYFILE_COPY_DATA 4 +#define COPYFILE_COPY_XATTR 5 + +#define COPYFILE_START 1 +#define COPYFILE_FINISH 2 +#define COPYFILE_ERR 3 +#define COPYFILE_PROGRESS 4 + +#define COPYFILE_CONTINUE 0 +#define COPYFILE_SKIP 1 +#define COPYFILE_QUIT 2 + +__END_DECLS + +#endif /* _COPYFILE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/base.h b/lib/libc/include/any-macos.13-any/dispatch/base.h similarity index 86% rename from lib/libc/include/x86_64-macos.10-none/dispatch/base.h rename to lib/libc/include/any-macos.13-any/dispatch/base.h index 86ed15d144..58406b0dfb 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/base.h +++ b/lib/libc/include/any-macos.13-any/dispatch/base.h @@ -127,6 +127,33 @@ #define DISPATCH_UNAVAILABLE_MSG(msg) #endif +#if defined(__cplusplus) +# if __cplusplus >= 201703L +# define DISPATCH_FALLTHROUGH [[fallthrough]] +# elif __cplusplus >= 201103L +# if defined(__clang__) +# define DISPATCH_FALLTHROUGH [[clang::fallthrough]] +# elif defined(__GNUC__) && __GNUC__ >= 7 +# define DISPATCH_FALLTHROUGH [[gnu::fallthrough]] +# else +# define DISPATCH_FALLTHROUGH +# endif +# else +# define DISPATCH_FALLTHROUGH +# endif +#elif defined(__GNUC__) && __GNUC__ >= 7 +# define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__)) +#elif defined(__clang__) +# if __has_attribute(fallthrough) && __clang_major__ >= 5 +# define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__)) +# else +# define DISPATCH_FALLTHROUGH +# endif +#else +# define DISPATCH_FALLTHROUGH +#endif + + #define DISPATCH_LINUX_UNAVAILABLE() #ifdef __FreeBSD__ @@ -203,6 +230,20 @@ #define DISPATCH_ASSUME_NONNULL_END #endif +#if __has_feature(bounds_attributes) +#define DISPATCH_ASSUME_ABI_SINGLE_BEGIN _Pragma("clang abi_ptr_attr set(single)") +#define DISPATCH_ASSUME_ABI_SINGLE_END _Pragma("clang abi_ptr_attr set(unsafe_indexable)") +#define DISPATCH_UNSAFE_INDEXABLE __attribute__((__unsafe_indexable__)) +#define DISPATCH_COUNTED_BY(X) __attribute__((__counted_by__(X))) +#define DISPATCH_SIZED_BY(X) __attribute__((__sized_by__(X))) +#else +#define DISPATCH_ASSUME_ABI_SINGLE_BEGIN +#define DISPATCH_ASSUME_ABI_SINGLE_END +#define DISPATCH_UNSAFE_INDEXABLE +#define DISPATCH_COUNTED_BY(X) +#define DISPATCH_SIZED_BY(X) +#endif + #if !__has_feature(nullability) #ifndef _Nullable #define _Nullable @@ -301,6 +342,10 @@ #define DISPATCH_TRANSPARENT_UNION #endif +DISPATCH_ASSUME_ABI_SINGLE_BEGIN + typedef void (*dispatch_function_t)(void *_Nullable); +DISPATCH_ASSUME_ABI_SINGLE_END + #endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/block.h b/lib/libc/include/any-macos.13-any/dispatch/block.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/dispatch/block.h rename to lib/libc/include/any-macos.13-any/dispatch/block.h index 5a28f48ce4..294ae8939a 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/block.h +++ b/lib/libc/include/any-macos.13-any/dispatch/block.h @@ -33,6 +33,7 @@ */ DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN __BEGIN_DECLS @@ -323,7 +324,7 @@ dispatch_block_perform(dispatch_block_flags_t flags, */ API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW -long +intptr_t dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout); /*! @@ -416,11 +417,12 @@ dispatch_block_cancel(dispatch_block_t block); API_AVAILABLE(macos(10.10), ios(8.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW -long +intptr_t dispatch_block_testcancel(dispatch_block_t block); __END_DECLS +DISPATCH_ASSUME_ABI_SINGLE_END DISPATCH_ASSUME_NONNULL_END #endif // __BLOCKS__ diff --git a/lib/libc/include/any-macos.13-any/dispatch/data.h b/lib/libc/include/any-macos.13-any/dispatch/data.h new file mode 100644 index 0000000000..9e8e9a40ae --- /dev/null +++ b/lib/libc/include/any-macos.13-any/dispatch/data.h @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2009-2013 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __DISPATCH_DATA__ +#define __DISPATCH_DATA__ + +#ifndef __DISPATCH_INDIRECT__ +#error "Please #include instead of this file directly." +#include // for HeaderDoc +#endif + +DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN + +__BEGIN_DECLS + +/*! @header + * Dispatch data objects describe contiguous or sparse regions of memory that + * may be managed by the system or by the application. + * Dispatch data objects are immutable, any direct access to memory regions + * represented by dispatch objects must not modify that memory. + */ + +/*! + * @typedef dispatch_data_t + * A dispatch object representing memory regions. + */ +DISPATCH_DATA_DECL(dispatch_data); + +/*! + * @var dispatch_data_empty + * @discussion The singleton dispatch data object representing a zero-length + * memory region. + */ +#define dispatch_data_empty \ + DISPATCH_GLOBAL_OBJECT(dispatch_data_t, _dispatch_data_empty) +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT struct dispatch_data_s _dispatch_data_empty; + +/*! + * @const DISPATCH_DATA_DESTRUCTOR_DEFAULT + * @discussion The default destructor for dispatch data objects. + * Used at data object creation to indicate that the supplied buffer should + * be copied into internal storage managed by the system. + */ +#define DISPATCH_DATA_DESTRUCTOR_DEFAULT NULL + +#ifdef __BLOCKS__ +/*! @parseOnly */ +#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \ + DISPATCH_EXPORT const dispatch_block_t _dispatch_data_destructor_##name +#else +#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \ + DISPATCH_EXPORT const dispatch_function_t \ + _dispatch_data_destructor_##name +#endif /* __BLOCKS__ */ + +/*! + * @const DISPATCH_DATA_DESTRUCTOR_FREE + * @discussion The destructor for dispatch data objects created from a malloc'd + * buffer. Used at data object creation to indicate that the supplied buffer + * was allocated by the malloc() family and should be destroyed with free(3). + */ +#define DISPATCH_DATA_DESTRUCTOR_FREE (_dispatch_data_destructor_free) +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free); + +/*! + * @const DISPATCH_DATA_DESTRUCTOR_MUNMAP + * @discussion The destructor for dispatch data objects that have been created + * from buffers that require deallocation with munmap(2). + */ +#define DISPATCH_DATA_DESTRUCTOR_MUNMAP (_dispatch_data_destructor_munmap) +API_AVAILABLE(macos(10.9), ios(7.0)) +DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap); + +#ifdef __BLOCKS__ +/*! + * @function dispatch_data_create + * Creates a dispatch data object from the given contiguous buffer of memory. If + * a non-default destructor is provided, ownership of the buffer remains with + * the caller (i.e. the bytes will not be copied). The last release of the data + * object will result in the invocation of the specified destructor on the + * specified queue to free the buffer. + * + * If the DISPATCH_DATA_DESTRUCTOR_FREE destructor is provided the buffer will + * be freed via free(3) and the queue argument ignored. + * + * If the DISPATCH_DATA_DESTRUCTOR_DEFAULT destructor is provided, data object + * creation will copy the buffer into internal memory managed by the system. + * + * @param buffer A contiguous buffer of data. + * @param size The size of the contiguous buffer of data. + * @param queue The queue to which the destructor should be submitted. + * @param destructor The destructor responsible for freeing the data when it + * is no longer needed. + * @result A newly created dispatch data object. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_data_t +dispatch_data_create(const void *DISPATCH_SIZED_BY(size) buffer, + size_t size, + dispatch_queue_t _Nullable queue, + dispatch_block_t _Nullable destructor); +#endif /* __BLOCKS__ */ + +/*! + * @function dispatch_data_get_size + * Returns the logical size of the memory region(s) represented by the specified + * dispatch data object. + * + * @param data The dispatch data object to query. + * @result The number of bytes represented by the data object. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_PURE DISPATCH_NONNULL1 DISPATCH_NOTHROW +size_t +dispatch_data_get_size(dispatch_data_t data); + +/*! + * @function dispatch_data_create_map + * Maps the memory represented by the specified dispatch data object as a single + * contiguous memory region and returns a new data object representing it. + * If non-NULL references to a pointer and a size variable are provided, they + * are filled with the location and extent of that region. These allow direct + * read access to the represented memory, but are only valid until the returned + * object is released. Under ARC, if that object is held in a variable with + * automatic storage, care needs to be taken to ensure that it is not released + * by the compiler before memory access via the pointer has been completed. + * + * @param data The dispatch data object to map. + * @param buffer_ptr A pointer to a pointer variable to be filled with the + * location of the mapped contiguous memory region, or + * NULL. + * @param size_ptr A pointer to a size_t variable to be filled with the + * size of the mapped contiguous memory region, or NULL. + * @result A newly created dispatch data object. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED +DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_data_t +dispatch_data_create_map(dispatch_data_t data, + const void *_Nullable DISPATCH_SIZED_BY(*size_ptr) *_Nullable buffer_ptr, + size_t *_Nullable size_ptr); + +/*! + * @function dispatch_data_create_concat + * Returns a new dispatch data object representing the concatenation of the + * specified data objects. Those objects may be released by the application + * after the call returns (however, the system might not deallocate the memory + * region(s) described by them until the newly created object has also been + * released). + * + * @param data1 The data object representing the region(s) of memory to place + * at the beginning of the newly created object. + * @param data2 The data object representing the region(s) of memory to place + * at the end of the newly created object. + * @result A newly created object representing the concatenation of the + * data1 and data2 objects. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_RETURNS_RETAINED +DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_data_t +dispatch_data_create_concat(dispatch_data_t data1, dispatch_data_t data2); + +/*! + * @function dispatch_data_create_subrange + * Returns a new dispatch data object representing a subrange of the specified + * data object, which may be released by the application after the call returns + * (however, the system might not deallocate the memory region(s) described by + * that object until the newly created object has also been released). + * + * @param data The data object representing the region(s) of memory to + * create a subrange of. + * @param offset The offset into the data object where the subrange + * starts. + * @param length The length of the range. + * @result A newly created object representing the specified + * subrange of the data object. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED +DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_data_t +dispatch_data_create_subrange(dispatch_data_t data, + size_t offset, + size_t length); + +#ifdef __BLOCKS__ +/*! + * @typedef dispatch_data_applier_t + * A block to be invoked for every contiguous memory region in a data object. + * + * @param region A data object representing the current region. + * @param offset The logical offset of the current region to the start + * of the data object. + * @param buffer The location of the memory for the current region. + * @param size The size of the memory for the current region. + * @result A Boolean indicating whether traversal should continue. + */ +typedef bool (^dispatch_data_applier_t)(dispatch_data_t region, + size_t offset, + const void *DISPATCH_SIZED_BY(size) buffer, + size_t size); + +/*! + * @function dispatch_data_apply + * Traverse the memory regions represented by the specified dispatch data object + * in logical order and invoke the specified block once for every contiguous + * memory region encountered. + * + * Each invocation of the block is passed a data object representing the current + * region and its logical offset, along with the memory location and extent of + * the region. These allow direct read access to the memory region, but are only + * valid until the passed-in region object is released. Note that the region + * object is released by the system when the block returns, it is the + * responsibility of the application to retain it if the region object or the + * associated memory location are needed after the block returns. + * + * @param data The data object to traverse. + * @param applier The block to be invoked for every contiguous memory + * region in the data object. + * @result A Boolean indicating whether traversal completed + * successfully. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW +bool +dispatch_data_apply(dispatch_data_t data, + DISPATCH_NOESCAPE dispatch_data_applier_t applier); +#endif /* __BLOCKS__ */ + +/*! + * @function dispatch_data_copy_region + * Finds the contiguous memory region containing the specified location among + * the regions represented by the specified object and returns a copy of the + * internal dispatch data object representing that region along with its logical + * offset in the specified object. + * + * @param data The dispatch data object to query. + * @param location The logical position in the data object to query. + * @param offset_ptr A pointer to a size_t variable to be filled with the + * logical offset of the returned region object to the + * start of the queried data object. + * @result A newly created dispatch data object. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_RETURNS_RETAINED +DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_data_t +dispatch_data_copy_region(dispatch_data_t data, + size_t location, + size_t *offset_ptr); + +__END_DECLS + +DISPATCH_ASSUME_ABI_SINGLE_END +DISPATCH_ASSUME_NONNULL_END + +#endif /* __DISPATCH_DATA__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/group.h b/lib/libc/include/any-macos.13-any/dispatch/group.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/dispatch/group.h rename to lib/libc/include/any-macos.13-any/dispatch/group.h index bb9bad30e3..9e36f30fc9 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/group.h +++ b/lib/libc/include/any-macos.13-any/dispatch/group.h @@ -27,6 +27,7 @@ #endif DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN /*! * @typedef dispatch_group_t @@ -160,7 +161,7 @@ dispatch_group_async_f(dispatch_group_t group, */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW -long +intptr_t dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout); /*! @@ -274,6 +275,7 @@ dispatch_group_leave(dispatch_group_t group); __END_DECLS +DISPATCH_ASSUME_ABI_SINGLE_END DISPATCH_ASSUME_NONNULL_END #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/dispatch/io.h b/lib/libc/include/any-macos.13-any/dispatch/io.h new file mode 100644 index 0000000000..30e2692a83 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/dispatch/io.h @@ -0,0 +1,599 @@ +/* + * Copyright (c) 2009-2013 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __DISPATCH_IO__ +#define __DISPATCH_IO__ + +#ifndef __DISPATCH_INDIRECT__ +#error "Please #include instead of this file directly." +#include // for HeaderDoc +#endif + +DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN + +__BEGIN_DECLS + +/*! @header + * Dispatch I/O provides both stream and random access asynchronous read and + * write operations on file descriptors. One or more dispatch I/O channels may + * be created from a file descriptor as either the DISPATCH_IO_STREAM type or + * DISPATCH_IO_RANDOM type. Once a channel has been created the application may + * schedule asynchronous read and write operations. + * + * The application may set policies on the dispatch I/O channel to indicate the + * desired frequency of I/O handlers for long-running operations. + * + * Dispatch I/O also provides a memory management model for I/O buffers that + * avoids unnecessary copying of data when pipelined between channels. Dispatch + * I/O monitors the overall memory pressure and I/O access patterns for the + * application to optimize resource utilization. + */ + +/*! + * @typedef dispatch_fd_t + * Native file descriptor type for the platform. + */ +#if defined(_WIN32) +typedef intptr_t dispatch_fd_t; +#else +typedef int dispatch_fd_t; +#endif + +/*! + * @functiongroup Dispatch I/O Convenience API + * Convenience wrappers around the dispatch I/O channel API, with simpler + * callback handler semantics and no explicit management of channel objects. + * File descriptors passed to the convenience API are treated as streams, and + * scheduling multiple operations on one file descriptor via the convenience API + * may incur more overhead than by using the dispatch I/O channel API directly. + */ + +#ifdef __BLOCKS__ +/*! + * @function dispatch_read + * Schedule a read operation for asynchronous execution on the specified file + * descriptor. The specified handler is enqueued with the data read from the + * file descriptor when the operation has completed or an error occurs. + * + * The data object passed to the handler will be automatically released by the + * system when the handler returns. It is the responsibility of the application + * to retain, concatenate or copy the data object if it is needed after the + * handler returns. + * + * The data object passed to the handler will only contain as much data as is + * currently available from the file descriptor (up to the specified length). + * + * If an unrecoverable error occurs on the file descriptor, the handler will be + * enqueued with the appropriate error code along with a data object of any data + * that could be read successfully. + * + * An invocation of the handler with an error code of zero and an empty data + * object indicates that EOF was reached. + * + * The system takes control of the file descriptor until the handler is + * enqueued, and during this time file descriptor flags such as O_NONBLOCK will + * be modified by the system on behalf of the application. It is an error for + * the application to modify a file descriptor directly while it is under the + * control of the system, but it may create additional dispatch I/O convenience + * operations or dispatch I/O channels associated with that file descriptor. + * + * @param fd The file descriptor from which to read the data. + * @param length The length of data to read from the file descriptor, + * or SIZE_MAX to indicate that all of the data currently + * available from the file descriptor should be read. + * @param queue The dispatch queue to which the handler should be + * submitted. + * @param handler The handler to enqueue when data is ready to be + * delivered. + * param data The data read from the file descriptor. + * param error An errno condition for the read operation or + * zero if the read was successful. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NONNULL4 DISPATCH_NOTHROW +void +dispatch_read(dispatch_fd_t fd, + size_t length, + dispatch_queue_t queue, + void (^handler)(dispatch_data_t data, int error)); + +/*! + * @function dispatch_write + * Schedule a write operation for asynchronous execution on the specified file + * descriptor. The specified handler is enqueued when the operation has + * completed or an error occurs. + * + * If an unrecoverable error occurs on the file descriptor, the handler will be + * enqueued with the appropriate error code along with the data that could not + * be successfully written. + * + * An invocation of the handler with an error code of zero indicates that the + * data was fully written to the channel. + * + * The system takes control of the file descriptor until the handler is + * enqueued, and during this time file descriptor flags such as O_NONBLOCK will + * be modified by the system on behalf of the application. It is an error for + * the application to modify a file descriptor directly while it is under the + * control of the system, but it may create additional dispatch I/O convenience + * operations or dispatch I/O channels associated with that file descriptor. + * + * @param fd The file descriptor to which to write the data. + * @param data The data object to write to the file descriptor. + * @param queue The dispatch queue to which the handler should be + * submitted. + * @param handler The handler to enqueue when the data has been written. + * param data The data that could not be written to the I/O + * channel, or NULL. + * param error An errno condition for the write operation or + * zero if the write was successful. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL3 DISPATCH_NONNULL4 +DISPATCH_NOTHROW +void +dispatch_write(dispatch_fd_t fd, + dispatch_data_t data, + dispatch_queue_t queue, + void (^handler)(dispatch_data_t _Nullable data, int error)); +#endif /* __BLOCKS__ */ + +/*! + * @functiongroup Dispatch I/O Channel API + */ + +/*! + * @typedef dispatch_io_t + * A dispatch I/O channel represents the asynchronous I/O policy applied to a + * file descriptor. I/O channels are first class dispatch objects and may be + * retained and released, suspended and resumed, etc. + */ +DISPATCH_DECL(dispatch_io); + +/*! + * @typedef dispatch_io_type_t + * The type of a dispatch I/O channel: + * + * @const DISPATCH_IO_STREAM A dispatch I/O channel representing a stream of + * bytes. Read and write operations on a channel of this type are performed + * serially (in order of creation) and read/write data at the file pointer + * position that is current at the time the operation starts executing. + * Operations of different type (read vs. write) may be performed simultaneously. + * Offsets passed to operations on a channel of this type are ignored. + * + * @const DISPATCH_IO_RANDOM A dispatch I/O channel representing a random + * access file. Read and write operations on a channel of this type may be + * performed concurrently and read/write data at the specified offset. Offsets + * are interpreted relative to the file pointer position current at the time the + * I/O channel is created. Attempting to create a channel of this type for a + * file descriptor that is not seekable will result in an error. + */ +#define DISPATCH_IO_STREAM 0 +#define DISPATCH_IO_RANDOM 1 + +typedef unsigned long dispatch_io_type_t; + +#ifdef __BLOCKS__ +/*! + * @function dispatch_io_create + * Create a dispatch I/O channel associated with a file descriptor. The system + * takes control of the file descriptor until the channel is closed, an error + * occurs on the file descriptor or all references to the channel are released. + * At that time the specified cleanup handler will be enqueued and control over + * the file descriptor relinquished. + * + * While a file descriptor is under the control of a dispatch I/O channel, file + * descriptor flags such as O_NONBLOCK will be modified by the system on behalf + * of the application. It is an error for the application to modify a file + * descriptor directly while it is under the control of a dispatch I/O channel, + * but it may create additional channels associated with that file descriptor. + * + * @param type The desired type of I/O channel (DISPATCH_IO_STREAM + * or DISPATCH_IO_RANDOM). + * @param fd The file descriptor to associate with the I/O channel. + * @param queue The dispatch queue to which the handler should be submitted. + * @param cleanup_handler The handler to enqueue when the system + * relinquishes control over the file descriptor. + * param error An errno condition if control is relinquished + * because channel creation failed, zero otherwise. + * @result The newly created dispatch I/O channel or NULL if an error + * occurred (invalid type specified). + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT +DISPATCH_NOTHROW +dispatch_io_t +dispatch_io_create(dispatch_io_type_t type, + dispatch_fd_t fd, + dispatch_queue_t queue, + void (^cleanup_handler)(int error)); + +/*! + * @function dispatch_io_create_with_path + * Create a dispatch I/O channel associated with a path name. The specified + * path, oflag and mode parameters will be passed to open(2) when the first I/O + * operation on the channel is ready to execute and the resulting file + * descriptor will remain open and under the control of the system until the + * channel is closed, an error occurs on the file descriptor or all references + * to the channel are released. At that time the file descriptor will be closed + * and the specified cleanup handler will be enqueued. + * + * @param type The desired type of I/O channel (DISPATCH_IO_STREAM + * or DISPATCH_IO_RANDOM). + * @param path The absolute path to associate with the I/O channel. + * @param oflag The flags to pass to open(2) when opening the file at + * path. + * @param mode The mode to pass to open(2) when creating the file at + * path (i.e. with flag O_CREAT), zero otherwise. + * @param queue The dispatch queue to which the handler should be + * submitted. + * @param cleanup_handler The handler to enqueue when the system + * has closed the file at path. + * param error An errno condition if control is relinquished + * because channel creation or opening of the + * specified file failed, zero otherwise. + * @result The newly created dispatch I/O channel or NULL if an error + * occurred (invalid type or non-absolute path specified). + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED +DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_io_t +dispatch_io_create_with_path(dispatch_io_type_t type, + const char *DISPATCH_UNSAFE_INDEXABLE path, int oflag, + mode_t mode, dispatch_queue_t queue, + void (^cleanup_handler)(int error)); + +/*! + * @function dispatch_io_create_with_io + * Create a new dispatch I/O channel from an existing dispatch I/O channel. + * The new channel inherits the file descriptor or path name associated with + * the existing channel, but not its channel type or policies. + * + * If the existing channel is associated with a file descriptor, control by the + * system over that file descriptor is extended until the new channel is also + * closed, an error occurs on the file descriptor, or all references to both + * channels are released. At that time the specified cleanup handler will be + * enqueued and control over the file descriptor relinquished. + * + * While a file descriptor is under the control of a dispatch I/O channel, file + * descriptor flags such as O_NONBLOCK will be modified by the system on behalf + * of the application. It is an error for the application to modify a file + * descriptor directly while it is under the control of a dispatch I/O channel, + * but it may create additional channels associated with that file descriptor. + * + * @param type The desired type of I/O channel (DISPATCH_IO_STREAM + * or DISPATCH_IO_RANDOM). + * @param io The existing channel to create the new I/O channel from. + * @param queue The dispatch queue to which the handler should be submitted. + * @param cleanup_handler The handler to enqueue when the system + * relinquishes control over the file descriptor + * (resp. closes the file at path) associated with + * the existing channel. + * param error An errno condition if control is relinquished + * because channel creation failed, zero otherwise. + * @result The newly created dispatch I/O channel or NULL if an error + * occurred (invalid type specified). + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED +DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_io_t +dispatch_io_create_with_io(dispatch_io_type_t type, + dispatch_io_t io, + dispatch_queue_t queue, + void (^cleanup_handler)(int error)); + +/*! + * @typedef dispatch_io_handler_t + * The prototype of I/O handler blocks for dispatch I/O operations. + * + * @param done A flag indicating whether the operation is complete. + * @param data The data object to be handled. + * @param error An errno condition for the operation. + */ +typedef void (^dispatch_io_handler_t)(bool done, dispatch_data_t _Nullable data, + int error); + +/*! + * @function dispatch_io_read + * Schedule a read operation for asynchronous execution on the specified I/O + * channel. The I/O handler is enqueued one or more times depending on the + * general load of the system and the policy specified on the I/O channel. + * + * Any data read from the channel is described by the dispatch data object + * passed to the I/O handler. This object will be automatically released by the + * system when the I/O handler returns. It is the responsibility of the + * application to retain, concatenate or copy the data object if it is needed + * after the I/O handler returns. + * + * Dispatch I/O handlers are not reentrant. The system will ensure that no new + * I/O handler instance is invoked until the previously enqueued handler block + * has returned. + * + * An invocation of the I/O handler with the done flag set indicates that the + * read operation is complete and that the handler will not be enqueued again. + * + * If an unrecoverable error occurs on the I/O channel's underlying file + * descriptor, the I/O handler will be enqueued with the done flag set, the + * appropriate error code and a NULL data object. + * + * An invocation of the I/O handler with the done flag set, an error code of + * zero and an empty data object indicates that EOF was reached. + * + * @param channel The dispatch I/O channel from which to read the data. + * @param offset The offset relative to the channel position from which + * to start reading (only for DISPATCH_IO_RANDOM). + * @param length The length of data to read from the I/O channel, or + * SIZE_MAX to indicate that data should be read until EOF + * is reached. + * @param queue The dispatch queue to which the I/O handler should be + * submitted. + * @param io_handler The I/O handler to enqueue when data is ready to be + * delivered. + * param done A flag indicating whether the operation is complete. + * param data An object with the data most recently read from the + * I/O channel as part of this read operation, or NULL. + * param error An errno condition for the read operation or zero if + * the read was successful. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL4 DISPATCH_NONNULL5 +DISPATCH_NOTHROW +void +dispatch_io_read(dispatch_io_t channel, + off_t offset, + size_t length, + dispatch_queue_t queue, + dispatch_io_handler_t io_handler); + +/*! + * @function dispatch_io_write + * Schedule a write operation for asynchronous execution on the specified I/O + * channel. The I/O handler is enqueued one or more times depending on the + * general load of the system and the policy specified on the I/O channel. + * + * Any data remaining to be written to the I/O channel is described by the + * dispatch data object passed to the I/O handler. This object will be + * automatically released by the system when the I/O handler returns. It is the + * responsibility of the application to retain, concatenate or copy the data + * object if it is needed after the I/O handler returns. + * + * Dispatch I/O handlers are not reentrant. The system will ensure that no new + * I/O handler instance is invoked until the previously enqueued handler block + * has returned. + * + * An invocation of the I/O handler with the done flag set indicates that the + * write operation is complete and that the handler will not be enqueued again. + * + * If an unrecoverable error occurs on the I/O channel's underlying file + * descriptor, the I/O handler will be enqueued with the done flag set, the + * appropriate error code and an object containing the data that could not be + * written. + * + * An invocation of the I/O handler with the done flag set and an error code of + * zero indicates that the data was fully written to the channel. + * + * @param channel The dispatch I/O channel on which to write the data. + * @param offset The offset relative to the channel position from which + * to start writing (only for DISPATCH_IO_RANDOM). + * @param data The data to write to the I/O channel. The data object + * will be retained by the system until the write operation + * is complete. + * @param queue The dispatch queue to which the I/O handler should be + * submitted. + * @param io_handler The I/O handler to enqueue when data has been delivered. + * param done A flag indicating whether the operation is complete. + * param data An object of the data remaining to be + * written to the I/O channel as part of this write + * operation, or NULL. + * param error An errno condition for the write operation or zero + * if the write was successful. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NONNULL4 +DISPATCH_NONNULL5 DISPATCH_NOTHROW +void +dispatch_io_write(dispatch_io_t channel, + off_t offset, + dispatch_data_t data, + dispatch_queue_t queue, + dispatch_io_handler_t io_handler); +#endif /* __BLOCKS__ */ + +/*! + * @typedef dispatch_io_close_flags_t + * The type of flags you can set on a dispatch_io_close() call + * + * @const DISPATCH_IO_STOP Stop outstanding operations on a channel when + * the channel is closed. + */ +#define DISPATCH_IO_STOP 0x1 + +typedef unsigned long dispatch_io_close_flags_t; + +/*! + * @function dispatch_io_close + * Close the specified I/O channel to new read or write operations; scheduling + * operations on a closed channel results in their handler returning an error. + * + * If the DISPATCH_IO_STOP flag is provided, the system will make a best effort + * to interrupt any outstanding read and write operations on the I/O channel, + * otherwise those operations will run to completion normally. + * Partial results of read and write operations may be returned even after a + * channel is closed with the DISPATCH_IO_STOP flag. + * The final invocation of an I/O handler of an interrupted operation will be + * passed an ECANCELED error code, as will the I/O handler of an operation + * scheduled on a closed channel. + * + * @param channel The dispatch I/O channel to close. + * @param flags The flags for the close operation. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW +void +dispatch_io_close(dispatch_io_t channel, dispatch_io_close_flags_t flags); + +#ifdef __BLOCKS__ +/*! + * @function dispatch_io_barrier + * Schedule a barrier operation on the specified I/O channel; all previously + * scheduled operations on the channel will complete before the provided + * barrier block is enqueued onto the global queue determined by the channel's + * target queue, and no subsequently scheduled operations will start until the + * barrier block has returned. + * + * If multiple channels are associated with the same file descriptor, a barrier + * operation scheduled on any of these channels will act as a barrier across all + * channels in question, i.e. all previously scheduled operations on any of the + * channels will complete before the barrier block is enqueued, and no + * operations subsequently scheduled on any of the channels will start until the + * barrier block has returned. + * + * While the barrier block is running, it may safely operate on the channel's + * underlying file descriptor with fsync(2), lseek(2) etc. (but not close(2)). + * + * @param channel The dispatch I/O channel to schedule the barrier on. + * @param barrier The barrier block. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW +void +dispatch_io_barrier(dispatch_io_t channel, dispatch_block_t barrier); +#endif /* __BLOCKS__ */ + +/*! + * @function dispatch_io_get_descriptor + * Returns the file descriptor underlying a dispatch I/O channel. + * + * Will return -1 for a channel closed with dispatch_io_close() and for a + * channel associated with a path name that has not yet been open(2)ed. + * + * If called from a barrier block scheduled on a channel associated with a path + * name that has not yet been open(2)ed, this will trigger the channel open(2) + * operation and return the resulting file descriptor. + * + * @param channel The dispatch I/O channel to query. + * @result The file descriptor underlying the channel, or -1. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_fd_t +dispatch_io_get_descriptor(dispatch_io_t channel); + +/*! + * @function dispatch_io_set_high_water + * Set a high water mark on the I/O channel for all operations. + * + * The system will make a best effort to enqueue I/O handlers with partial + * results as soon the number of bytes processed by an operation (i.e. read or + * written) reaches the high water mark. + * + * The size of data objects passed to I/O handlers for this channel will never + * exceed the specified high water mark. + * + * The default value for the high water mark is unlimited (i.e. SIZE_MAX). + * + * @param channel The dispatch I/O channel on which to set the policy. + * @param high_water The number of bytes to use as a high water mark. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW +void +dispatch_io_set_high_water(dispatch_io_t channel, size_t high_water); + +/*! + * @function dispatch_io_set_low_water + * Set a low water mark on the I/O channel for all operations. + * + * The system will process (i.e. read or write) at least the low water mark + * number of bytes for an operation before enqueueing I/O handlers with partial + * results. + * + * The size of data objects passed to intermediate I/O handler invocations for + * this channel (i.e. excluding the final invocation) will never be smaller than + * the specified low water mark, except if the channel has an interval with the + * DISPATCH_IO_STRICT_INTERVAL flag set or if EOF or an error was encountered. + * + * I/O handlers should be prepared to receive amounts of data significantly + * larger than the low water mark in general. If an I/O handler requires + * intermediate results of fixed size, set both the low and and the high water + * mark to that size. + * + * The default value for the low water mark is unspecified, but must be assumed + * to be such that intermediate handler invocations may occur. + * If I/O handler invocations with partial results are not desired, set the + * low water mark to SIZE_MAX. + * + * @param channel The dispatch I/O channel on which to set the policy. + * @param low_water The number of bytes to use as a low water mark. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW +void +dispatch_io_set_low_water(dispatch_io_t channel, size_t low_water); + +/*! + * @typedef dispatch_io_interval_flags_t + * Type of flags to set on dispatch_io_set_interval() + * + * @const DISPATCH_IO_STRICT_INTERVAL Enqueue I/O handlers at a channel's + * interval setting even if the amount of data ready to be delivered is inferior + * to the low water mark (or zero). + */ +#define DISPATCH_IO_STRICT_INTERVAL 0x1 + +typedef unsigned long dispatch_io_interval_flags_t; + +/*! + * @function dispatch_io_set_interval + * Set a nanosecond interval at which I/O handlers are to be enqueued on the + * I/O channel for all operations. + * + * This allows an application to receive periodic feedback on the progress of + * read and write operations, e.g. for the purposes of displaying progress bars. + * + * If the amount of data ready to be delivered to an I/O handler at the interval + * is inferior to the channel low water mark, the handler will only be enqueued + * if the DISPATCH_IO_STRICT_INTERVAL flag is set. + * + * Note that the system may defer enqueueing interval I/O handlers by a small + * unspecified amount of leeway in order to align with other system activity for + * improved system performance or power consumption. + * + * @param channel The dispatch I/O channel on which to set the policy. + * @param interval The interval in nanoseconds at which delivery of the I/O + * handler is desired. + * @param flags Flags indicating desired data delivery behavior at + * interval time. + */ +API_AVAILABLE(macos(10.7), ios(5.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW +void +dispatch_io_set_interval(dispatch_io_t channel, + uint64_t interval, + dispatch_io_interval_flags_t flags); + +__END_DECLS + +DISPATCH_ASSUME_ABI_SINGLE_END +DISPATCH_ASSUME_NONNULL_END + +#endif /* __DISPATCH_IO__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/object.h b/lib/libc/include/any-macos.13-any/dispatch/object.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/dispatch/object.h rename to lib/libc/include/any-macos.13-any/dispatch/object.h index 3d89eb1fe6..a38fc4be64 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/object.h +++ b/lib/libc/include/any-macos.13-any/dispatch/object.h @@ -31,6 +31,7 @@ #endif DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN /*! * @typedef dispatch_object_t @@ -456,7 +457,7 @@ dispatch_set_qos_class_floor(dispatch_object_t object, */ DISPATCH_UNAVAILABLE DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW -long +intptr_t dispatch_wait(void *object, dispatch_time_t timeout); #if __has_extension(c_generic_selections) #define dispatch_wait(object, timeout) \ @@ -554,7 +555,7 @@ dispatch_cancel(void *object); DISPATCH_UNAVAILABLE DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW -long +intptr_t dispatch_testcancel(void *object); #if __has_extension(c_generic_selections) #define dispatch_testcancel(object) \ @@ -591,16 +592,19 @@ API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD __attribute__((__format__(printf,2,3))) void -dispatch_debug(dispatch_object_t object, const char *message, ...); +dispatch_debug(dispatch_object_t object, + const char *DISPATCH_UNSAFE_INDEXABLE message, ...); API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0)) DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD __attribute__((__format__(printf,2,0))) void -dispatch_debugv(dispatch_object_t object, const char *message, va_list ap); +dispatch_debugv(dispatch_object_t object, + const char *DISPATCH_UNSAFE_INDEXABLE message, va_list ap); __END_DECLS +DISPATCH_ASSUME_ABI_SINGLE_END DISPATCH_ASSUME_NONNULL_END #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/dispatch/once.h b/lib/libc/include/any-macos.13-any/dispatch/once.h new file mode 100644 index 0000000000..2792f902d5 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/dispatch/once.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2008-2010 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __DISPATCH_ONCE__ +#define __DISPATCH_ONCE__ + +#ifndef __DISPATCH_INDIRECT__ +#error "Please #include instead of this file directly." +#include // for HeaderDoc +#endif + +DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN + +__BEGIN_DECLS + +/*! + * @typedef dispatch_once_t + * + * @abstract + * A predicate for use with dispatch_once(). It must be initialized to zero. + * Note: static and global variables default to zero. + */ +DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") +typedef intptr_t dispatch_once_t; + +#if defined(__x86_64__) || defined(__i386__) || defined(__s390x__) +#define DISPATCH_ONCE_INLINE_FASTPATH 1 +#elif defined(__APPLE__) +#define DISPATCH_ONCE_INLINE_FASTPATH 1 +#else +#define DISPATCH_ONCE_INLINE_FASTPATH 0 +#endif + +/*! + * @function dispatch_once + * + * @abstract + * Execute a block once and only once. + * + * @param predicate + * A pointer to a dispatch_once_t that is used to test whether the block has + * completed or not. + * + * @param block + * The block to execute once. + * + * @discussion + * Always call dispatch_once() before using or testing any variables that are + * initialized by the block. + */ +#ifdef __BLOCKS__ +API_AVAILABLE(macos(10.6), ios(4.0)) +DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW +DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") +void +dispatch_once(dispatch_once_t *predicate, + DISPATCH_NOESCAPE dispatch_block_t block); + +#if DISPATCH_ONCE_INLINE_FASTPATH +DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW +DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") +void +_dispatch_once(dispatch_once_t *predicate, + DISPATCH_NOESCAPE dispatch_block_t block) +{ + if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) { + dispatch_once(predicate, block); + } else { + dispatch_compiler_barrier(); + } + DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l); +} +#undef dispatch_once +#define dispatch_once _dispatch_once +#endif +#endif // DISPATCH_ONCE_INLINE_FASTPATH + +API_AVAILABLE(macos(10.6), ios(4.0)) +DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW +DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") +void +dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context, + dispatch_function_t function); + +#if DISPATCH_ONCE_INLINE_FASTPATH +DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL1 DISPATCH_NONNULL3 +DISPATCH_NOTHROW +DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") +void +_dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context, + dispatch_function_t function) +{ + if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) { + dispatch_once_f(predicate, context, function); + } else { + dispatch_compiler_barrier(); + } + DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l); +} +#undef dispatch_once_f +#define dispatch_once_f _dispatch_once_f +#endif // DISPATCH_ONCE_INLINE_FASTPATH + +__END_DECLS + +DISPATCH_ASSUME_ABI_SINGLE_END +DISPATCH_ASSUME_NONNULL_END + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/queue.h b/lib/libc/include/any-macos.13-any/dispatch/queue.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/dispatch/queue.h rename to lib/libc/include/any-macos.13-any/dispatch/queue.h index f644b0266d..6816514dd6 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/queue.h +++ b/lib/libc/include/any-macos.13-any/dispatch/queue.h @@ -27,6 +27,7 @@ #endif DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN /*! * @header @@ -336,7 +337,7 @@ dispatch_sync_f(dispatch_queue_t queue, * Differences with dispatch_sync() * * Work items submitted to a queue with dispatch_async_and_wait() observe all - * queue attributes of that queue when invoked (inluding autorelease frequency + * queue attributes of that queue when invoked (including autorelease frequency * or QOS class). * * When the runtime has brought up a thread to invoke the asynchronous workitems @@ -473,6 +474,9 @@ dispatch_async_and_wait_f(dispatch_queue_t queue, * @param block * The block to be invoked the specified number of iterations. * The result of passing NULL in this parameter is undefined. + * This function performs a Block_copy() and Block_release() of the input block + * on behalf of the callers. To elide the additional block allocation, + * dispatch_apply_f may be used instead. */ #ifdef __BLOCKS__ API_AVAILABLE(macos(10.6), ios(4.0)) @@ -480,7 +484,7 @@ DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NOTHROW void dispatch_apply(size_t iterations, dispatch_queue_t DISPATCH_APPLY_QUEUE_ARG_NULLABILITY queue, - DISPATCH_NOESCAPE void (^block)(size_t)); + DISPATCH_NOESCAPE void (^block)(size_t iteration)); #endif /*! @@ -515,7 +519,7 @@ DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_NOTHROW void dispatch_apply_f(size_t iterations, dispatch_queue_t DISPATCH_APPLY_QUEUE_ARG_NULLABILITY queue, - void *_Nullable context, void (*work)(void *_Nullable, size_t)); + void *_Nullable context, void (*work)(void *_Nullable context, size_t iteration)); /*! * @function dispatch_get_current_queue @@ -661,7 +665,7 @@ typedef long dispatch_queue_priority_t; API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_global_t -dispatch_get_global_queue(long identifier, unsigned long flags); +dispatch_get_global_queue(intptr_t identifier, uintptr_t flags); /*! * @typedef dispatch_queue_attr_t @@ -988,7 +992,7 @@ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_t -dispatch_queue_create_with_target(const char *_Nullable label, +dispatch_queue_create_with_target(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label, dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target) DISPATCH_ALIAS_V2(dispatch_queue_create_with_target); @@ -1023,6 +1027,8 @@ dispatch_queue_create_with_target(const char *_Nullable label, * When no quality of service class is specified, the target queue of a newly * created dispatch queue is the default priority global concurrent queue. * + * Unless explicitly specified via the attribute, queues are created active. + * * @param label * A string label to attach to the queue. * This parameter is optional and may be NULL. @@ -1039,7 +1045,7 @@ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_queue_t -dispatch_queue_create(const char *_Nullable label, +dispatch_queue_create(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label, dispatch_queue_attr_t _Nullable attr); /*! @@ -1157,7 +1163,9 @@ dispatch_queue_get_qos_class(dispatch_queue_t queue, * terminated. * * If a dispatch queue is active and targeted by other dispatch objects, - * changing its target queue results in undefined behavior. + * changing its target queue results in undefined behavior. Instead, it is + * recommended to create dispatch objects in an inactive state, set up the + * relevant target queues and then activate them. * * @param object * The object to modify. @@ -1669,6 +1677,7 @@ dispatch_assert_queue_not(dispatch_queue_t queue) __END_DECLS +DISPATCH_ASSUME_ABI_SINGLE_END DISPATCH_ASSUME_NONNULL_END #endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/semaphore.h b/lib/libc/include/any-macos.13-any/dispatch/semaphore.h similarity index 91% rename from lib/libc/include/x86_64-macos.10-none/dispatch/semaphore.h rename to lib/libc/include/any-macos.13-any/dispatch/semaphore.h index 156fb800f3..5de07ba80e 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/semaphore.h +++ b/lib/libc/include/any-macos.13-any/dispatch/semaphore.h @@ -27,6 +27,7 @@ #endif DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN /*! * @typedef dispatch_semaphore_t @@ -61,7 +62,7 @@ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_semaphore_t -dispatch_semaphore_create(long value); +dispatch_semaphore_create(intptr_t value); /*! * @function dispatch_semaphore_wait @@ -71,7 +72,9 @@ dispatch_semaphore_create(long value); * * @discussion * Decrement the counting semaphore. If the resulting value is less than zero, - * this function waits for a signal to occur before returning. + * this function waits for a signal to occur before returning. If the timeout is + * reached without a signal being received, the semaphore is re-incremented + * before the function returns. * * @param dsema * The semaphore. The result of passing NULL in this parameter is undefined. @@ -85,7 +88,7 @@ dispatch_semaphore_create(long value); */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW -long +intptr_t dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout); /*! @@ -107,11 +110,12 @@ dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout); */ API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW -long +intptr_t dispatch_semaphore_signal(dispatch_semaphore_t dsema); __END_DECLS +DISPATCH_ASSUME_ABI_SINGLE_END DISPATCH_ASSUME_NONNULL_END #endif /* __DISPATCH_SEMAPHORE__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/source.h b/lib/libc/include/any-macos.13-any/dispatch/source.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/dispatch/source.h rename to lib/libc/include/any-macos.13-any/dispatch/source.h index 968b9ff89e..d49817c38e 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/source.h +++ b/lib/libc/include/any-macos.13-any/dispatch/source.h @@ -36,6 +36,7 @@ #endif DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN /*! * @header @@ -389,7 +390,7 @@ DISPATCH_NOTHROW dispatch_source_t dispatch_source_create(dispatch_source_type_t type, uintptr_t handle, - unsigned long mask, + uintptr_t mask, dispatch_queue_t _Nullable queue); /*! @@ -537,7 +538,7 @@ dispatch_source_cancel(dispatch_source_t source); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW -long +intptr_t dispatch_source_testcancel(dispatch_source_t source); /*! @@ -601,7 +602,7 @@ dispatch_source_get_handle(dispatch_source_t source); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW -unsigned long +uintptr_t dispatch_source_get_mask(dispatch_source_t source); /*! @@ -640,7 +641,7 @@ dispatch_source_get_mask(dispatch_source_t source); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW -unsigned long +uintptr_t dispatch_source_get_data(dispatch_source_t source); /*! @@ -662,7 +663,7 @@ dispatch_source_get_data(dispatch_source_t source); API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void -dispatch_source_merge_data(dispatch_source_t source, unsigned long value); +dispatch_source_merge_data(dispatch_source_t source, uintptr_t value); /*! * @function dispatch_source_set_timer @@ -775,6 +776,7 @@ dispatch_source_set_registration_handler_f(dispatch_source_t source, __END_DECLS +DISPATCH_ASSUME_ABI_SINGLE_END DISPATCH_ASSUME_NONNULL_END #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/dispatch/time.h b/lib/libc/include/any-macos.13-any/dispatch/time.h new file mode 100644 index 0000000000..281513f387 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/dispatch/time.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2008-2011 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __DISPATCH_TIME__ +#define __DISPATCH_TIME__ + +#ifndef __DISPATCH_INDIRECT__ +#error "Please #include instead of this file directly." +#include // for HeaderDoc +#endif + +#include + +// +#if TARGET_OS_MAC +#include +#endif + +DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN + +#ifdef NSEC_PER_SEC +#undef NSEC_PER_SEC +#endif +#ifdef USEC_PER_SEC +#undef USEC_PER_SEC +#endif +#ifdef NSEC_PER_USEC +#undef NSEC_PER_USEC +#endif +#ifdef NSEC_PER_MSEC +#undef NSEC_PER_MSEC +#endif +#define NSEC_PER_SEC 1000000000ull +#define NSEC_PER_MSEC 1000000ull +#define USEC_PER_SEC 1000000ull +#define NSEC_PER_USEC 1000ull + +__BEGIN_DECLS + +struct timespec; + +/*! + * @typedef dispatch_time_t + * + * @abstract + * A somewhat abstract representation of time; where zero means "now" and + * DISPATCH_TIME_FOREVER means "infinity" and every value in between is an + * opaque encoding. + */ +typedef uint64_t dispatch_time_t; + +enum { + DISPATCH_WALLTIME_NOW DISPATCH_ENUM_API_AVAILABLE + (macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = ~1ull, +}; + +#define DISPATCH_TIME_NOW (0ull) +#define DISPATCH_TIME_FOREVER (~0ull) + +/*! + * @function dispatch_time + * + * @abstract + * Create a dispatch_time_t relative to the current value of the default or + * wall time clock, or modify an existing dispatch_time_t. + * + * @discussion + * On Apple platforms, the default clock is based on mach_absolute_time(). + * + * @param when + * An optional dispatch_time_t to add nanoseconds to. If DISPATCH_TIME_NOW is + * passed, then dispatch_time() will use the default clock (which is based on + * mach_absolute_time() on Apple platforms). If DISPATCH_WALLTIME_NOW is used, + * dispatch_time() will use the value returned by gettimeofday(3). + * dispatch_time(DISPATCH_WALLTIME_NOW, delta) is equivalent to + * dispatch_walltime(NULL, delta). + * + * @param delta + * Nanoseconds to add. + * + * @result + * A new dispatch_time_t. + */ +API_AVAILABLE(macos(10.6), ios(4.0)) +DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_time_t +dispatch_time(dispatch_time_t when, int64_t delta); + +/*! + * @function dispatch_walltime + * + * @abstract + * Create a dispatch_time_t using the wall clock. + * + * @discussion + * On Mac OS X the wall clock is based on gettimeofday(3). + * + * @param when + * A struct timespec to add time to. If NULL is passed, then + * dispatch_walltime() will use the result of gettimeofday(3). + * dispatch_walltime(NULL, delta) returns the same value as + * dispatch_time(DISPATCH_WALLTIME_NOW, delta). + * + * @param delta + * Nanoseconds to add. + * + * @result + * A new dispatch_time_t. + */ +API_AVAILABLE(macos(10.6), ios(4.0)) +DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW +dispatch_time_t +dispatch_walltime(const struct timespec *_Nullable when, int64_t delta); + +__END_DECLS + +DISPATCH_ASSUME_ABI_SINGLE_END +DISPATCH_ASSUME_NONNULL_END + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/workloop.h b/lib/libc/include/any-macos.13-any/dispatch/workloop.h similarity index 76% rename from lib/libc/include/x86_64-macos.10-none/dispatch/workloop.h rename to lib/libc/include/any-macos.13-any/dispatch/workloop.h index dcd1db43cc..5be010a52a 100644 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/workloop.h +++ b/lib/libc/include/any-macos.13-any/dispatch/workloop.h @@ -27,6 +27,7 @@ #endif DISPATCH_ASSUME_NONNULL_BEGIN +DISPATCH_ASSUME_ABI_SINGLE_BEGIN __BEGIN_DECLS @@ -39,7 +40,9 @@ __BEGIN_DECLS * @discussion * A dispatch workloop is a flavor of dispatch_queue_t that is a priority * ordered queue (using the QOS class of the submitted workitems as the - * ordering). + * ordering). Dispatch workloops are an exclusion context and it is guaranteed + * that only one work item submitted to the dispatch workloop will be invoked at + * a time. * * Between each workitem invocation, the workloop will evaluate whether higher * priority workitems have since been submitted, either directly to the @@ -75,7 +78,7 @@ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_workloop_t -dispatch_workloop_create(const char *_Nullable label); +dispatch_workloop_create(const char *DISPATCH_UNSAFE_INDEXABLE _Nullable label); /*! * @function dispatch_workloop_create_inactive @@ -101,7 +104,7 @@ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW dispatch_workloop_t -dispatch_workloop_create_inactive(const char *_Nullable label); +dispatch_workloop_create_inactive(const char *DISPATCH_UNSAFE_INDEXABLE _Nullable label); /*! * @function dispatch_workloop_set_autorelease_frequency @@ -129,8 +132,36 @@ void dispatch_workloop_set_autorelease_frequency(dispatch_workloop_t workloop, dispatch_autorelease_frequency_t frequency); +/*! + * @function dispatch_workloop_set_os_workgroup + * + * @abstract + * Associates an os_workgroup_t with the specified dispatch workloop. + * + * The worker thread will be a member of the specified os_workgroup_t while executing + * work items submitted to the workloop. + * + * @param workloop + * The dispatch workloop to modify. + * + * This workloop must be inactive, passing an activated object is undefined + * and will cause the process to be terminated. + * + * @param workgroup + * The workgroup to associate with this workloop. + * + * The workgroup specified is retained and the previously associated workgroup + * (if any) is released. + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW +void +dispatch_workloop_set_os_workgroup(dispatch_workloop_t workloop, + os_workgroup_t workgroup); + __END_DECLS +DISPATCH_ASSUME_ABI_SINGLE_END DISPATCH_ASSUME_NONNULL_END #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/dlfcn.h b/lib/libc/include/any-macos.13-any/dlfcn.h new file mode 100644 index 0000000000..b858a2a294 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/dlfcn.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2004-2008 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + Based on the dlcompat work done by: + Jorge Acereda & + Peter O'Gorman +*/ + +#ifndef _DLFCN_H_ +#define _DLFCN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include +#include + +#ifdef __DRIVERKIT_19_0 + #define __DYLDDL_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit) +#else + #define __DYLDDL_DRIVERKIT_UNAVAILABLE +#endif + +/* + * Structure filled in by dladdr(). + */ +typedef struct dl_info { + const char *dli_fname; /* Pathname of shared object */ + void *dli_fbase; /* Base address of shared object */ + const char *dli_sname; /* Name of nearest symbol */ + void *dli_saddr; /* Address of nearest symbol */ +} Dl_info; + +extern int dladdr(const void *, Dl_info *); +#else + #define __DYLDDL_DRIVERKIT_UNAVAILABLE +#endif /* not POSIX */ + +extern int dlclose(void * __handle) __DYLDDL_DRIVERKIT_UNAVAILABLE; +extern char * dlerror(void) __DYLDDL_DRIVERKIT_UNAVAILABLE; +extern void * dlopen(const char * __path, int __mode) __DYLDDL_DRIVERKIT_UNAVAILABLE; +extern void * dlsym(void * __handle, const char * __symbol); + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +extern bool dlopen_preflight(const char* __path) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) __DYLDDL_DRIVERKIT_UNAVAILABLE; +#endif /* not POSIX */ + + +#define RTLD_LAZY 0x1 +#define RTLD_NOW 0x2 +#define RTLD_LOCAL 0x4 +#define RTLD_GLOBAL 0x8 + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#define RTLD_NOLOAD 0x10 +#define RTLD_NODELETE 0x80 +#define RTLD_FIRST 0x100 /* Mac OS X 10.5 and later */ + +/* + * Special handle arguments for dlsym(). + */ +#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */ +#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */ +#define RTLD_SELF ((void *) -3) /* Search this and subsequent objects (Mac OS X 10.5 and later) */ +#define RTLD_MAIN_ONLY ((void *) -5) /* Search main executable only (Mac OS X 10.5 and later) */ +#endif /* not POSIX */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DLFCN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/launch.h b/lib/libc/include/any-macos.13-any/launch.h new file mode 100644 index 0000000000..9a1f4853a3 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/launch.h @@ -0,0 +1,411 @@ +#ifndef __XPC_LAUNCH_H__ +#define __XPC_LAUNCH_H__ + +/*! + * @header + * These interfaces were only ever documented for the purpose of allowing a + * launchd job to obtain file descriptors associated with the sockets it + * advertised in its launchd.plist(5). That functionality is now available in a + * much more straightforward fashion through the {@link launch_activate_socket} + * API. + * + * There are currently no replacements for other uses of the {@link launch_msg} + * API, including submitting, removing, starting, stopping and listing jobs. + */ + +#include +#include + +#include +#include +#include +#include + +#if __has_feature(assume_nonnull) +_Pragma("clang assume_nonnull begin") +#endif +__BEGIN_DECLS + +#define LAUNCH_KEY_SUBMITJOB "SubmitJob" +#define LAUNCH_KEY_REMOVEJOB "RemoveJob" +#define LAUNCH_KEY_STARTJOB "StartJob" +#define LAUNCH_KEY_STOPJOB "StopJob" +#define LAUNCH_KEY_GETJOB "GetJob" +#define LAUNCH_KEY_GETJOBS "GetJobs" +#define LAUNCH_KEY_CHECKIN "CheckIn" + +#define LAUNCH_JOBKEY_LABEL "Label" +#define LAUNCH_JOBKEY_DISABLED "Disabled" +#define LAUNCH_JOBKEY_USERNAME "UserName" +#define LAUNCH_JOBKEY_GROUPNAME "GroupName" +#define LAUNCH_JOBKEY_TIMEOUT "TimeOut" +#define LAUNCH_JOBKEY_EXITTIMEOUT "ExitTimeOut" +#define LAUNCH_JOBKEY_INITGROUPS "InitGroups" +#define LAUNCH_JOBKEY_SOCKETS "Sockets" +#define LAUNCH_JOBKEY_MACHSERVICES "MachServices" +#define LAUNCH_JOBKEY_MACHSERVICELOOKUPPOLICIES "MachServiceLookupPolicies" +#define LAUNCH_JOBKEY_INETDCOMPATIBILITY "inetdCompatibility" +#define LAUNCH_JOBKEY_ENABLEGLOBBING "EnableGlobbing" +#define LAUNCH_JOBKEY_PROGRAMARGUMENTS "ProgramArguments" +#define LAUNCH_JOBKEY_PROGRAM "Program" +#define LAUNCH_JOBKEY_ONDEMAND "OnDemand" +#define LAUNCH_JOBKEY_KEEPALIVE "KeepAlive" +#define LAUNCH_JOBKEY_LIMITLOADTOHOSTS "LimitLoadToHosts" +#define LAUNCH_JOBKEY_LIMITLOADFROMHOSTS "LimitLoadFromHosts" +#define LAUNCH_JOBKEY_LIMITLOADTOSESSIONTYPE "LimitLoadToSessionType" +#define LAUNCH_JOBKEY_LIMITLOADTOHARDWARE "LimitLoadToHardware" +#define LAUNCH_JOBKEY_LIMITLOADFROMHARDWARE "LimitLoadFromHardware" +#define LAUNCH_JOBKEY_RUNATLOAD "RunAtLoad" +#define LAUNCH_JOBKEY_ROOTDIRECTORY "RootDirectory" +#define LAUNCH_JOBKEY_WORKINGDIRECTORY "WorkingDirectory" +#define LAUNCH_JOBKEY_ENVIRONMENTVARIABLES "EnvironmentVariables" +#define LAUNCH_JOBKEY_USERENVIRONMENTVARIABLES "UserEnvironmentVariables" +#define LAUNCH_JOBKEY_UMASK "Umask" +#define LAUNCH_JOBKEY_NICE "Nice" +#define LAUNCH_JOBKEY_HOPEFULLYEXITSFIRST "HopefullyExitsFirst" +#define LAUNCH_JOBKEY_HOPEFULLYEXITSLAST "HopefullyExitsLast" +#define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO" +#define LAUNCH_JOBKEY_LOWPRIORITYBACKGROUNDIO "LowPriorityBackgroundIO" +#define LAUNCH_JOBKEY_MATERIALIZEDATALESSFILES "MaterializeDatalessFiles" +#define LAUNCH_JOBKEY_SESSIONCREATE "SessionCreate" +#define LAUNCH_JOBKEY_STARTONMOUNT "StartOnMount" +#define LAUNCH_JOBKEY_SOFTRESOURCELIMITS "SoftResourceLimits" +#define LAUNCH_JOBKEY_HARDRESOURCELIMITS "HardResourceLimits" +#define LAUNCH_JOBKEY_STANDARDINPATH "StandardInPath" +#define LAUNCH_JOBKEY_STANDARDOUTPATH "StandardOutPath" +#define LAUNCH_JOBKEY_STANDARDERRORPATH "StandardErrorPath" +#define LAUNCH_JOBKEY_DEBUG "Debug" +#define LAUNCH_JOBKEY_WAITFORDEBUGGER "WaitForDebugger" +#define LAUNCH_JOBKEY_QUEUEDIRECTORIES "QueueDirectories" +#define LAUNCH_JOBKEY_HOMERELATIVEQUEUEDIRECTORIES "HomeRelativeQueueDirectories" +#define LAUNCH_JOBKEY_WATCHPATHS "WatchPaths" +#define LAUNCH_JOBKEY_STARTINTERVAL "StartInterval" +#define LAUNCH_JOBKEY_STARTCALENDARINTERVAL "StartCalendarInterval" +#define LAUNCH_JOBKEY_BONJOURFDS "BonjourFDs" +#define LAUNCH_JOBKEY_LASTEXITSTATUS "LastExitStatus" +#define LAUNCH_JOBKEY_PID "PID" +#define LAUNCH_JOBKEY_THROTTLEINTERVAL "ThrottleInterval" +#define LAUNCH_JOBKEY_LAUNCHONLYONCE "LaunchOnlyOnce" +#define LAUNCH_JOBKEY_ABANDONPROCESSGROUP "AbandonProcessGroup" +#define LAUNCH_JOBKEY_IGNOREPROCESSGROUPATSHUTDOWN \ + "IgnoreProcessGroupAtShutdown" +#define LAUNCH_JOBKEY_LEGACYTIMERS "LegacyTimers" +#define LAUNCH_JOBKEY_ENABLEPRESSUREDEXIT "EnablePressuredExit" +#define LAUNCH_JOBKEY_ENABLETRANSACTIONS "EnableTransactions" +#define LAUNCH_JOBKEY_DRAINMESSAGESONFAILEDINIT "DrainMessagesOnFailedInit" +#define LAUNCH_JOBKEY_POLICIES "Policies" +#define LAUNCH_JOBKEY_BUNDLEPROGRAM "BundleProgram" +#define LAUNCH_JOBKEY_ASSOCIATEDBUNDLEIDENTIFIERS "AssociatedBundleIdentifiers" + +#define LAUNCH_JOBKEY_PUBLISHESEVENTS "PublishesEvents" +#define LAUNCH_KEY_PUBLISHESEVENTS_DOMAININTERNAL "DomainInternal" + +#define LAUNCH_JOBPOLICY_DENYCREATINGOTHERJOBS "DenyCreatingOtherJobs" + +#define LAUNCH_JOBINETDCOMPATIBILITY_WAIT "Wait" +#define LAUNCH_JOBINETDCOMPATIBILITY_INSTANCES "Instances" + +#define LAUNCH_JOBKEY_MACH_RESETATCLOSE "ResetAtClose" +#define LAUNCH_JOBKEY_MACH_HIDEUNTILCHECKIN "HideUntilCheckIn" + +#define LAUNCH_JOBKEY_KEEPALIVE_SUCCESSFULEXIT "SuccessfulExit" +#define LAUNCH_JOBKEY_KEEPALIVE_NETWORKSTATE "NetworkState" +#define LAUNCH_JOBKEY_KEEPALIVE_PATHSTATE "PathState" +#define LAUNCH_JOBKEY_KEEPALIVE_HOMERELATIVEPATHSTATE "HomeRelativePathState" +#define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBACTIVE "OtherJobActive" +#define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBENABLED "OtherJobEnabled" +#define LAUNCH_JOBKEY_KEEPALIVE_AFTERINITIALDEMAND "AfterInitialDemand" +#define LAUNCH_JOBKEY_KEEPALIVE_CRASHED "Crashed" + +#define LAUNCH_JOBKEY_LAUNCHEVENTS "LaunchEvents" + +#define LAUNCH_JOBKEY_CAL_MINUTE "Minute" +#define LAUNCH_JOBKEY_CAL_HOUR "Hour" +#define LAUNCH_JOBKEY_CAL_DAY "Day" +#define LAUNCH_JOBKEY_CAL_WEEKDAY "Weekday" +#define LAUNCH_JOBKEY_CAL_MONTH "Month" + +#define LAUNCH_JOBKEY_RESOURCELIMIT_CORE "Core" +#define LAUNCH_JOBKEY_RESOURCELIMIT_CPU "CPU" +#define LAUNCH_JOBKEY_RESOURCELIMIT_DATA "Data" +#define LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE "FileSize" +#define LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK "MemoryLock" +#define LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE "NumberOfFiles" +#define LAUNCH_JOBKEY_RESOURCELIMIT_NPROC "NumberOfProcesses" +#define LAUNCH_JOBKEY_RESOURCELIMIT_RSS "ResidentSetSize" +#define LAUNCH_JOBKEY_RESOURCELIMIT_STACK "Stack" + +#define LAUNCH_JOBKEY_DISABLED_MACHINETYPE "MachineType" +#define LAUNCH_JOBKEY_DISABLED_MODELNAME "ModelName" + +#define LAUNCH_JOBKEY_DATASTORES "Datastores" +#define LAUNCH_JOBKEY_DATASTORES_SIZELIMIT "SizeLimit" + +#define LAUNCH_JOBSOCKETKEY_TYPE "SockType" +#define LAUNCH_JOBSOCKETKEY_PASSIVE "SockPassive" +#define LAUNCH_JOBSOCKETKEY_BONJOUR "Bonjour" +#define LAUNCH_JOBSOCKETKEY_SECUREWITHKEY "SecureSocketWithKey" +#define LAUNCH_JOBSOCKETKEY_PATHNAME "SockPathName" +#define LAUNCH_JOBSOCKETKEY_PATHMODE "SockPathMode" +#define LAUNCH_JOBSOCKETKEY_PATHOWNER "SockPathOwner" +#define LAUNCH_JOBSOCKETKEY_PATHGROUP "SockPathGroup" +#define LAUNCH_JOBSOCKETKEY_NODENAME "SockNodeName" +#define LAUNCH_JOBSOCKETKEY_SERVICENAME "SockServiceName" +#define LAUNCH_JOBSOCKETKEY_FAMILY "SockFamily" +#define LAUNCH_JOBSOCKETKEY_PROTOCOL "SockProtocol" +#define LAUNCH_JOBSOCKETKEY_MULTICASTGROUP "MulticastGroup" + +#define LAUNCH_JOBKEY_PROCESSTYPE "ProcessType" +#define LAUNCH_KEY_PROCESSTYPE_APP "App" +#define LAUNCH_KEY_PROCESSTYPE_STANDARD "Standard" +#define LAUNCH_KEY_PROCESSTYPE_BACKGROUND "Background" +#define LAUNCH_KEY_PROCESSTYPE_INTERACTIVE "Interactive" +#define LAUNCH_KEY_PROCESSTYPE_ADAPTIVE "Adaptive" + +/*! + * @function launch_activate_socket + * + * @abstract + * Retrieves the file descriptors for sockets specified in the process' + * launchd.plist(5). + * + * @param name + * The name of the socket entry in the service's Sockets dictionary. + * + * @param fds + * On return, this parameter will be populated with an array of file + * descriptors. One socket can have many descriptors associated with it + * depending on the characteristics of the network interfaces on the system. + * The descriptors in this array are the results of calling getaddrinfo(3) with + * the parameters described in launchd.plist(5). + * + * The caller is responsible for calling free(3) on the returned pointer. + * + * @param cnt + * The number of file descriptor entries in the returned array. + * + * @result + * On success, zero is returned. Otherwise, an appropriate POSIX-domain is + * returned. Possible error codes are: + * + * ENOENT -> There was no socket of the specified name owned by the caller. + * ESRCH -> The caller is not a process managed by launchd. + * EALREADY -> The socket has already been activated by the caller. + */ +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL2 OS_NONNULL3 +int +launch_activate_socket(const char *name, + int * _Nonnull * _Nullable fds, size_t *cnt); + +typedef struct _launch_data *launch_data_t; +typedef void (*launch_data_dict_iterator_t)(const launch_data_t lval, + const char *key, void * _Nullable ctx); + +typedef enum { + LAUNCH_DATA_DICTIONARY = 1, + LAUNCH_DATA_ARRAY, + LAUNCH_DATA_FD, + LAUNCH_DATA_INTEGER, + LAUNCH_DATA_REAL, + LAUNCH_DATA_BOOL, + LAUNCH_DATA_STRING, + LAUNCH_DATA_OPAQUE, + LAUNCH_DATA_ERRNO, + LAUNCH_DATA_MACHPORT, +} launch_data_type_t; + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_alloc(launch_data_type_t type); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT OS_NONNULL1 +launch_data_t +launch_data_copy(launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +launch_data_type_t +launch_data_get_type(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +void +launch_data_free(launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 OS_NONNULL2 OS_NONNULL3 +bool +launch_data_dict_insert(launch_data_t ldict, const launch_data_t lval, + const char *key); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL2 +launch_data_t _Nullable +launch_data_dict_lookup(const launch_data_t ldict, const char *key); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 OS_NONNULL2 +bool +launch_data_dict_remove(launch_data_t ldict, const char *key); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 OS_NONNULL2 +void +launch_data_dict_iterate(const launch_data_t ldict, + launch_data_dict_iterator_t iterator, void * _Nullable ctx); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +size_t +launch_data_dict_get_count(const launch_data_t ldict); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 OS_NONNULL2 +bool +launch_data_array_set_index(launch_data_t larray, const launch_data_t lval, + size_t idx); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +launch_data_t +launch_data_array_get_index(const launch_data_t larray, size_t idx); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +size_t +launch_data_array_get_count(const launch_data_t larray); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_new_fd(int fd); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_new_machport(mach_port_t val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_new_integer(long long val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_new_bool(bool val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_new_real(double val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_new_string(const char *val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT +launch_data_t +launch_data_new_opaque(const void *bytes, size_t sz); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +bool +launch_data_set_fd(launch_data_t ld, int fd); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +bool +launch_data_set_machport(launch_data_t ld, mach_port_t mp); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +bool +launch_data_set_integer(launch_data_t ld, long long val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +bool +launch_data_set_bool(launch_data_t ld, bool val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +bool +launch_data_set_real(launch_data_t ld, double val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +bool +launch_data_set_string(launch_data_t ld, const char *val); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_NONNULL1 +bool +launch_data_set_opaque(launch_data_t ld, const void *bytes, size_t sz); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +int +launch_data_get_fd(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +mach_port_t +launch_data_get_machport(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +long long +launch_data_get_integer(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +bool +launch_data_get_bool(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +double +launch_data_get_real(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +const char * +launch_data_get_string(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +void * _Nullable +launch_data_get_opaque(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +size_t +launch_data_get_opaque_size(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT OS_NONNULL1 +int +launch_data_get_errno(const launch_data_t ld); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_WARN_RESULT +int +launch_get_fd(void); + +__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0) +OS_EXPORT OS_MALLOC OS_WARN_RESULT OS_NONNULL1 +launch_data_t +launch_msg(const launch_data_t request); + +__END_DECLS +#if __has_feature(assume_nonnull) +_Pragma("clang assume_nonnull end") +#endif + +#endif // __XPC_LAUNCH_H__ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/libproc.h b/lib/libc/include/any-macos.13-any/libproc.h similarity index 79% rename from lib/libc/include/x86_64-macos.10-none/libproc.h rename to lib/libc/include/any-macos.13-any/libproc.h index 757ac08e23..7bb9e0c23a 100644 --- a/lib/libc/include/x86_64-macos.10-none/libproc.h +++ b/lib/libc/include/any-macos.13-any/libproc.h @@ -31,10 +31,12 @@ #include #include #include +#include /* for audit_token_t */ #include #include +#include /* * This header file contains private interfaces to obtain process information. @@ -98,6 +100,7 @@ int proc_name(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_START int proc_regionfilename(int pid, uint64_t address, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); int proc_kmsgbuf(void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); int proc_pidpath(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); +int proc_pidpath_audittoken(audit_token_t *audittoken, void * buffer, uint32_t buffersize) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)); int proc_libversion(int *major, int * minor) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); /* @@ -125,28 +128,46 @@ int proc_get_dirty(pid_t pid, uint32_t *flags); int proc_clear_dirty(pid_t pid, uint32_t flags); int proc_terminate(pid_t pid, int *sig); +int proc_terminate_all_rsr(int sig); -#ifdef PRIVATE -#include /* - * Enumerate potential userspace pointers embedded in kernel data structures. - * Currently inspects kqueues only. + * NO_SMT means that on an SMT CPU, this thread must be scheduled alone, + * with the paired CPU idle. * - * NOTE: returned "pointers" are opaque user-supplied values and thus not - * guaranteed to address valid objects or be pointers at all. - * - * Returns the number of pointers found (which may exceed buffersize), or -1 on - * failure and errno set appropriately. + * Set NO_SMT on the current proc (all existing and future threads) + * This attribute is inherited on fork and exec */ -int proc_list_uptrs(pid_t pid, uint64_t *buffer, uint32_t buffersize); +int proc_set_no_smt(void) __API_AVAILABLE(macos(11.0)); -int proc_list_dynkqueueids(int pid, kqueue_id_t *buf, uint32_t bufsz); -int proc_piddynkqueueinfo(int pid, int flavor, kqueue_id_t kq_id, void *buffer, - int buffersize); -#endif /* PRIVATE */ +/* Set NO_SMT on the current thread */ +int proc_setthread_no_smt(void) __API_AVAILABLE(macos(11.0)); + +/* + * CPU Security Mitigation APIs + * + * Set CPU security mitigation on the current proc (all existing and future threads) + * This attribute is inherited on fork and exec + */ +int proc_set_csm(uint32_t flags) __API_AVAILABLE(macos(11.0)); + +/* Set CPU security mitigation on the current thread */ +int proc_setthread_csm(uint32_t flags) __API_AVAILABLE(macos(11.0)); + +/* + * flags for CPU Security Mitigation APIs + * PROC_CSM_ALL should be used in most cases, + * the individual flags are provided only for performance evaluation etc + */ +#define PROC_CSM_ALL 0x0001 /* Set all available mitigations */ +#define PROC_CSM_NOSMT 0x0002 /* Set NO_SMT - see above */ +#define PROC_CSM_TECS 0x0004 /* Execute VERW on every return to user mode */ int proc_udata_info(int pid, int flavor, void *buffer, int buffersize); +#if __has_include() +#include +#endif + __END_DECLS #endif /*_LIBPROC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/mach-o/arch.h b/lib/libc/include/any-macos.13-any/mach-o/arch.h new file mode 100644 index 0000000000..0899e050ad --- /dev/null +++ b/lib/libc/include/any-macos.13-any/mach-o/arch.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +#ifndef _MACH_O_ARCH_H_ +#define _MACH_O_ARCH_H_ +/* + * Copyright (c) 1997 Apple Computer, Inc. + * + * Functions that deal with information about architectures. + * + */ + +#include +#include +#include +#include +#include + +#ifndef __CCTOOLS_DEPRECATED + #define __CCTOOLS_DEPRECATED __API_DEPRECATED("No longer supported", macos(10.0, 13.0), ios(1.0, 16.0), watchos(1.0, 8.0), tvos(1.0, 16.0)) + #define __CCTOOLS_DEPRECATED_MSG(_msg) __API_DEPRECATED_WITH_REPLACEMENT(_msg, macos(10.0, 13.0), ios(1.0, 16.0), watchos(1.0, 8.0), tvos(1.0, 16.0)) +#endif + +/* The NXArchInfo structs contain the architectures symbolic name + * (such as "ppc"), its CPU type and CPU subtype as defined in + * mach/machine.h, the byte order for the architecture, and a + * describing string (such as "PowerPC"). + * There will both be entries for specific CPUs (such as ppc604e) as + * well as generic "family" entries (such as ppc). + */ + +struct NXArchInfo { + const char *name; + cpu_type_t cputype; + cpu_subtype_t cpusubtype; + enum NXByteOrder byteorder; + const char *description; +} __CCTOOLS_DEPRECATED; +typedef struct NXArchInfo NXArchInfo __CCTOOLS_DEPRECATED; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* NXGetAllArchInfos() returns a pointer to an array of all known + * NXArchInfo structures. The last NXArchInfo is marked by a NULL name. + */ +extern const NXArchInfo *NXGetAllArchInfos(void) __CCTOOLS_DEPRECATED; + +/* NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL + * if none is known. + */ +extern const NXArchInfo *NXGetLocalArchInfo(void) __CCTOOLS_DEPRECATED_MSG("use macho_arch_name_for_mach_header()"); + +/* NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the + * NXArchInfo from the architecture's name or cputype/cpusubtype + * combination. A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used + * to request the most general NXArchInfo known for the given cputype. + * NULL is returned if no matching NXArchInfo can be found. + */ +extern const NXArchInfo *NXGetArchInfoFromName(const char *name) __CCTOOLS_DEPRECATED_MSG("use macho_cpu_type_for_arch_name()"); +extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype, + cpu_subtype_t cpusubtype) __CCTOOLS_DEPRECATED_MSG("use macho_arch_name_for_cpu_type()"); + +/* The above interfaces that return pointers to NXArchInfo structs in normal + * cases returns a pointer from the array returned in NXGetAllArchInfos(). + * In some cases when the cputype is CPU_TYPE_I386 or CPU_TYPE_POWERPC it will + * retun malloc(3)'ed NXArchInfo struct which contains a string in the + * description field also a malloc(3)'ed pointer. To allow programs not to + * leak memory they can call NXFreeArchInfo() on pointers returned from the + * above interfaces. Since this is a new API on older systems can use the + * code below. Going forward the above interfaces will only return pointers + * from the array returned in NXGetAllArchInfos(). + */ +extern void NXFreeArchInfo(const NXArchInfo *x) __CCTOOLS_DEPRECATED_MSG("NXArchInfo is deprecated"); + +/* The code that can be used for NXFreeArchInfo() when it is not available is: + * + * static void NXFreeArchInfo( + * const NXArchInfo *x) + * { + * const NXArchInfo *p; + * + * p = NXGetAllArchInfos(); + * while(p->name != NULL){ + * if(x == p) + * return; + * p++; + * } + * free((char *)x->description); + * free((NXArchInfo *)x); + * } + */ + +/* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of + * fat_arch structs and selects the best one that matches (if any) and returns + * a pointer to that fat_arch struct (or NULL). The fat_arch structs must be + * in the host byte order and correct such that the fat_archs really points to + * enough memory for nfat_arch structs. It is possible that this routine could + * fail if new cputypes or cpusubtypes are added and an old version of this + * routine is used. But if there is an exact match between the cputype and + * cpusubtype and one of the fat_arch structs this routine will always succeed. + */ +extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype, + cpu_subtype_t cpusubtype, + struct fat_arch *fat_archs, + uint32_t nfat_archs) __CCTOOLS_DEPRECATED_MSG("use macho_best_slice()"); + +/* NXFindBestFatArch_64() is passed a cputype and cpusubtype and a set of + * fat_arch_64 structs and selects the best one that matches (if any) and + * returns a pointer to that fat_arch_64 struct (or NULL). The fat_arch_64 + * structs must be in the host byte order and correct such that the fat_archs64 + * really points to enough memory for nfat_arch structs. It is possible that + * this routine could fail if new cputypes or cpusubtypes are added and an old + * version of this routine is used. But if there is an exact match between the + * cputype and cpusubtype and one of the fat_arch_64 structs this routine will + * always succeed. + */ +extern struct fat_arch_64 *NXFindBestFatArch_64(cpu_type_t cputype, + cpu_subtype_t cpusubtype, + struct fat_arch_64 *fat_archs64, + uint32_t nfat_archs) __CCTOOLS_DEPRECATED_MSG("use macho_best_slice()"); + +/* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two + * different cpusubtypes for the specified cputype. If the two cpusubtypes + * can't be combined (the specific subtypes are mutually exclusive) -1 is + * returned indicating it is an error to combine them. This can also fail and + * return -1 if new cputypes or cpusubtypes are added and an old version of + * this routine is used. But if the cpusubtypes are the same they can always + * be combined and this routine will return the cpusubtype pass in. + */ +extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype, + cpu_subtype_t cpusubtype1, + cpu_subtype_t cpusubtype2) __CCTOOLS_DEPRECATED_MSG("cpu subtypes are no longer combinable"); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _MACH_O_ARCH_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/mach-o/fat.h b/lib/libc/include/any-macos.13-any/mach-o/fat.h new file mode 100644 index 0000000000..32959ca42a --- /dev/null +++ b/lib/libc/include/any-macos.13-any/mach-o/fat.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016 Apple, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +#ifndef _MACH_O_FAT_H_ +#define _MACH_O_FAT_H_ +/* + * This header file describes the structures of the file format for "fat" + * architecture specific file (wrapper design). At the begining of the file + * there is one fat_header structure followed by a number of fat_arch + * structures. For each architecture in the file, specified by a pair of + * cputype and cpusubtype, the fat_header describes the file offset, file + * size and alignment in the file of the architecture specific member. + * The padded bytes in the file to place each member on it's specific alignment + * are defined to be read as zeros and can be left as "holes" if the file system + * can support them as long as they read as zeros. + * + * All structures defined here are always written and read to/from disk + * in big-endian order. + */ + +/* + * is needed here for the cpu_type_t and cpu_subtype_t types + * and contains the constants for the possible values of these types. + */ +#include +#include + +#if __has_include() +#include +#endif + +#define FAT_MAGIC 0xcafebabe +#define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */ + +struct fat_header { + uint32_t magic; /* FAT_MAGIC or FAT_MAGIC_64 */ + uint32_t nfat_arch; /* number of structs that follow */ +}; + +struct fat_arch { + cpu_type_t cputype; /* cpu specifier (int) */ + cpu_subtype_t cpusubtype; /* machine specifier (int) */ + uint32_t offset; /* file offset to this object file */ + uint32_t size; /* size of this object file */ + uint32_t align; /* alignment as a power of 2 */ +}; + +/* + * The support for the 64-bit fat file format described here is a work in + * progress and not yet fully supported in all the Apple Developer Tools. + * + * When a slice is greater than 4mb or an offset to a slice is greater than 4mb + * then the 64-bit fat file format is used. + */ +#define FAT_MAGIC_64 0xcafebabf +#define FAT_CIGAM_64 0xbfbafeca /* NXSwapLong(FAT_MAGIC_64) */ + +struct fat_arch_64 { + cpu_type_t cputype; /* cpu specifier (int) */ + cpu_subtype_t cpusubtype; /* machine specifier (int) */ + uint64_t offset; /* file offset to this object file */ + uint64_t size; /* size of this object file */ + uint32_t align; /* alignment as a power of 2 */ + uint32_t reserved; /* reserved */ +}; + +#endif /* _MACH_O_FAT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach-o/loader.h b/lib/libc/include/any-macos.13-any/mach-o/loader.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/mach-o/loader.h rename to lib/libc/include/any-macos.13-any/mach-o/loader.h index a088105205..4ffc5140a3 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach-o/loader.h +++ b/lib/libc/include/any-macos.13-any/mach-o/loader.h @@ -32,20 +32,28 @@ * is needed here for the cpu_type_t and cpu_subtype_t types * and contains the constants for the possible values of these types. */ +#if __has_include() #include +#endif /* * is needed here for the vm_prot_t type and contains the * constants that are or'ed together for the possible values of this type. */ +#if __has_include() #include +#endif /* * is expected to define the flavors of the thread * states and the structures of those flavors for each machine. */ +#if __has_include() #include +#endif +#if __has_include() #include +#endif /* * The 32-bit mach header appears at the very beginning of the object file for @@ -53,8 +61,8 @@ */ struct mach_header { uint32_t magic; /* mach magic number identifier */ - cpu_type_t cputype; /* cpu specifier */ - cpu_subtype_t cpusubtype; /* machine specifier */ + int32_t cputype; /* cpu specifier */ + int32_t cpusubtype; /* machine specifier */ uint32_t filetype; /* type of file */ uint32_t ncmds; /* number of load commands */ uint32_t sizeofcmds; /* the size of all the load commands */ @@ -71,8 +79,8 @@ struct mach_header { */ struct mach_header_64 { uint32_t magic; /* mach magic number identifier */ - cpu_type_t cputype; /* cpu specifier */ - cpu_subtype_t cpusubtype; /* machine specifier */ + int32_t cputype; /* cpu specifier */ + int32_t cpusubtype; /* machine specifier */ uint32_t filetype; /* type of file */ uint32_t ncmds; /* number of load commands */ uint32_t sizeofcmds; /* the size of all the load commands */ @@ -115,11 +123,17 @@ struct mach_header_64 { #define MH_DYLIB 0x6 /* dynamically bound shared library */ #define MH_DYLINKER 0x7 /* dynamic link editor */ #define MH_BUNDLE 0x8 /* dynamically bound bundle file */ -#define MH_DYLIB_STUB 0x9 /* shared library stub for static */ - /* linking only, no section contents */ -#define MH_DSYM 0xa /* companion file with only debug */ - /* sections */ +#define MH_DYLIB_STUB 0x9 /* shared library stub for static + linking only, no section contents */ +#define MH_DSYM 0xa /* companion file with only debug + sections */ #define MH_KEXT_BUNDLE 0xb /* x86_64 kexts */ +#define MH_FILESET 0xc /* a file composed of other Mach-Os to + be run in the same userspace sharing + a single linkedit. */ +#define MH_GPU_EXECUTE 0xd /* gpu program */ +#define MH_GPU_DYLIB 0xe /* gpu support functions */ + /* Constants for the flags field of the mach_header */ #define MH_NOUNDEFS 0x1 /* the object file has no undefined @@ -322,6 +336,7 @@ struct load_command { #define LC_BUILD_VERSION 0x32 /* build for platform min OS version */ #define LC_DYLD_EXPORTS_TRIE (0x33 | LC_REQ_DYLD) /* used with linkedit_data_command, payload is trie */ #define LC_DYLD_CHAINED_FIXUPS (0x34 | LC_REQ_DYLD) /* used with linkedit_data_command */ +#define LC_FILESET_ENTRY (0x35 | LC_REQ_DYLD) /* used with fileset_entry_command */ /* * A variable length string in a load command is represented by an lc_str @@ -358,8 +373,8 @@ struct segment_command { /* for 32-bit architectures */ uint32_t vmsize; /* memory size of this segment */ uint32_t fileoff; /* file offset of this segment */ uint32_t filesize; /* amount to map from the file */ - vm_prot_t maxprot; /* maximum VM protection */ - vm_prot_t initprot; /* initial VM protection */ + int32_t maxprot; /* maximum VM protection */ + int32_t initprot; /* initial VM protection */ uint32_t nsects; /* number of sections in segment */ uint32_t flags; /* flags */ }; @@ -378,8 +393,8 @@ struct segment_command_64 { /* for 64-bit architectures */ uint64_t vmsize; /* memory size of this segment */ uint64_t fileoff; /* file offset of this segment */ uint64_t filesize; /* amount to map from the file */ - vm_prot_t maxprot; /* maximum VM protection */ - vm_prot_t initprot; /* initial VM protection */ + int32_t maxprot; /* maximum VM protection */ + int32_t initprot; /* initial VM protection */ uint32_t nsects; /* number of sections in segment */ uint32_t flags; /* flags */ }; @@ -1259,24 +1274,45 @@ struct build_tool_version { }; /* Known values for the platform field above. */ +#define PLATFORM_UNKNOWN 0 +#define PLATFORM_ANY 0xFFFFFFFF #define PLATFORM_MACOS 1 #define PLATFORM_IOS 2 #define PLATFORM_TVOS 3 #define PLATFORM_WATCHOS 4 #define PLATFORM_BRIDGEOS 5 #define PLATFORM_MACCATALYST 6 -#if (!defined(PLATFORM_MACCATALYST)) -#define PLATFORM_MACCATALYST 6 -#endif #define PLATFORM_IOSSIMULATOR 7 #define PLATFORM_TVOSSIMULATOR 8 #define PLATFORM_WATCHOSSIMULATOR 9 #define PLATFORM_DRIVERKIT 10 +#ifndef __OPEN_SOURCE__ + +#endif /* __OPEN_SOURCE__ */ + +#define PLATFORM_FIRMWARE 13 +#define PLATFORM_SEPOS 14 + +#ifndef __OPEN_SOURCE__ + +#endif /* __OPEN_SOURCE__ */ + /* Known values for the tool field above. */ #define TOOL_CLANG 1 #define TOOL_SWIFT 2 #define TOOL_LD 3 +#define TOOL_LLD 4 + +/* values for gpu tools (1024 to 1048) */ +#define TOOL_METAL 1024 +#define TOOL_AIRLLD 1025 +#define TOOL_AIRNT 1026 +#define TOOL_AIRNT_PLUGIN 1027 +#define TOOL_AIRPACK 1028 +#define TOOL_GPUARCHIVER 1031 +#define TOOL_METAL_FRAMEWORK 1032 + /* * The dyld_info_command contains the file offsets and sizes of @@ -1455,6 +1491,8 @@ struct dyld_info_command { #define EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION 0x04 #define EXPORT_SYMBOL_FLAGS_REEXPORT 0x08 #define EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER 0x10 +#define EXPORT_SYMBOL_FLAGS_STATIC_RESOLVER 0x20 + /* * The linker_option_command contains linker options embedded in object files. @@ -1574,4 +1612,27 @@ struct note_command { uint64_t size; /* length of data region */ }; +/* + * LC_FILESET_ENTRY commands describe constituent Mach-O files that are part + * of a fileset. In one implementation, entries are dylibs with individual + * mach headers and repositionable text and data segments. Each entry is + * further described by its own mach header. + */ +struct fileset_entry_command { + uint32_t cmd; /* LC_FILESET_ENTRY */ + uint32_t cmdsize; /* includes entry_id string */ + uint64_t vmaddr; /* memory address of the entry */ + uint64_t fileoff; /* file offset of the entry */ + union lc_str entry_id; /* contained entry id */ + uint32_t reserved; /* reserved */ +}; + +/* + * These deprecated values may still be used within Apple but are mechanically + * removed from public API. The mechanical process may produce unusual results. + */ +#if (!defined(PLATFORM_MACCATALYST)) +#define PLATFORM_MACCATALYST PLATFORM_MACCATALYST +#endif + #endif /* _MACHO_LOADER_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/clock.h b/lib/libc/include/any-macos.13-any/mach/clock.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/mach/clock.h rename to lib/libc/include/any-macos.13-any/mach/clock.h index ec293fc9c1..04c8b8ec0b 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/clock.h +++ b/lib/libc/include/any-macos.13-any/mach/clock.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t; #define clock_MSG_COUNT 3 #endif /* clock_MSG_COUNT */ +#include #include #include #include diff --git a/lib/libc/include/x86_64-macos.10-none/mach/clock_priv.h b/lib/libc/include/any-macos.13-any/mach/clock_priv.h similarity index 93% rename from lib/libc/include/x86_64-macos.10-none/mach/clock_priv.h rename to lib/libc/include/any-macos.13-any/mach/clock_priv.h index 0c9d11d9c6..ced1925a05 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/clock_priv.h +++ b/lib/libc/include/any-macos.13-any/mach/clock_priv.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t; #define clock_priv_MSG_COUNT 2 #endif /* clock_priv_MSG_COUNT */ +#include #include #include #include diff --git a/lib/libc/include/x86_64-macos.10-none/mach/exception_types.h b/lib/libc/include/any-macos.13-any/mach/exception_types.h similarity index 92% rename from lib/libc/include/x86_64-macos.10-none/mach/exception_types.h rename to lib/libc/include/any-macos.13-any/mach/exception_types.h index a0026b9ce2..d56a8ac748 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/exception_types.h +++ b/lib/libc/include/any-macos.13-any/mach/exception_types.h @@ -102,34 +102,42 @@ #define EXC_CORPSE_NOTIFY 13 /* Abnormal process exited to corpse state */ -#define EXC_CORPSE_VARIANT_BIT 0x100 /* bit set for EXC_*_CORPSE variants of EXC_* */ - /* * Machine-independent exception behaviors */ -# define EXCEPTION_DEFAULT 1 +#define EXCEPTION_DEFAULT 1 /* Send a catch_exception_raise message including the identity. */ -# define EXCEPTION_STATE 2 +#define EXCEPTION_STATE 2 /* Send a catch_exception_raise_state message including the * thread state. */ -# define EXCEPTION_STATE_IDENTITY 3 +#define EXCEPTION_STATE_IDENTITY 3 /* Send a catch_exception_raise_state_identity message including * the thread identity and state. */ +#define EXCEPTION_IDENTITY_PROTECTED 4 +/* Send a catch_exception_raise_identity_protected message including protected task + * and thread identity. + */ + +#define MACH_EXCEPTION_BACKTRACE_PREFERRED 0x20000000 +/* Prefer sending a catch_exception_raice_backtrace message, if applicable */ + #define MACH_EXCEPTION_ERRORS 0x40000000 /* include additional exception specific errors, not used yet. */ #define MACH_EXCEPTION_CODES 0x80000000 /* Send 64-bit code and subcode in the exception header */ -#define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | MACH_EXCEPTION_ERRORS) +#define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | \ + MACH_EXCEPTION_ERRORS | \ + MACH_EXCEPTION_BACKTRACE_PREFERRED) /* * Masks for exception definitions, above * bit zero is unused, therefore 1 word = 31 exception types @@ -181,6 +189,7 @@ #include #include #include +#include /* * Exported types */ @@ -196,6 +205,7 @@ typedef exception_mask_t *exception_mask_array_t; typedef exception_behavior_t *exception_behavior_array_t; typedef thread_state_flavor_t *exception_flavor_array_t; typedef mach_port_t *exception_port_array_t; +typedef ipc_info_port_t *exception_port_info_array_t; typedef mach_exception_data_type_t mach_exception_code_t; typedef mach_exception_data_type_t mach_exception_subcode_t; diff --git a/lib/libc/include/x86_64-macos.10-none/mach/host_priv.h b/lib/libc/include/any-macos.13-any/mach/host_priv.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/mach/host_priv.h rename to lib/libc/include/any-macos.13-any/mach/host_priv.h index 9445ae5d93..79d27d1f67 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/host_priv.h +++ b/lib/libc/include/any-macos.13-any/mach/host_priv.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t; #define host_priv_MSG_COUNT 26 #endif /* host_priv_MSG_COUNT */ +#include #include #include #include diff --git a/lib/libc/include/x86_64-macos.10-none/mach/host_security.h b/lib/libc/include/any-macos.13-any/mach/host_security.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/mach/host_security.h rename to lib/libc/include/any-macos.13-any/mach/host_security.h index 1c1b6d9144..4f7e86ad30 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/host_security.h +++ b/lib/libc/include/any-macos.13-any/mach/host_security.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t; #define host_security_MSG_COUNT 2 #endif /* host_security_MSG_COUNT */ +#include #include #include #include diff --git a/lib/libc/include/x86_64-macos.10-none/mach/host_special_ports.h b/lib/libc/include/any-macos.13-any/mach/host_special_ports.h similarity index 91% rename from lib/libc/include/x86_64-macos.10-none/mach/host_special_ports.h rename to lib/libc/include/any-macos.13-any/mach/host_special_ports.h index 8d4cdbefce..6b73217bbe 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/host_special_ports.h +++ b/lib/libc/include/any-macos.13-any/mach/host_special_ports.h @@ -76,10 +76,10 @@ */ #define HOST_PORT 1 #define HOST_PRIV_PORT 2 -#define HOST_IO_MASTER_PORT 3 +#define HOST_IO_MAIN_PORT 3 #define HOST_MAX_SPECIAL_KERNEL_PORT 7 /* room to grow */ -#define HOST_LAST_SPECIAL_KERNEL_PORT HOST_IO_MASTER_PORT +#define HOST_LAST_SPECIAL_KERNEL_PORT HOST_IO_MAIN_PORT /* * Not provided by kernel @@ -108,9 +108,11 @@ #define HOST_SYSPOLICYD_PORT (22 + HOST_MAX_SPECIAL_KERNEL_PORT) #define HOST_FILECOORDINATIOND_PORT (23 + HOST_MAX_SPECIAL_KERNEL_PORT) #define HOST_FAIRPLAYD_PORT (24 + HOST_MAX_SPECIAL_KERNEL_PORT) +#define HOST_IOCOMPRESSIONSTATS_PORT (25 + HOST_MAX_SPECIAL_KERNEL_PORT) +#define HOST_MEMORY_ERROR_PORT (26 + HOST_MAX_SPECIAL_KERNEL_PORT) -#define HOST_MAX_SPECIAL_PORT HOST_FAIRPLAYD_PORT -/* MAX = last since rdar://35861175 */ +#define HOST_MAX_SPECIAL_PORT HOST_MEMORY_ERROR_PORT +/* MAX = last since rdar://59872249 */ /* obsolete name */ #define HOST_CHUD_PORT HOST_LAUNCHCTL_PORT @@ -137,10 +139,10 @@ HOST_LOCAL_NODE, HOST_PRIV_PORT, (port))) #define host_set_host_priv_port(host, port) (KERN_INVALID_ARGUMENT) -#define host_get_io_master_port(host, port) \ +#define host_get_io_main_port(host, port) \ (host_get_special_port((host), \ - HOST_LOCAL_NODE, HOST_IO_MASTER_PORT, (port))) -#define host_set_io_master_port(host, port) (KERN_INVALID_ARGUMENT) + HOST_LOCAL_NODE, HOST_IO_MAIN_PORT, (port))) +#define host_set_io_main_port(host, port) (KERN_INVALID_ARGUMENT) /* * User-settable special ports. @@ -274,6 +276,18 @@ #define host_set_fairplayd_port(host, port) \ (host_set_special_port((host), HOST_FAIRPLAYD_PORT, (port))) +#define host_get_iocompressionstats_port(host, port) \ + (host_get_special_port((host), \ + HOST_LOCAL_NODE, HOST_IOCOMPRESSIONSTATS_PORT, (port))) +#define host_set_iocompressionstats_port(host, port) \ + (host_set_special_port((host), HOST_IOCOMPRESSIONSTATS_PORT, (port))) + +#define host_get_memory_error_port(host, port) \ + (host_get_special_port((host), \ + HOST_LOCAL_NODE, HOST_MEMORY_ERROR_PORT, (port))) +#define host_set_memory_error_port(host, port) \ + (host_set_special_port((host), HOST_MEMORY_ERROR_PORT, (port))) + /* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences. * All lookups go through send_resource_violation() */ diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mach.h b/lib/libc/include/any-macos.13-any/mach/mach.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/mach/mach.h rename to lib/libc/include/any-macos.13-any/mach/mach.h index 159fd67b99..712d4e1cab 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/mach.h +++ b/lib/libc/include/any-macos.13-any/mach/mach.h @@ -85,10 +85,6 @@ __BEGIN_DECLS extern void panic_init(mach_port_t); extern void panic(const char *, ...); -extern void safe_gets(char *, - char *, - int); - extern void slot_name(cpu_type_t, cpu_subtype_t, char **, @@ -237,9 +233,9 @@ extern voucher_mach_msg_state_t voucher_mach_msg_adopt(mach_msg_header_t *msg); * @param state * The thread voucher state to restore. */ - extern void voucher_mach_msg_revert(voucher_mach_msg_state_t state); + __END_DECLS #endif /* _MACH_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mach_host.h b/lib/libc/include/any-macos.13-any/mach/mach_host.h similarity index 97% rename from lib/libc/include/x86_64-macos.10-none/mach/mach_host.h rename to lib/libc/include/any-macos.13-any/mach/mach_host.h index a5b6d2cd84..2cdf4c33a9 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/mach_host.h +++ b/lib/libc/include/any-macos.13-any/mach/mach_host.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t; #define mach_host_MSG_COUNT 35 #endif /* mach_host_MSG_COUNT */ +#include #include #include #include @@ -74,8 +78,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_info ( host_t host, @@ -139,16 +142,16 @@ kern_return_t host_processor_info mach_msg_type_number_t *out_processor_infoCnt ); -/* Routine host_get_io_master */ +/* Routine host_get_io_main */ #ifdef mig_external mig_external #else extern #endif /* mig_external */ -kern_return_t host_get_io_master +kern_return_t host_get_io_main ( host_t host, - io_master_t *io_master + io_main_t *io_main ); /* Routine host_get_clock_service */ @@ -251,8 +254,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_request_notification ( host_t host, @@ -308,8 +310,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_create_mach_voucher ( host_t host, @@ -324,8 +325,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_register_mach_voucher_attr_manager ( host_t host, @@ -341,8 +341,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_register_well_known_mach_voucher_attr_manager ( host_t host, @@ -358,8 +357,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_set_atm_diagnostic_flag ( host_t host, @@ -372,8 +370,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t host_get_atm_diagnostic_flag ( host_t host, @@ -532,7 +529,7 @@ __END_DECLS #endif typedef struct { mach_msg_header_t Head; - } __Request__host_get_io_master_t __attribute__((unused)); + } __Request__host_get_io_main_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) #endif @@ -802,7 +799,7 @@ union __RequestUnion__mach_host_subsystem { __Request___host_page_size_t Request__host_page_size; __Request__mach_memory_object_memory_entry_t Request_mach_memory_object_memory_entry; __Request__host_processor_info_t Request_host_processor_info; - __Request__host_get_io_master_t Request_host_get_io_master; + __Request__host_get_io_main_t Request_host_get_io_main; __Request__host_get_clock_service_t Request_host_get_clock_service; __Request__kmod_get_info_t Request_kmod_get_info; __Request__host_virtual_physical_table_info_t Request_host_virtual_physical_table_info; @@ -911,9 +908,9 @@ union __RequestUnion__mach_host_subsystem { mach_msg_header_t Head; /* start of the kernel processed data */ mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t io_master; + mach_msg_port_descriptor_t io_main; /* end of the kernel processed data */ - } __Reply__host_get_io_master_t __attribute__((unused)); + } __Reply__host_get_io_main_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) #endif @@ -1232,7 +1229,7 @@ union __ReplyUnion__mach_host_subsystem { __Reply___host_page_size_t Reply__host_page_size; __Reply__mach_memory_object_memory_entry_t Reply_mach_memory_object_memory_entry; __Reply__host_processor_info_t Reply_host_processor_info; - __Reply__host_get_io_master_t Reply_host_get_io_master; + __Reply__host_get_io_main_t Reply_host_get_io_main; __Reply__host_get_clock_service_t Reply_host_get_clock_service; __Reply__kmod_get_info_t Reply_kmod_get_info; __Reply__host_virtual_physical_table_info_t Reply_host_virtual_physical_table_info; @@ -1264,7 +1261,7 @@ union __ReplyUnion__mach_host_subsystem { { "_host_page_size", 202 },\ { "mach_memory_object_memory_entry", 203 },\ { "host_processor_info", 204 },\ - { "host_get_io_master", 205 },\ + { "host_get_io_main", 205 },\ { "host_get_clock_service", 206 },\ { "kmod_get_info", 207 },\ { "host_virtual_physical_table_info", 209 },\ diff --git a/lib/libc/include/x86_64-macos.10-none/mach/sync_policy.h b/lib/libc/include/any-macos.13-any/mach/mach_interface.h similarity index 63% rename from lib/libc/include/x86_64-macos.10-none/mach/sync_policy.h rename to lib/libc/include/any-macos.13-any/mach/mach_interface.h index a4c477bf5d..3006004f44 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/sync_policy.h +++ b/lib/libc/include/any-macos.13-any/mach/mach_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -26,24 +26,27 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* - * @OSF_COPYRIGHT@ + * Copyright (C) Apple Computer 1998 + * ALL Rights Reserved */ - -#ifndef _MACH_SYNC_POLICY_H_ -#define _MACH_SYNC_POLICY_H_ - -typedef int sync_policy_t; - /* - * These options define the wait ordering of the synchronizers + * This file represents the interfaces that used to come + * from creating the user headers from the mach.defs file. + * Because mach.defs was decomposed, this file now just + * wraps up all the new interface headers generated from + * each of the new .defs resulting from that decomposition. */ -#define SYNC_POLICY_FIFO 0x0 -#define SYNC_POLICY_FIXED_PRIORITY 0x1 -#define SYNC_POLICY_REVERSED 0x2 -#define SYNC_POLICY_ORDER_MASK 0x3 -#define SYNC_POLICY_LIFO (SYNC_POLICY_FIFO|SYNC_POLICY_REVERSED) +#ifndef _MACH_INTERFACE_H_ +#define _MACH_INTERFACE_H_ +#include +#include +#include +#include +#include +#include +#include +#include +#include -#define SYNC_POLICY_MAX 0x7 - -#endif /* _MACH_SYNC_POLICY_H_ */ \ No newline at end of file +#endif /* _MACH_INTERFACE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mach_port.h b/lib/libc/include/any-macos.13-any/mach/mach_port.h similarity index 91% rename from lib/libc/include/x86_64-macos.10-none/mach/mach_port.h rename to lib/libc/include/any-macos.13-any/mach/mach_port.h index fcec114ccf..4220fad6b9 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/mach_port.h +++ b/lib/libc/include/any-macos.13-any/mach/mach_port.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t; #endif /* AUTOTEST */ #ifndef mach_port_MSG_COUNT -#define mach_port_MSG_COUNT 40 +#define mach_port_MSG_COUNT 43 #endif /* mach_port_MSG_COUNT */ +#include #include #include #include @@ -113,8 +117,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t mach_port_allocate_name ( ipc_space_t task, @@ -141,6 +144,9 @@ mig_external #else extern #endif /* mig_external */ +__API_DEPRECATED("Inherently unsafe API: instead manage rights with " + "mach_port_destruct(), mach_port_deallocate() or mach_port_mod_refs()", + macos(10.0, 12.0), ios(2.0, 15.0), tvos(9.0, 15.0), watchos(2.0, 8.0)) kern_return_t mach_port_destroy ( ipc_space_t task, @@ -226,7 +232,7 @@ extern #endif /* mig_external */ kern_return_t mach_port_get_set_status ( - ipc_space_inspect_t task, + ipc_space_read_t task, mach_port_name_t name, mach_port_name_array_t *members, mach_msg_type_number_t *membersCnt @@ -312,7 +318,7 @@ extern #endif /* mig_external */ kern_return_t mach_port_get_attributes ( - ipc_space_inspect_t task, + ipc_space_read_t task, mach_port_name_t name, mach_port_flavor_t flavor, mach_port_info_t port_info_out, @@ -369,8 +375,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_set_port_space ( ipc_space_t task, @@ -398,7 +403,7 @@ extern #endif /* mig_external */ kern_return_t mach_port_space_info ( - ipc_space_inspect_t task, + ipc_space_read_t space, ipc_info_space_t *space_info, ipc_info_name_array_t *table_info, mach_msg_type_number_t *table_infoCnt, @@ -428,7 +433,7 @@ extern #endif /* mig_external */ kern_return_t mach_port_kernel_object ( - ipc_space_inspect_t task, + ipc_space_read_t task, mach_port_name_t name, unsigned *object_type, unsigned *object_addr @@ -468,7 +473,7 @@ extern #endif /* mig_external */ kern_return_t mach_port_get_context ( - ipc_space_inspect_t task, + ipc_space_read_t task, mach_port_name_t name, mach_port_context_t *context ); @@ -494,7 +499,7 @@ extern #endif /* mig_external */ kern_return_t mach_port_kobject ( - ipc_space_inspect_t task, + ipc_space_read_t task, mach_port_name_t name, natural_t *object_type, mach_vm_address_t *object_addr @@ -603,13 +608,55 @@ extern #endif /* mig_external */ kern_return_t mach_port_kobject_description ( - ipc_space_inspect_t task, + ipc_space_read_t task, mach_port_name_t name, natural_t *object_type, mach_vm_address_t *object_addr, kobject_description_t description ); +/* Routine mach_port_is_connection_for_service */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t mach_port_is_connection_for_service +( + ipc_space_t task, + mach_port_name_t connection_port, + mach_port_name_t service_port, + uint64_t *filter_policy_id +); + +/* Routine mach_port_get_service_port_info */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t mach_port_get_service_port_info +( + ipc_space_read_t task, + mach_port_name_t name, + mach_service_port_info_data_t *sp_info_out +); + +/* Routine mach_port_assert_attributes */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t mach_port_assert_attributes +( + ipc_space_t task, + mach_port_name_t name, + mach_port_flavor_t flavor, + mach_port_info_t info, + mach_msg_type_number_t infoCnt +); + __END_DECLS /********************** Caution **************************/ @@ -1139,6 +1186,46 @@ __END_DECLS #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + mach_port_name_t connection_port; + mach_port_name_t service_port; + } __Request__mach_port_is_connection_for_service_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + mach_port_name_t name; + } __Request__mach_port_get_service_port_info_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + mach_port_name_t name; + mach_port_flavor_t flavor; + mach_msg_type_number_t infoCnt; + integer_t info[17]; + } __Request__mach_port_assert_attributes_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Request__mach_port_subsystem__defined */ /* union of all requests */ @@ -1185,6 +1272,9 @@ union __RequestUnion__mach_port_subsystem { __Request__mach_port_guard_with_flags_t Request_mach_port_guard_with_flags; __Request__mach_port_swap_guard_t Request_mach_port_swap_guard; __Request__mach_port_kobject_description_t Request_mach_port_kobject_description; + __Request__mach_port_is_connection_for_service_t Request_mach_port_is_connection_for_service; + __Request__mach_port_get_service_port_info_t Request_mach_port_get_service_port_info; + __Request__mach_port_assert_attributes_t Request_mach_port_assert_attributes; }; #endif /* !__RequestUnion__mach_port_subsystem__defined */ /* typedefs for all replies */ @@ -1709,6 +1799,44 @@ union __RequestUnion__mach_port_subsystem { #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + uint64_t filter_policy_id; + } __Reply__mach_port_is_connection_for_service_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_service_port_info_data_t sp_info_out; + } __Reply__mach_port_get_service_port_info_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__mach_port_assert_attributes_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Reply__mach_port_subsystem__defined */ /* union of all replies */ @@ -1755,6 +1883,9 @@ union __ReplyUnion__mach_port_subsystem { __Reply__mach_port_guard_with_flags_t Reply_mach_port_guard_with_flags; __Reply__mach_port_swap_guard_t Reply_mach_port_swap_guard; __Reply__mach_port_kobject_description_t Reply_mach_port_kobject_description; + __Reply__mach_port_is_connection_for_service_t Reply_mach_port_is_connection_for_service; + __Reply__mach_port_get_service_port_info_t Reply_mach_port_get_service_port_info; + __Reply__mach_port_assert_attributes_t Reply_mach_port_assert_attributes; }; #endif /* !__RequestUnion__mach_port_subsystem__defined */ @@ -1798,7 +1929,10 @@ union __ReplyUnion__mach_port_subsystem { { "mach_port_space_basic_info", 3235 },\ { "mach_port_guard_with_flags", 3237 },\ { "mach_port_swap_guard", 3238 },\ - { "mach_port_kobject_description", 3239 } + { "mach_port_kobject_description", 3239 },\ + { "mach_port_is_connection_for_service", 3240 },\ + { "mach_port_get_service_port_info", 3241 },\ + { "mach_port_assert_attributes", 3242 } #endif #ifdef __AfterMigUserHeader diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mach_types.h b/lib/libc/include/any-macos.13-any/mach/mach_types.h similarity index 82% rename from lib/libc/include/x86_64-macos.10-none/mach/mach_types.h rename to lib/libc/include/any-macos.13-any/mach/mach_types.h index 0c35705acf..ed1885d120 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/mach_types.h +++ b/lib/libc/include/any-macos.13-any/mach/mach_types.h @@ -117,12 +117,17 @@ */ typedef mach_port_t task_t; typedef mach_port_t task_name_t; +typedef mach_port_t task_policy_set_t; +typedef mach_port_t task_policy_get_t; typedef mach_port_t task_inspect_t; +typedef mach_port_t task_read_t; typedef mach_port_t task_suspension_token_t; typedef mach_port_t thread_t; typedef mach_port_t thread_act_t; typedef mach_port_t thread_inspect_t; +typedef mach_port_t thread_read_t; typedef mach_port_t ipc_space_t; +typedef mach_port_t ipc_space_read_t; typedef mach_port_t ipc_space_inspect_t; typedef mach_port_t coalition_t; typedef mach_port_t host_t; @@ -138,7 +143,10 @@ typedef mach_port_t alarm_t; typedef mach_port_t clock_serv_t; typedef mach_port_t clock_ctrl_t; typedef mach_port_t arcade_register_t; -typedef mach_port_t suid_cred_t; +typedef mach_port_t ipc_eventlink_t; +typedef mach_port_t eventlink_port_pair_t[2]; +typedef mach_port_t task_id_token_t; +typedef mach_port_t kcdata_object_t; /* @@ -157,8 +165,11 @@ typedef mach_port_t mem_entry_name_port_t; typedef mach_port_t exception_handler_t; typedef exception_handler_t *exception_handler_array_t; typedef mach_port_t vm_task_entry_t; -typedef mach_port_t io_master_t; +typedef mach_port_t io_main_t; typedef mach_port_t UNDServerRef; +typedef mach_port_t mach_eventlink_t; + +typedef ipc_info_port_t exception_handler_info_t; /* * Mig doesn't translate the components of an array. @@ -207,17 +218,19 @@ typedef exception_handler_t exception_port_t; typedef exception_handler_array_t exception_port_arrary_t; typedef char vfs_path_t[4096]; typedef char nspace_path_t[1024]; /* 1024 == PATH_MAX */ -typedef char suid_cred_path_t[1024]; -typedef uint32_t suid_cred_uid_t; +typedef char nspace_name_t[1024]; /* 1024 == PATH_MAX */ #define TASK_NULL ((task_t) 0) #define TASK_NAME_NULL ((task_name_t) 0) -#define TASK_INSPECT_NULL ((task_inspect_t) 0) +#define TASK_INSPECT_NULL ((task_inspect_t) 0) +#define TASK_READ_NULL ((task_read_t) 0) #define THREAD_NULL ((thread_t) 0) #define THREAD_INSPECT_NULL ((thread_inspect_t) 0) +#define THREAD_READ_NULL ((thread_read_t) 0) #define TID_NULL ((uint64_t) 0) #define THR_ACT_NULL ((thread_act_t) 0) #define IPC_SPACE_NULL ((ipc_space_t) 0) +#define IPC_SPACE_READ_NULL ((ipc_space_read_t) 0) #define IPC_SPACE_INSPECT_NULL ((ipc_space_inspect_t) 0) #define COALITION_NULL ((coalition_t) 0) #define HOST_NULL ((host_t) 0) @@ -232,10 +245,33 @@ typedef uint32_t suid_cred_uid_t; #define CLOCK_NULL ((clock_t) 0) #define UND_SERVER_NULL ((UNDServerRef) 0) #define ARCADE_REG_NULL ((arcade_register_t) 0) -#define SUID_CRED_NULL ((suid_cred_t) 0) +#define MACH_EVENTLINK_NULL ((mach_eventlink_t) 0) +#define IPC_EVENTLINK_NULL ((ipc_eventlink_t) 0) +#define TASK_ID_TOKEN_NULL ((task_id_token_t) 0) +#define KCDATA_OBJECT_NULL ((kcdata_object_t) 0) + +/* capability strictly _DECREASING_. + * not ordered the other way around because we want TASK_FLAVOR_CONTROL + * to be closest to the itk_lock. see task.h. + */ +typedef unsigned int mach_task_flavor_t; +#define TASK_FLAVOR_CONTROL 0 /* a task_t */ +#define TASK_FLAVOR_READ 1 /* a task_read_t */ +#define TASK_FLAVOR_INSPECT 2 /* a task_inspect_t */ +#define TASK_FLAVOR_NAME 3 /* a task_name_t */ + +#define TASK_FLAVOR_MAX TASK_FLAVOR_NAME + +/* capability strictly _DECREASING_ */ +typedef unsigned int mach_thread_flavor_t; +#define THREAD_FLAVOR_CONTROL 0 /* a thread_t */ +#define THREAD_FLAVOR_READ 1 /* a thread_read_t */ +#define THREAD_FLAVOR_INSPECT 2 /* a thread_inspect_t */ + +#define THREAD_FLAVOR_MAX THREAD_FLAVOR_INSPECT /* DEPRECATED */ -typedef natural_t ledger_item_t; +typedef natural_t ledger_item_t; #define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0)) typedef int64_t ledger_amount_t; diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mach_voucher_types.h b/lib/libc/include/any-macos.13-any/mach/mach_voucher_types.h similarity index 97% rename from lib/libc/include/x86_64-macos.10-none/mach/mach_voucher_types.h rename to lib/libc/include/any-macos.13-any/mach/mach_voucher_types.h index b5b34d7e4c..5a54f93633 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/mach_voucher_types.h +++ b/lib/libc/include/any-macos.13-any/mach/mach_voucher_types.h @@ -31,6 +31,7 @@ #include #include +#include /* * Mach Voucher - an immutable collection of attribute value handles. @@ -91,12 +92,14 @@ typedef mach_voucher_attr_key_t *mach_voucher_attr_key_array_t; #define MACH_VOUCHER_ATTR_KEY_ATM ((mach_voucher_attr_key_t)1) #define MACH_VOUCHER_ATTR_KEY_IMPORTANCE ((mach_voucher_attr_key_t)2) #define MACH_VOUCHER_ATTR_KEY_BANK ((mach_voucher_attr_key_t)3) -#define MACH_VOUCHER_ATTR_KEY_PTHPRIORITY ((mach_voucher_attr_key_t)4) +/* following keys have been removed from embedded platforms */ +#define MACH_VOUCHER_ATTR_KEY_PTHPRIORITY ((mach_voucher_attr_key_t)4) #define MACH_VOUCHER_ATTR_KEY_USER_DATA ((mach_voucher_attr_key_t)7) -#define MACH_VOUCHER_ATTR_KEY_BITS MACH_VOUCHER_ATTR_KEY_USER_DATA /* deprecated */ +#define MACH_VOUCHER_ATTR_KEY_BITS MACH_VOUCHER_ATTR_KEY_USER_DATA #define MACH_VOUCHER_ATTR_KEY_TEST ((mach_voucher_attr_key_t)8) +/* not used, for compatibility only */ #define MACH_VOUCHER_ATTR_KEY_NUM_WELL_KNOWN MACH_VOUCHER_ATTR_KEY_TEST /* @@ -212,7 +215,7 @@ typedef mach_port_t ipc_voucher_attr_control_t; * The private handle that the voucher attribute manager provides to * the mach voucher mechanism to represent a given attr content/value. */ -typedef uint64_t mach_voucher_attr_value_handle_t; +typedef uint64_t mach_voucher_attr_value_handle_t __kernel_ptr_semantics; typedef mach_voucher_attr_value_handle_t *mach_voucher_attr_value_handle_array_t; typedef mach_msg_type_number_t mach_voucher_attr_value_handle_array_size_t; diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine.h b/lib/libc/include/any-macos.13-any/mach/machine.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/mach/machine.h rename to lib/libc/include/any-macos.13-any/mach/machine.h index 30aafcc812..21f1b3892e 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine.h +++ b/lib/libc/include/any-macos.13-any/mach/machine.h @@ -118,6 +118,10 @@ typedef integer_t cpu_threadtype_t; #define CPU_TYPE_POWERPC ((cpu_type_t) 18) #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64) /* skip ((cpu_type_t) 19) */ +/* skip ((cpu_type_t) 20 */ +/* skip ((cpu_type_t) 21 */ +/* skip ((cpu_type_t) 22 */ +/* skip ((cpu_type_t) 23 */ /* * Machine subtypes (these are defined here, instead of in a machine @@ -130,7 +134,14 @@ typedef integer_t cpu_threadtype_t; */ #define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */ #define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */ +#define CPU_SUBTYPE_PTRAUTH_ABI 0x80000000 /* pointer authentication with versioned ABI */ +/* + * When selecting a slice, ANY will pick the slice with the best + * grading for the selected cpu_type_t, unlike the "ALL" subtypes, + * which are the slices that can run on any hardware for that cpu type. + */ +#define CPU_SUBTYPE_ANY ((cpu_subtype_t) -1) /* * Object files that are hand-crafted to run on any @@ -365,12 +376,8 @@ typedef integer_t cpu_threadtype_t; #define CPUFAMILY_INTEL_BROADWELL 0x582ed09c #define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f #define CPUFAMILY_INTEL_KABYLAKE 0x0f817246 -#if !defined(RC_HIDE_XNU_ICELAKE) #define CPUFAMILY_INTEL_ICELAKE 0x38435547 -#endif /* not RC_HIDE_XNU_ICELAKE */ -#if !defined(RC_HIDE_XNU_COMETLAKE) #define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e -#endif /* not RC_HIDE_XNU_COMETLAKE */ #define CPUFAMILY_ARM_9 0xe73283ae #define CPUFAMILY_ARM_11 0x8ff620d8 #define CPUFAMILY_ARM_XSCALE 0x53b005f5 @@ -386,6 +393,17 @@ typedef integer_t cpu_threadtype_t; #define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6 #define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f #define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2 +#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3 +#define CPUFAMILY_ARM_BLIZZARD_AVALANCHE 0xda33d83d +#define CPUFAMILY_ARM_EVEREST_SAWTOOTH 0x8765edea + +/* Described in rdar://64125549 */ +#define CPUSUBFAMILY_UNKNOWN 0 +#define CPUSUBFAMILY_ARM_HP 1 +#define CPUSUBFAMILY_ARM_HG 2 +#define CPUSUBFAMILY_ARM_M 3 +#define CPUSUBFAMILY_ARM_HS 4 +#define CPUSUBFAMILY_ARM_HC_HD 5 /* The following synonyms are deprecated: */ #define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN diff --git a/lib/libc/include/x86_64-macos.10-none/mach/message.h b/lib/libc/include/any-macos.13-any/mach/message.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/mach/message.h rename to lib/libc/include/any-macos.13-any/mach/message.h index 3f9f9a0605..a6e6e2e043 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/message.h +++ b/lib/libc/include/any-macos.13-any/mach/message.h @@ -228,6 +228,7 @@ typedef unsigned int mach_msg_priority_t; #define MACH_MSG_PRIORITY_UNSPECIFIED (mach_msg_priority_t) 0 + typedef unsigned int mach_msg_type_name_t; #define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive right */ @@ -277,16 +278,18 @@ typedef unsigned int mach_msg_descriptor_type_t; #define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3 #define MACH_MSG_GUARDED_PORT_DESCRIPTOR 4 +#define MACH_MSG_DESCRIPTOR_MAX MACH_MSG_GUARDED_PORT_DESCRIPTOR + #pragma pack(push, 4) -typedef struct{ +typedef struct { natural_t pad1; mach_msg_size_t pad2; unsigned int pad3 : 24; mach_msg_descriptor_type_t type : 8; } mach_msg_type_descriptor_t; -typedef struct{ +typedef struct { mach_port_t name; // Pad to 8 bytes everywhere except the K64 kernel where mach_port_t is 8 bytes mach_msg_size_t pad1; @@ -295,7 +298,8 @@ typedef struct{ mach_msg_descriptor_type_t type : 8; } mach_msg_port_descriptor_t; -typedef struct{ + +typedef struct { uint32_t address; mach_msg_size_t size; boolean_t deallocate: 8; @@ -304,7 +308,7 @@ typedef struct{ mach_msg_descriptor_type_t type: 8; } mach_msg_ool_descriptor32_t; -typedef struct{ +typedef struct { uint64_t address; boolean_t deallocate: 8; mach_msg_copy_options_t copy: 8; @@ -313,7 +317,7 @@ typedef struct{ mach_msg_size_t size; } mach_msg_ool_descriptor64_t; -typedef struct{ +typedef struct { void* address; #if !defined(__LP64__) mach_msg_size_t size; @@ -327,7 +331,7 @@ typedef struct{ #endif } mach_msg_ool_descriptor_t; -typedef struct{ +typedef struct { uint32_t address; mach_msg_size_t count; boolean_t deallocate: 8; @@ -336,7 +340,7 @@ typedef struct{ mach_msg_descriptor_type_t type : 8; } mach_msg_ool_ports_descriptor32_t; -typedef struct{ +typedef struct { uint64_t address; boolean_t deallocate: 8; mach_msg_copy_options_t copy: 8; @@ -345,7 +349,7 @@ typedef struct{ mach_msg_size_t count; } mach_msg_ool_ports_descriptor64_t; -typedef struct{ +typedef struct { void* address; #if !defined(__LP64__) mach_msg_size_t count; @@ -359,7 +363,7 @@ typedef struct{ #endif } mach_msg_ool_ports_descriptor_t; -typedef struct{ +typedef struct { uint32_t context; mach_port_name_t name; mach_msg_guard_flags_t flags : 16; @@ -367,7 +371,7 @@ typedef struct{ mach_msg_descriptor_type_t type : 8; } mach_msg_guarded_port_descriptor32_t; -typedef struct{ +typedef struct { uint64_t context; mach_msg_guard_flags_t flags : 16; mach_msg_type_name_t disposition : 8; @@ -375,7 +379,7 @@ typedef struct{ mach_port_name_t name; } mach_msg_guarded_port_descriptor64_t; -typedef struct{ +typedef struct { mach_port_context_t context; #if !defined(__LP64__) mach_port_name_t name; @@ -401,30 +405,32 @@ typedef union{ mach_msg_guarded_port_descriptor_t guarded_port; } mach_msg_descriptor_t; -typedef struct{ +typedef struct { mach_msg_size_t msgh_descriptor_count; } mach_msg_body_t; -#define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0 -#define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0 +#define MACH_MSG_BODY_NULL ((mach_msg_body_t *) 0) +#define MACH_MSG_DESCRIPTOR_NULL ((mach_msg_descriptor_t *) 0) -typedef struct{ - mach_msg_bits_t msgh_bits; - mach_msg_size_t msgh_size; - mach_port_t msgh_remote_port; - mach_port_t msgh_local_port; - mach_port_name_t msgh_voucher_port; - mach_msg_id_t msgh_id; +typedef struct { + mach_msg_bits_t msgh_bits; + mach_msg_size_t msgh_size; + mach_port_t msgh_remote_port; + mach_port_t msgh_local_port; + mach_port_name_t msgh_voucher_port; + mach_msg_id_t msgh_id; } mach_msg_header_t; -#define msgh_reserved msgh_voucher_port -#define MACH_MSG_NULL (mach_msg_header_t *) 0 -typedef struct{ - mach_msg_header_t header; - mach_msg_body_t body; +#define msgh_reserved msgh_voucher_port +#define MACH_MSG_NULL ((mach_msg_header_t *) 0) + +typedef struct { + mach_msg_header_t header; + mach_msg_body_t body; } mach_msg_base_t; + typedef unsigned int mach_msg_trailer_type_t; #define MACH_MSG_TRAILER_FORMAT_0 0 @@ -432,7 +438,7 @@ typedef unsigned int mach_msg_trailer_type_t; typedef unsigned int mach_msg_trailer_size_t; typedef char *mach_msg_trailer_info_t; -typedef struct{ +typedef struct { mach_msg_trailer_type_t msgh_trailer_type; mach_msg_trailer_size_t msgh_trailer_size; } mach_msg_trailer_t; @@ -446,17 +452,17 @@ typedef struct{ * multiple threads receive and/or process received * messages. */ -typedef struct{ +typedef struct { mach_msg_trailer_type_t msgh_trailer_type; mach_msg_trailer_size_t msgh_trailer_size; mach_port_seqno_t msgh_seqno; } mach_msg_seqno_trailer_t; -typedef struct{ +typedef struct { unsigned int val[2]; } security_token_t; -typedef struct{ +typedef struct { mach_msg_trailer_type_t msgh_trailer_type; mach_msg_trailer_size_t msgh_trailer_size; mach_port_seqno_t msgh_seqno; @@ -472,11 +478,11 @@ typedef struct{ * of the subject identity within the token may change * over time. */ -typedef struct{ +typedef struct { unsigned int val[8]; } audit_token_t; -typedef struct{ +typedef struct { mach_msg_trailer_type_t msgh_trailer_type; mach_msg_trailer_size_t msgh_trailer_size; mach_port_seqno_t msgh_seqno; @@ -484,7 +490,7 @@ typedef struct{ audit_token_t msgh_audit; } mach_msg_audit_trailer_t; -typedef struct{ +typedef struct { mach_msg_trailer_type_t msgh_trailer_type; mach_msg_trailer_size_t msgh_trailer_size; mach_port_seqno_t msgh_seqno; @@ -495,23 +501,26 @@ typedef struct{ -typedef struct{ +typedef struct { mach_port_name_t sender; } msg_labels_t; +typedef int mach_msg_filter_id; +#define MACH_MSG_FILTER_POLICY_ALLOW (mach_msg_filter_id)0 + /* * Trailer type to pass MAC policy label info as a mach message trailer. * */ -typedef struct{ +typedef struct { mach_msg_trailer_type_t msgh_trailer_type; mach_msg_trailer_size_t msgh_trailer_size; mach_port_seqno_t msgh_seqno; security_token_t msgh_sender; audit_token_t msgh_audit; mach_port_context_t msgh_context; - int msgh_ad; + mach_msg_filter_id msgh_ad; msg_labels_t msgh_labels; } mach_msg_mac_trailer_t; @@ -553,11 +562,13 @@ extern const audit_token_t KERNEL_AUDIT_TOKEN; typedef integer_t mach_msg_options_t; -typedef struct{ +#define MACH_MSG_HEADER_EMPTY (mach_msg_header_t){ } + +typedef struct { mach_msg_header_t header; } mach_msg_empty_send_t; -typedef struct{ +typedef struct { mach_msg_header_t header; mach_msg_trailer_t trailer; } mach_msg_empty_rcv_t; @@ -658,11 +669,12 @@ typedef integer_t mach_msg_option_t; #define MACH_SEND_INTERRUPT 0x00000040 /* don't restart interrupted sends */ #define MACH_SEND_NOTIFY 0x00000080 /* arm send-possible notify */ #define MACH_SEND_ALWAYS 0x00010000 /* ignore qlimits - kernel only */ +#define MACH_SEND_FILTER_NONFATAL 0x00010000 /* rejection by message filter should return failure - user only */ #define MACH_SEND_TRAILER 0x00020000 /* sender-provided trailer */ #define MACH_SEND_NOIMPORTANCE 0x00040000 /* msg won't carry importance */ #define MACH_SEND_NODENAP MACH_SEND_NOIMPORTANCE #define MACH_SEND_IMPORTANCE 0x00080000 /* msg carries importance - kernel only */ -#define MACH_SEND_SYNC_OVERRIDE 0x00100000 /* msg should do sync ipc override */ +#define MACH_SEND_SYNC_OVERRIDE 0x00100000 /* msg should do sync IPC override (on legacy kernels) */ #define MACH_SEND_PROPAGATE_QOS 0x00200000 /* IPC should propagate the caller's QoS */ #define MACH_SEND_SYNC_USE_THRPRI MACH_SEND_PROPAGATE_QOS /* obsolete name */ #define MACH_SEND_KERNEL 0x00400000 /* full send from kernel space - kernel only */ @@ -795,10 +807,18 @@ typedef kern_return_t mach_msg_return_t; /* The trailer to be sent does not match kernel format. */ #define MACH_SEND_INVALID_CONTEXT 0x10000012 /* The sending thread context did not match the context on the dest port */ +#define MACH_SEND_INVALID_OPTIONS 0x10000013 +/* Send options are invalid. */ #define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015 /* compatibility: no longer a returned error */ #define MACH_SEND_NO_GRANT_DEST 0x10000016 /* The destination port doesn't accept ports in body */ +#define MACH_SEND_MSG_FILTERED 0x10000017 +/* Message send was rejected by message filter */ +#define MACH_SEND_AUX_TOO_SMALL 0x10000018 +/* Message auxiliary data is too small */ +#define MACH_SEND_AUX_TOO_LARGE 0x10000019 +/* Message auxiliary data is too large */ #define MACH_RCV_IN_PROGRESS 0x10004001 /* Thread is waiting for receive. (Internal use only.) */ @@ -834,6 +854,8 @@ typedef kern_return_t mach_msg_return_t; /* Waiting for receive with timeout. (Internal use only.) */ #define MACH_RCV_INVALID_REPLY 0x10004012 /* invalid reply port used in a STRICT_REPLY message */ +#define MACH_RCV_INVALID_ARGUMENTS 0x10004013 +/* invalid receive arguments, receive has not started */ @@ -886,11 +908,12 @@ extern mach_msg_return_t mach_msg( mach_msg_timeout_t timeout, mach_port_name_t notify); + /* - * Routine: mach_voucher_deallocate - * Purpose: - * Deallocate a mach voucher created or received in a message. Drops - * one (send right) reference to the voucher. + * Routine: mach_voucher_deallocate + * Purpose: + * Deallocate a mach voucher created or received in a message. Drops + * one (send right) reference to the voucher. */ __WATCHOS_PROHIBITED __TVOS_PROHIBITED extern kern_return_t mach_voucher_deallocate( diff --git a/lib/libc/include/x86_64-macos.10-none/mach/port.h b/lib/libc/include/any-macos.13-any/mach/port.h similarity index 80% rename from lib/libc/include/x86_64-macos.10-none/mach/port.h rename to lib/libc/include/any-macos.13-any/mach/port.h index 3547576e80..effc74aba4 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/port.h +++ b/lib/libc/include/any-macos.13-any/mach/port.h @@ -211,7 +211,6 @@ typedef mach_port_type_t *mach_port_type_array_t; #define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */ - /* Convenient combinations. */ #define MACH_PORT_TYPE_SEND_RECEIVE \ @@ -293,9 +292,13 @@ typedef struct mach_port_info_ext { uint32_t reserved[6]; } mach_port_info_ext_t; +typedef struct mach_port_guard_info { + uint64_t mpgi_guard; /* guard value */ +} mach_port_guard_info_t; + typedef integer_t *mach_port_info_t; /* varying array of natural_t */ -/* Flavors for mach_port_get/set_attributes() */ +/* Flavors for mach_port_get/set/assert_attributes() */ typedef int mach_port_flavor_t; #define MACH_PORT_LIMITS_INFO 1 /* uses mach_port_limits_t */ #define MACH_PORT_RECEIVE_STATUS 2 /* uses mach_port_status_t */ @@ -304,6 +307,7 @@ typedef int mach_port_flavor_t; #define MACH_PORT_IMPORTANCE_RECEIVER 5 /* indicates recieve right accepts priority donation */ #define MACH_PORT_DENAP_RECEIVER 6 /* indicates receive right accepts de-nap donation */ #define MACH_PORT_INFO_EXT 7 /* uses mach_port_info_ext_t */ +#define MACH_PORT_GUARD_INFO 8 /* asserts if the strict guard value is correct */ #define MACH_PORT_LIMITS_INFO_COUNT ((natural_t) \ (sizeof(mach_port_limits_t)/sizeof(natural_t))) @@ -312,6 +316,9 @@ typedef int mach_port_flavor_t; #define MACH_PORT_DNREQUESTS_SIZE_COUNT 1 #define MACH_PORT_INFO_EXT_COUNT ((natural_t) \ (sizeof(mach_port_info_ext_t)/sizeof(natural_t))) +#define MACH_PORT_GUARD_INFO_COUNT ((natural_t) \ + (sizeof(mach_port_guard_info_t)/sizeof(natural_t))) + /* * Structure used to pass information about port allocation requests. * Must be padded to 64-bits total length. @@ -323,7 +330,20 @@ typedef struct mach_port_qos { natural_t len; } mach_port_qos_t; -/* Mach Port Guarding definitions */ +/* + * Structure used to pass information about the service port + */ +#define MACH_SERVICE_PORT_INFO_STRING_NAME_MAX_BUF_LEN 255 /* Maximum length of the port string name buffer */ + +typedef struct mach_service_port_info { + char mspi_string_name[MACH_SERVICE_PORT_INFO_STRING_NAME_MAX_BUF_LEN]; /* Service port's string name */ + uint8_t mspi_domain_type; /* Service port domain */ +} mach_service_port_info_data_t; + +#define MACH_SERVICE_PORT_INFO_COUNT ((char) \ + (sizeof(mach_service_port_info_data_t)/sizeof(char))) + +typedef struct mach_service_port_info * mach_service_port_info_t; /* * Flags for mach_port_options (used for @@ -331,14 +351,23 @@ typedef struct mach_port_qos { * Indicates attributes to be set for the newly * allocated port. */ -#define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */ -#define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */ -#define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */ -#define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */ -#define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */ -#define MPO_STRICT 0x20 /* Apply strict guarding for port */ -#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */ -#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */ +#define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */ +#define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */ +#define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */ +#define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */ +#define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */ +#define MPO_STRICT 0x20 /* Apply strict guarding for port */ +#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */ +#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */ +#define MPO_FILTER_MSG 0x100 /* Allow message filtering */ +#define MPO_TG_BLOCK_TRACKING 0x200 /* Track blocking relationship for thread group during sync IPC */ +#define MPO_SERVICE_PORT 0x400 /* Create a service port with the given name; should be used only by launchd */ +#define MPO_CONNECTION_PORT 0x800 /* Derive new peer connection port from a given service port */ +#define MPO_REPLY_PORT 0x1000 /* Designate port as a reply port. */ +#define MPO_ENFORCE_REPLY_PORT_SEMANTICS 0x2000 /* When talking to this port, local port of mach msg needs to follow reply port semantics.*/ +#define MPO_PROVISIONAL_REPLY_PORT 0x4000 /* Designate port as a provisional reply port. */ + + /* * Structure to define optional attributes for a newly * constructed port. @@ -346,11 +375,18 @@ typedef struct mach_port_qos { typedef struct mach_port_options { uint32_t flags; /* Flags defining attributes for port */ mach_port_limits_t mpl; /* Message queue limit for port */ - uint64_t reserved[2]; /* Reserved */ + union { + uint64_t reserved[2]; /* Reserved */ + mach_port_name_t work_interval_port; /* Work interval port */ + mach_service_port_info_t service_port_info; /* Service port (MPO_SERVICE_PORT) */ + mach_port_name_t service_port_name; /* Service port (MPO_CONNECTION_PORT) */ + }; }mach_port_options_t; typedef mach_port_options_t *mach_port_options_ptr_t; +/* Mach Port Guarding definitions */ + /* * EXC_GUARD represents a guard violation for both * mach ports and file descriptors. GUARD_TYPE_ is used @@ -360,13 +396,15 @@ typedef mach_port_options_t *mach_port_options_ptr_t; /* Reasons for exception for a guarded mach port */ enum mach_port_guard_exception_codes { - kGUARD_EXC_DESTROY = 1u << 0, - kGUARD_EXC_MOD_REFS = 1u << 1, - kGUARD_EXC_SET_CONTEXT = 1u << 2, + kGUARD_EXC_DESTROY = 1, + kGUARD_EXC_MOD_REFS = 2, + kGUARD_EXC_INVALID_OPTIONS = 3, + kGUARD_EXC_SET_CONTEXT = 4, kGUARD_EXC_UNGUARDED = 1u << 3, kGUARD_EXC_INCORRECT_GUARD = 1u << 4, kGUARD_EXC_IMMOVABLE = 1u << 5, kGUARD_EXC_STRICT_REPLY = 1u << 6, + kGUARD_EXC_MSG_FILTERED = 1u << 7, /* start of [optionally] non-fatal guards */ kGUARD_EXC_INVALID_RIGHT = 1u << 8, kGUARD_EXC_INVALID_NAME = 1u << 9, @@ -380,10 +418,21 @@ enum mach_port_guard_exception_codes { kGUARD_EXC_SEND_INVALID_VOUCHER = 1u << 17, kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18, kGUARD_EXC_RCV_INVALID_NAME = 1u << 19, - kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */ + /* start of always non-fatal guards */ + kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* for development only */ + kGUARD_EXC_MOD_REFS_NON_FATAL = 1u << 21, + kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22, + kGUARD_EXC_REQUIRE_REPLY_PORT_SEMANTICS = 1u << 23, }; -#define MAX_FATAL_kGUARD_EXC_CODE (1u << 6) +#define MAX_FATAL_kGUARD_EXC_CODE (1u << 7) + +/* + * Mach port guard flags. + */ +#define MPG_FLAGS_NONE (0x00ull) + +#define MAX_OPTIONAL_kGUARD_EXC_CODE (1u << 19) /* * These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions. @@ -395,6 +444,18 @@ enum mach_port_guard_exception_codes { #define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56) #define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56) +/* + * These flags are used as bits in the subcode of kGUARD_EXC_MOD_REFS exceptions. + */ +#define MPG_FLAGS_MOD_REFS_PINNED_DEALLOC (0x01ull << 56) +#define MPG_FLAGS_MOD_REFS_PINNED_DESTROY (0x02ull << 56) +#define MPG_FLAGS_MOD_REFS_PINNED_COPYIN (0x04ull << 56) + +/* + * These flags are used as bits in the subcode of kGUARD_EXC_IMMOVABLE exceptions. + */ +#define MPG_FLAGS_IMMOVABLE_PINNED (0x01ull << 56) + /* * Flags for mach_port_guard_with_flags. These flags extend * the attributes associated with a guarded port. diff --git a/lib/libc/include/x86_64-macos.10-none/mach/processor.h b/lib/libc/include/any-macos.13-any/mach/processor.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/mach/processor.h rename to lib/libc/include/any-macos.13-any/mach/processor.h index 64cf6b97b3..054f258910 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/processor.h +++ b/lib/libc/include/any-macos.13-any/mach/processor.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t; #define processor_MSG_COUNT 6 #endif /* processor_MSG_COUNT */ +#include #include #include #include diff --git a/lib/libc/include/any-macos.13-any/mach/processor_info.h b/lib/libc/include/any-macos.13-any/mach/processor_info.h new file mode 100644 index 0000000000..31bc0e8929 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/mach/processor_info.h @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * @OSF_COPYRIGHT@ + */ +/* + * Mach Operating System + * Copyright (c) 1991,1990,1989 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + */ + +/* + * File: mach/processor_info.h + * Author: David L. Black + * Date: 1988 + * + * Data structure definitions for processor_info, processor_set_info + */ + +#ifndef _MACH_PROCESSOR_INFO_H_ +#define _MACH_PROCESSOR_INFO_H_ + +#include +#include +#include + +/* + * Generic information structure to allow for expansion. + */ +typedef integer_t *processor_info_t; /* varying array of int. */ +typedef integer_t *processor_info_array_t; /* varying array of int */ + +#define PROCESSOR_INFO_MAX (1024) /* max array size */ +typedef integer_t processor_info_data_t[PROCESSOR_INFO_MAX]; + + +typedef integer_t *processor_set_info_t; /* varying array of int. */ + +#define PROCESSOR_SET_INFO_MAX (1024) /* max array size */ +typedef integer_t processor_set_info_data_t[PROCESSOR_SET_INFO_MAX]; + +/* + * Currently defined information. + */ +typedef int processor_flavor_t; +#define PROCESSOR_BASIC_INFO 1 /* basic information */ +#define PROCESSOR_CPU_LOAD_INFO 2 /* cpu load information */ +#define PROCESSOR_PM_REGS_INFO 0x10000001 /* performance monitor register info */ +#define PROCESSOR_TEMPERATURE 0x10000002 /* Processor core temperature */ + +struct processor_basic_info { + cpu_type_t cpu_type; /* type of cpu */ + cpu_subtype_t cpu_subtype; /* subtype of cpu */ + boolean_t running; /* is processor running */ + int slot_num; /* slot number */ + union { + boolean_t is_master; /* deprecated */ + boolean_t is_main; /* is this the main processor */ + }; +}; + +typedef struct processor_basic_info processor_basic_info_data_t; +typedef struct processor_basic_info *processor_basic_info_t; +#define PROCESSOR_BASIC_INFO_COUNT ((mach_msg_type_number_t) \ + (sizeof(processor_basic_info_data_t)/sizeof(natural_t))) + +struct processor_cpu_load_info { /* number of ticks while running... */ + unsigned int cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */ +}; + +typedef struct processor_cpu_load_info processor_cpu_load_info_data_t; +typedef struct processor_cpu_load_info *processor_cpu_load_info_t; +#define PROCESSOR_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \ + (sizeof(processor_cpu_load_info_data_t)/sizeof(natural_t))) + +/* + * Scaling factor for load_average, mach_factor. + */ +#define LOAD_SCALE 1000 + +typedef int processor_set_flavor_t; +#define PROCESSOR_SET_BASIC_INFO 5 /* basic information */ + +struct processor_set_basic_info { + int processor_count; /* How many processors */ + int default_policy; /* When others not enabled */ +}; + +typedef struct processor_set_basic_info processor_set_basic_info_data_t; +typedef struct processor_set_basic_info *processor_set_basic_info_t; +#define PROCESSOR_SET_BASIC_INFO_COUNT ((mach_msg_type_number_t) \ + (sizeof(processor_set_basic_info_data_t)/sizeof(natural_t))) + +#define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */ + +struct processor_set_load_info { + int task_count; /* How many tasks */ + int thread_count; /* How many threads */ + integer_t load_average; /* Scaled */ + integer_t mach_factor; /* Scaled */ +}; + +typedef struct processor_set_load_info processor_set_load_info_data_t; +typedef struct processor_set_load_info *processor_set_load_info_t; +#define PROCESSOR_SET_LOAD_INFO_COUNT ((mach_msg_type_number_t) \ + (sizeof(processor_set_load_info_data_t)/sizeof(natural_t))) + + +#endif /* _MACH_PROCESSOR_INFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/processor_set.h b/lib/libc/include/any-macos.13-any/mach/processor_set.h similarity index 89% rename from lib/libc/include/x86_64-macos.10-none/mach/processor_set.h rename to lib/libc/include/any-macos.13-any/mach/processor_set.h index c7637d1f19..49fcfbd233 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/processor_set.h +++ b/lib/libc/include/any-macos.13-any/mach/processor_set.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t; #endif /* AUTOTEST */ #ifndef processor_set_MSG_COUNT -#define processor_set_MSG_COUNT 10 +#define processor_set_MSG_COUNT 11 #endif /* processor_set_MSG_COUNT */ +#include #include #include #include @@ -200,6 +204,20 @@ kern_return_t processor_set_info mach_msg_type_number_t *info_outCnt ); +/* Routine processor_set_tasks_with_flavor */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t processor_set_tasks_with_flavor +( + processor_set_t processor_set, + mach_task_flavor_t flavor, + task_array_t *task_list, + mach_msg_type_number_t *task_listCnt +); + __END_DECLS /********************** Caution **************************/ @@ -336,6 +354,18 @@ __END_DECLS #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + mach_task_flavor_t flavor; + } __Request__processor_set_tasks_with_flavor_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Request__processor_set_subsystem__defined */ /* union of all requests */ @@ -353,6 +383,7 @@ union __RequestUnion__processor_set_subsystem { __Request__processor_set_policy_control_t Request_processor_set_policy_control; __Request__processor_set_stack_usage_t Request_processor_set_stack_usage; __Request__processor_set_info_t Request_processor_set_info; + __Request__processor_set_tasks_with_flavor_t Request_processor_set_tasks_with_flavor; }; #endif /* !__RequestUnion__processor_set_subsystem__defined */ /* typedefs for all replies */ @@ -499,6 +530,22 @@ union __RequestUnion__processor_set_subsystem { #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_ports_descriptor_t task_list; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t task_listCnt; + } __Reply__processor_set_tasks_with_flavor_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Reply__processor_set_subsystem__defined */ /* union of all replies */ @@ -516,6 +563,7 @@ union __ReplyUnion__processor_set_subsystem { __Reply__processor_set_policy_control_t Reply_processor_set_policy_control; __Reply__processor_set_stack_usage_t Reply_processor_set_stack_usage; __Reply__processor_set_info_t Reply_processor_set_info; + __Reply__processor_set_tasks_with_flavor_t Reply_processor_set_tasks_with_flavor; }; #endif /* !__RequestUnion__processor_set_subsystem__defined */ @@ -530,7 +578,8 @@ union __ReplyUnion__processor_set_subsystem { { "processor_set_threads", 4006 },\ { "processor_set_policy_control", 4007 },\ { "processor_set_stack_usage", 4008 },\ - { "processor_set_info", 4009 } + { "processor_set_info", 4009 },\ + { "processor_set_tasks_with_flavor", 4010 } #endif #ifdef __AfterMigUserHeader diff --git a/lib/libc/include/x86_64-macos.10-none/mach/task.h b/lib/libc/include/any-macos.13-any/mach/task.h similarity index 83% rename from lib/libc/include/x86_64-macos.10-none/mach/task.h rename to lib/libc/include/any-macos.13-any/mach/task.h index 5f0de2dcd5..2fd8ea9876 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/task.h +++ b/lib/libc/include/any-macos.13-any/mach/task.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t; #endif /* AUTOTEST */ #ifndef task_MSG_COUNT -#define task_MSG_COUNT 55 +#define task_MSG_COUNT 65 #endif /* task_MSG_COUNT */ +#include #include #include #include @@ -111,8 +115,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t mach_ports_register ( task_t target_task, @@ -126,8 +129,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t mach_ports_lookup ( task_t target_task, @@ -155,8 +157,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_set_info ( task_t target_task, @@ -171,11 +172,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_suspend ( - task_t target_task + task_read_t target_task ); /* Routine task_resume */ @@ -184,11 +184,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_resume ( - task_t target_task + task_read_t target_task ); /* Routine task_get_special_port */ @@ -197,8 +196,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_get_special_port ( task_inspect_t task, @@ -212,8 +210,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_set_special_port ( task_t task, @@ -227,8 +224,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_create ( task_t parent_task, @@ -241,8 +237,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_create_running ( task_t parent_task, @@ -258,8 +253,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_set_exception_ports ( task_t task, @@ -275,11 +269,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_get_exception_ports ( - task_inspect_t task, + task_t task, exception_mask_t exception_mask, exception_mask_array_t masks, mach_msg_type_number_t *masksCnt, @@ -294,8 +287,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_swap_exception_ports ( task_t task, @@ -305,7 +297,7 @@ kern_return_t task_swap_exception_ports thread_state_flavor_t new_flavor, exception_mask_array_t masks, mach_msg_type_number_t *masksCnt, - exception_handler_array_t old_handlerss, + exception_handler_array_t old_handlers, exception_behavior_array_t old_behaviors, exception_flavor_array_t old_flavors ); @@ -368,11 +360,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_policy_set ( - task_t task, + task_policy_set_t task, task_policy_flavor_t flavor, task_policy_t policy_info, mach_msg_type_number_t policy_infoCnt @@ -384,11 +375,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_policy_get ( - task_t task, + task_policy_get_t task, task_policy_flavor_t flavor, task_policy_t policy_info, mach_msg_type_number_t *policy_infoCnt, @@ -483,11 +473,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_zone_info ( - task_t target_task, + task_inspect_t target_task, mach_zone_name_array_t *names, mach_msg_type_number_t *namesCnt, task_zone_info_array_t *info, @@ -527,7 +516,7 @@ extern #endif /* mig_external */ kern_return_t task_get_assignment ( - task_t task, + task_inspect_t task, processor_set_name_t *assigned_set ); @@ -555,11 +544,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_get_state ( - task_t task, + task_read_t task, thread_state_flavor_t flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt @@ -571,8 +559,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_set_state ( task_t task, @@ -587,8 +574,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_set_phys_footprint_limit ( task_t task, @@ -602,11 +588,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_suspend2 ( - task_t target_task, + task_read_t target_task, task_suspension_token_t *suspend_token ); @@ -616,8 +601,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_resume2 ( task_suspension_token_t suspend_token @@ -631,7 +615,7 @@ extern #endif /* mig_external */ kern_return_t task_purgable_info ( - task_t task, + task_inspect_t task, task_purgable_info_t *stats ); @@ -641,11 +625,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_get_mach_voucher ( - task_t task, + task_read_t task, mach_voucher_selector_t which, ipc_voucher_t *voucher ); @@ -656,8 +639,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_set_mach_voucher ( task_t task, @@ -670,8 +652,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_swap_mach_voucher ( task_t task, @@ -687,7 +668,7 @@ extern #endif /* mig_external */ kern_return_t task_generate_corpse ( - task_t task, + task_read_t task, mach_port_t *corpse_task_port ); @@ -700,7 +681,7 @@ extern kern_return_t task_map_corpse_info ( task_t task, - task_t corspe_task, + task_read_t corspe_task, vm_address_t *kcd_addr_begin, uint32_t *kcd_size ); @@ -739,7 +720,7 @@ extern #endif /* mig_external */ kern_return_t task_get_dyld_image_infos ( - task_inspect_t task, + task_read_t task, dyld_kernel_image_info_array_t *dyld_images, mach_msg_type_number_t *dyld_imagesCnt ); @@ -791,7 +772,7 @@ extern kern_return_t task_map_corpse_info_64 ( task_t task, - task_t corspe_task, + task_read_t corspe_task, mach_vm_address_t *kcd_addr_begin, mach_vm_size_t *kcd_size ); @@ -834,18 +815,122 @@ kern_return_t task_set_exc_guard_behavior task_exc_guard_behavior_t behavior ); -/* Routine task_create_suid_cred */ +/* Routine task_dyld_process_info_notify_register */ #ifdef mig_external mig_external #else extern #endif /* mig_external */ -kern_return_t task_create_suid_cred +kern_return_t task_dyld_process_info_notify_register +( + task_read_t target_task, + mach_port_t notify +); + +/* Routine task_create_identity_token */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_create_identity_token ( task_t task, - suid_cred_path_t path, - suid_cred_uid_t uid, - suid_cred_t *delegation + task_id_token_t *token +); + +/* Routine task_identity_token_get_task_port */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_identity_token_get_task_port +( + task_id_token_t token, + task_flavor_t flavor, + mach_port_t *task_port +); + +/* Routine task_dyld_process_info_notify_deregister */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_dyld_process_info_notify_deregister +( + task_read_t target_task, + mach_port_name_t notify +); + +/* Routine task_get_exception_ports_info */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_get_exception_ports_info +( + mach_port_t port, + exception_mask_t exception_mask, + exception_mask_array_t masks, + mach_msg_type_number_t *masksCnt, + exception_handler_info_array_t old_handlers_info, + exception_behavior_array_t old_behaviors, + exception_flavor_array_t old_flavors +); + +/* Routine task_test_sync_upcall */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_test_sync_upcall +( + task_t task, + mach_port_t port +); + +/* Routine task_set_corpse_forking_behavior */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_set_corpse_forking_behavior +( + task_t task, + task_corpse_forking_behavior_t behavior +); + +/* Routine task_test_async_upcall_propagation */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_test_async_upcall_propagation +( + task_t task, + mach_port_t port, + int qos, + int iotier +); + +/* Routine task_map_kcdata_object_64 */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t task_map_kcdata_object_64 +( + task_t task, + kcdata_object_t kcdata_object, + mach_vm_address_t *kcd_addr_begin, + mach_vm_size_t *kcd_size ); __END_DECLS @@ -950,7 +1035,7 @@ __END_DECLS NDR_record_t NDR; task_flavor_t flavor; mach_msg_type_number_t task_info_inCnt; - integer_t task_info_in[87]; + integer_t task_info_in[90]; } __Request__task_set_info_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -1022,7 +1107,7 @@ __END_DECLS NDR_record_t NDR; thread_state_flavor_t flavor; mach_msg_type_number_t new_stateCnt; - natural_t new_state[614]; + natural_t new_state[1296]; } __Request__thread_create_running_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -1331,7 +1416,7 @@ __END_DECLS NDR_record_t NDR; thread_state_flavor_t flavor; mach_msg_type_number_t new_stateCnt; - natural_t new_state[614]; + natural_t new_state[1296]; } __Request__task_set_state_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -1572,17 +1657,119 @@ __END_DECLS #pragma pack(pop) #endif +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t notify; + /* end of the kernel processed data */ + } __Request__task_dyld_process_info_notify_register_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__task_create_identity_token_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + #ifdef __MigPackStructs #pragma pack(push, 4) #endif typedef struct { mach_msg_header_t Head; NDR_record_t NDR; - mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ - mach_msg_type_number_t pathCnt; - char path[1024]; - suid_cred_uid_t uid; - } __Request__task_create_suid_cred_t __attribute__((unused)); + task_flavor_t flavor; + } __Request__task_identity_token_get_task_port_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + mach_port_name_t notify; + } __Request__task_dyld_process_info_notify_deregister_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + exception_mask_t exception_mask; + } __Request__task_get_exception_ports_info_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t port; + /* end of the kernel processed data */ + } __Request__task_test_sync_upcall_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + task_corpse_forking_behavior_t behavior; + } __Request__task_set_corpse_forking_behavior_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t port; + /* end of the kernel processed data */ + NDR_record_t NDR; + int qos; + int iotier; + } __Request__task_test_async_upcall_propagation_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t kcdata_object; + /* end of the kernel processed data */ + } __Request__task_map_kcdata_object_64_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) #endif @@ -1647,7 +1834,15 @@ union __RequestUnion__task_subsystem { __Request__task_inspect_t Request_task_inspect; __Request__task_get_exc_guard_behavior_t Request_task_get_exc_guard_behavior; __Request__task_set_exc_guard_behavior_t Request_task_set_exc_guard_behavior; - __Request__task_create_suid_cred_t Request_task_create_suid_cred; + __Request__task_dyld_process_info_notify_register_t Request_task_dyld_process_info_notify_register; + __Request__task_create_identity_token_t Request_task_create_identity_token; + __Request__task_identity_token_get_task_port_t Request_task_identity_token_get_task_port; + __Request__task_dyld_process_info_notify_deregister_t Request_task_dyld_process_info_notify_deregister; + __Request__task_get_exception_ports_info_t Request_task_get_exception_ports_info; + __Request__task_test_sync_upcall_t Request_task_test_sync_upcall; + __Request__task_set_corpse_forking_behavior_t Request_task_set_corpse_forking_behavior; + __Request__task_test_async_upcall_propagation_t Request_task_test_async_upcall_propagation; + __Request__task_map_kcdata_object_64_t Request_task_map_kcdata_object_64; }; #endif /* !__RequestUnion__task_subsystem__defined */ /* typedefs for all replies */ @@ -1733,7 +1928,7 @@ union __RequestUnion__task_subsystem { NDR_record_t NDR; kern_return_t RetCode; mach_msg_type_number_t task_info_outCnt; - integer_t task_info_out[87]; + integer_t task_info_out[90]; } __Reply__task_info_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -1867,7 +2062,7 @@ union __RequestUnion__task_subsystem { mach_msg_header_t Head; /* start of the kernel processed data */ mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t old_handlerss[32]; + mach_msg_port_descriptor_t old_handlers[32]; /* end of the kernel processed data */ NDR_record_t NDR; mach_msg_type_number_t masksCnt; @@ -2111,7 +2306,7 @@ union __RequestUnion__task_subsystem { NDR_record_t NDR; kern_return_t RetCode; mach_msg_type_number_t old_stateCnt; - natural_t old_state[614]; + natural_t old_state[1296]; } __Reply__task_get_state_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -2379,6 +2574,18 @@ union __RequestUnion__task_subsystem { #pragma pack(pop) #endif +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__task_dyld_process_info_notify_register_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + #ifdef __MigPackStructs #pragma pack(push, 4) #endif @@ -2386,9 +2593,102 @@ union __RequestUnion__task_subsystem { mach_msg_header_t Head; /* start of the kernel processed data */ mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t delegation; + mach_msg_port_descriptor_t token; /* end of the kernel processed data */ - } __Reply__task_create_suid_cred_t __attribute__((unused)); + } __Reply__task_create_identity_token_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t task_port; + /* end of the kernel processed data */ + } __Reply__task_identity_token_get_task_port_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__task_dyld_process_info_notify_deregister_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_type_number_t masksCnt; + exception_mask_t masks[32]; + exception_handler_info_t old_handlers_info[32]; + exception_behavior_t old_behaviors[32]; + thread_state_flavor_t old_flavors[32]; + } __Reply__task_get_exception_ports_info_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__task_test_sync_upcall_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__task_set_corpse_forking_behavior_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__task_test_async_upcall_propagation_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_vm_address_t kcd_addr_begin; + mach_vm_size_t kcd_size; + } __Reply__task_map_kcdata_object_64_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) #endif @@ -2453,7 +2753,15 @@ union __ReplyUnion__task_subsystem { __Reply__task_inspect_t Reply_task_inspect; __Reply__task_get_exc_guard_behavior_t Reply_task_get_exc_guard_behavior; __Reply__task_set_exc_guard_behavior_t Reply_task_set_exc_guard_behavior; - __Reply__task_create_suid_cred_t Reply_task_create_suid_cred; + __Reply__task_dyld_process_info_notify_register_t Reply_task_dyld_process_info_notify_register; + __Reply__task_create_identity_token_t Reply_task_create_identity_token; + __Reply__task_identity_token_get_task_port_t Reply_task_identity_token_get_task_port; + __Reply__task_dyld_process_info_notify_deregister_t Reply_task_dyld_process_info_notify_deregister; + __Reply__task_get_exception_ports_info_t Reply_task_get_exception_ports_info; + __Reply__task_test_sync_upcall_t Reply_task_test_sync_upcall; + __Reply__task_set_corpse_forking_behavior_t Reply_task_set_corpse_forking_behavior; + __Reply__task_test_async_upcall_propagation_t Reply_task_test_async_upcall_propagation; + __Reply__task_map_kcdata_object_64_t Reply_task_map_kcdata_object_64; }; #endif /* !__RequestUnion__task_subsystem__defined */ @@ -2513,7 +2821,15 @@ union __ReplyUnion__task_subsystem { { "task_inspect", 3451 },\ { "task_get_exc_guard_behavior", 3452 },\ { "task_set_exc_guard_behavior", 3453 },\ - { "task_create_suid_cred", 3454 } + { "task_dyld_process_info_notify_register", 3456 },\ + { "task_create_identity_token", 3457 },\ + { "task_identity_token_get_task_port", 3458 },\ + { "task_dyld_process_info_notify_deregister", 3459 },\ + { "task_get_exception_ports_info", 3460 },\ + { "task_test_sync_upcall", 3461 },\ + { "task_set_corpse_forking_behavior", 3462 },\ + { "task_test_async_upcall_propagation", 3463 },\ + { "task_map_kcdata_object_64", 3464 } #endif #ifdef __AfterMigUserHeader diff --git a/lib/libc/include/x86_64-macos.10-none/mach/task_policy.h b/lib/libc/include/any-macos.13-any/mach/task_policy.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/mach/task_policy.h rename to lib/libc/include/any-macos.13-any/mach/task_policy.h index 4b6d3f9449..3e141668be 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/task_policy.h +++ b/lib/libc/include/any-macos.13-any/mach/task_policy.h @@ -110,8 +110,7 @@ typedef integer_t *task_policy_t; #define TASK_BASE_LATENCY_QOS_POLICY 10 #define TASK_BASE_THROUGHPUT_QOS_POLICY 11 - -enum task_role { +typedef enum task_role { TASK_RENICED = -1, TASK_UNSPECIFIED = 0, TASK_FOREGROUND_APPLICATION = 1, @@ -122,9 +121,7 @@ enum task_role { TASK_NONUI_APPLICATION = 6, TASK_DEFAULT_APPLICATION = 7, TASK_DARWINBG_APPLICATION = 8, -}; - -typedef integer_t task_role_t; +} task_role_t; struct task_category_policy { task_role_t role; @@ -184,6 +181,4 @@ typedef struct task_qos_policy *task_qos_policy_t; #define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */ - - #endif /* _MACH_TASK_POLICY_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/thread_act.h b/lib/libc/include/any-macos.13-any/mach/thread_act.h similarity index 89% rename from lib/libc/include/x86_64-macos.10-none/mach/thread_act.h rename to lib/libc/include/any-macos.13-any/mach/thread_act.h index 88561082cd..0e6c943508 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/thread_act.h +++ b/lib/libc/include/any-macos.13-any/mach/thread_act.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t; #endif /* AUTOTEST */ #ifndef thread_act_MSG_COUNT -#define thread_act_MSG_COUNT 28 +#define thread_act_MSG_COUNT 31 #endif /* thread_act_MSG_COUNT */ +#include #include #include #include @@ -71,8 +75,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_terminate ( thread_act_t target_act @@ -84,11 +87,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t act_get_state ( - thread_act_t target_act, + thread_read_t target_act, int flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt @@ -100,8 +102,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t act_set_state ( thread_act_t target_act, @@ -119,7 +120,7 @@ extern __WATCHOS_PROHIBITED kern_return_t thread_get_state ( - thread_act_t target_act, + thread_read_t target_act, thread_state_flavor_t flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt @@ -149,7 +150,7 @@ extern __WATCHOS_PROHIBITED kern_return_t thread_suspend ( - thread_act_t target_act + thread_read_t target_act ); /* Routine thread_resume */ @@ -161,7 +162,7 @@ extern __WATCHOS_PROHIBITED kern_return_t thread_resume ( - thread_act_t target_act + thread_read_t target_act ); /* Routine thread_abort */ @@ -194,8 +195,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_depress_abort ( thread_act_t thread @@ -207,11 +207,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_get_special_port ( - thread_act_t thr_act, + thread_inspect_t thr_act, int which_port, mach_port_t *special_port ); @@ -222,8 +221,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_set_special_port ( thread_act_t thr_act, @@ -251,8 +249,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_set_exception_ports ( thread_act_t thread, @@ -268,11 +265,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_get_exception_ports ( - thread_inspect_t thread, + thread_act_t thread, exception_mask_t exception_mask, exception_mask_array_t masks, mach_msg_type_number_t *masksCnt, @@ -287,8 +283,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_swap_exception_ports ( thread_act_t thread, @@ -402,7 +397,7 @@ extern #endif /* mig_external */ kern_return_t thread_get_assignment ( - thread_act_t thread, + thread_inspect_t thread, processor_set_name_t *assigned_set ); @@ -429,11 +424,10 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_get_mach_voucher ( - thread_act_t thr_act, + thread_read_t thr_act, mach_voucher_selector_t which, ipc_voucher_t *voucher ); @@ -444,8 +438,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_set_mach_voucher ( thread_act_t thr_act, @@ -458,8 +451,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t thread_swap_mach_voucher ( thread_act_t thr_act, @@ -467,6 +459,40 @@ kern_return_t thread_swap_mach_voucher ipc_voucher_t *old_voucher ); +/* Routine thread_convert_thread_state */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t thread_convert_thread_state +( + thread_act_t thread, + int direction, + thread_state_flavor_t flavor, + thread_state_t in_state, + mach_msg_type_number_t in_stateCnt, + thread_state_t out_state, + mach_msg_type_number_t *out_stateCnt +); + +/* Routine thread_get_exception_ports_info */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t thread_get_exception_ports_info +( + mach_port_t port, + exception_mask_t exception_mask, + exception_mask_array_t masks, + mach_msg_type_number_t *masksCnt, + exception_handler_info_array_t old_handlers_info, + exception_behavior_array_t old_behaviors, + exception_flavor_array_t old_flavors +); + __END_DECLS /********************** Caution **************************/ @@ -516,7 +542,7 @@ __END_DECLS NDR_record_t NDR; int flavor; mach_msg_type_number_t new_stateCnt; - natural_t new_state[614]; + natural_t new_state[1296]; } __Request__act_set_state_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -543,7 +569,7 @@ __END_DECLS NDR_record_t NDR; thread_state_flavor_t flavor; mach_msg_type_number_t new_stateCnt; - natural_t new_state[614]; + natural_t new_state[1296]; } __Request__thread_set_state_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -851,6 +877,34 @@ __END_DECLS #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + int direction; + thread_state_flavor_t flavor; + mach_msg_type_number_t in_stateCnt; + natural_t in_state[1296]; + mach_msg_type_number_t out_stateCnt; + } __Request__thread_convert_thread_state_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + exception_mask_t exception_mask; + } __Request__thread_get_exception_ports_info_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Request__thread_act_subsystem__defined */ /* union of all requests */ @@ -886,6 +940,8 @@ union __RequestUnion__thread_act_subsystem { __Request__thread_get_mach_voucher_t Request_thread_get_mach_voucher; __Request__thread_set_mach_voucher_t Request_thread_set_mach_voucher; __Request__thread_swap_mach_voucher_t Request_thread_swap_mach_voucher; + __Request__thread_convert_thread_state_t Request_thread_convert_thread_state; + __Request__thread_get_exception_ports_info_t Request_thread_get_exception_ports_info; }; #endif /* !__RequestUnion__thread_act_subsystem__defined */ /* typedefs for all replies */ @@ -913,7 +969,7 @@ union __RequestUnion__thread_act_subsystem { NDR_record_t NDR; kern_return_t RetCode; mach_msg_type_number_t old_stateCnt; - natural_t old_state[614]; + natural_t old_state[1296]; } __Reply__act_get_state_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -939,7 +995,7 @@ union __RequestUnion__thread_act_subsystem { NDR_record_t NDR; kern_return_t RetCode; mach_msg_type_number_t old_stateCnt; - natural_t old_state[614]; + natural_t old_state[1296]; } __Reply__thread_get_state_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -1259,6 +1315,37 @@ union __RequestUnion__thread_act_subsystem { #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_type_number_t out_stateCnt; + natural_t out_state[1296]; + } __Reply__thread_convert_thread_state_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_type_number_t masksCnt; + exception_mask_t masks[32]; + exception_handler_info_t old_handlers_info[32]; + exception_behavior_t old_behaviors[32]; + thread_state_flavor_t old_flavors[32]; + } __Reply__thread_get_exception_ports_info_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Reply__thread_act_subsystem__defined */ /* union of all replies */ @@ -1294,6 +1381,8 @@ union __ReplyUnion__thread_act_subsystem { __Reply__thread_get_mach_voucher_t Reply_thread_get_mach_voucher; __Reply__thread_set_mach_voucher_t Reply_thread_set_mach_voucher; __Reply__thread_swap_mach_voucher_t Reply_thread_swap_mach_voucher; + __Reply__thread_convert_thread_state_t Reply_thread_convert_thread_state; + __Reply__thread_get_exception_ports_info_t Reply_thread_get_exception_ports_info; }; #endif /* !__RequestUnion__thread_act_subsystem__defined */ @@ -1326,7 +1415,9 @@ union __ReplyUnion__thread_act_subsystem { { "thread_set_policy", 3624 },\ { "thread_get_mach_voucher", 3625 },\ { "thread_set_mach_voucher", 3626 },\ - { "thread_swap_mach_voucher", 3627 } + { "thread_swap_mach_voucher", 3627 },\ + { "thread_convert_thread_state", 3628 },\ + { "thread_get_exception_ports_info", 3630 } #endif #ifdef __AfterMigUserHeader diff --git a/lib/libc/include/x86_64-macos.10-none/mach/thread_policy.h b/lib/libc/include/any-macos.13-any/mach/thread_policy.h similarity index 95% rename from lib/libc/include/x86_64-macos.10-none/mach/thread_policy.h rename to lib/libc/include/any-macos.13-any/mach/thread_policy.h index e15504cff4..0e87792922 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/thread_policy.h +++ b/lib/libc/include/any-macos.13-any/mach/thread_policy.h @@ -131,7 +131,11 @@ typedef struct thread_extended_policy *thread_extended_policy_t; * * computation: This is the nominal amount of computation * time needed during a separate processing arrival, specified - * in absolute time units. + * in absolute time units. The thread may be preempted after + * the computation time has elapsed. + * If (computation < constraint/2) it will be forced to + * constraint/2 to avoid unintended preemption and associated + * timer interrupts. * * constraint: This is the maximum amount of real time that * may elapse from the start of a separate processing arrival @@ -139,11 +143,11 @@ typedef struct thread_extended_policy *thread_extended_policy_t; * specified in absolute time units. Must be (>= computation). * Note that latency = (constraint - computation). * - * preemptible: This indicates that the computation may be - * interrupted, subject to the constraint specified above. + * preemptible: IGNORED (This indicates that the computation may be + * interrupted, subject to the constraint specified above.) */ -#define THREAD_TIME_CONSTRAINT_POLICY 2 +#define THREAD_TIME_CONSTRAINT_POLICY 2 struct thread_time_constraint_policy { uint32_t period; @@ -261,6 +265,4 @@ typedef struct thread_throughput_qos_policy *thread_throughput_qos_policy_t; (sizeof (thread_throughput_qos_policy_data_t) / sizeof (integer_t))) - - #endif /* _MACH_THREAD_POLICY_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/vm_map.h b/lib/libc/include/any-macos.13-any/mach/vm_map.h similarity index 93% rename from lib/libc/include/x86_64-macos.10-none/mach/vm_map.h rename to lib/libc/include/any-macos.13-any/mach/vm_map.h index 59b3e7ffac..9d1f51b955 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/vm_map.h +++ b/lib/libc/include/any-macos.13-any/mach/vm_map.h @@ -25,7 +25,10 @@ #ifdef __cplusplus extern "C" { #endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable +#endif + extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); #ifdef __cplusplus } #endif @@ -41,7 +44,7 @@ extern "C" { #define FUNCTION_PTR_T typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); typedef struct { - char *name; + char * name; function_ptr_t function; } function_table_entry; typedef function_table_entry *function_table_t; @@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t; #endif /* AUTOTEST */ #ifndef vm_map_MSG_COUNT -#define vm_map_MSG_COUNT 32 +#define vm_map_MSG_COUNT 33 #endif /* vm_map_MSG_COUNT */ +#include #include #include #include @@ -74,7 +78,7 @@ extern #endif /* mig_external */ kern_return_t vm_region ( - vm_map_t target_task, + vm_map_read_t target_task, vm_address_t *address, vm_size_t *size, vm_region_flavor_t flavor, @@ -147,7 +151,7 @@ extern #endif /* mig_external */ kern_return_t vm_read ( - vm_map_t target_task, + vm_map_read_t target_task, vm_address_t address, vm_size_t size, vm_offset_t *data, @@ -162,7 +166,7 @@ extern #endif /* mig_external */ kern_return_t vm_read_list ( - vm_map_t target_task, + vm_map_read_t target_task, vm_read_entry_t data_list, natural_t count ); @@ -203,7 +207,7 @@ extern #endif /* mig_external */ kern_return_t vm_read_overwrite ( - vm_map_t target_task, + vm_map_read_t target_task, vm_address_t address, vm_size_t size, vm_address_t data, @@ -301,8 +305,7 @@ mig_external #else extern #endif /* mig_external */ -__WATCHOS_PROHIBITED -__TVOS_PROHIBITED +__TVOS_PROHIBITED __WATCHOS_PROHIBITED kern_return_t task_wire ( vm_map_t target_task, @@ -333,7 +336,7 @@ extern #endif /* mig_external */ kern_return_t vm_map_page_query ( - vm_map_t target_map, + vm_map_read_t target_map, vm_offset_t offset, integer_t *disposition, integer_t *ref_count @@ -347,7 +350,7 @@ extern #endif /* mig_external */ kern_return_t mach_vm_region_info ( - vm_map_t task, + vm_map_read_t task, vm_address_t address, vm_info_region_t *region, vm_info_object_array_t *objects, @@ -362,7 +365,7 @@ extern #endif /* mig_external */ kern_return_t vm_mapped_pages_info ( - vm_map_t task, + vm_map_read_t task, page_address_array_t *pages, mach_msg_type_number_t *pagesCnt ); @@ -375,7 +378,7 @@ extern #endif /* mig_external */ kern_return_t vm_region_recurse ( - vm_map_t target_task, + vm_map_read_t target_task, vm_address_t *address, vm_size_t *size, natural_t *nesting_depth, @@ -391,7 +394,7 @@ extern #endif /* mig_external */ kern_return_t vm_region_recurse_64 ( - vm_map_t target_task, + vm_map_read_t target_task, vm_address_t *address, vm_size_t *size, natural_t *nesting_depth, @@ -407,7 +410,7 @@ extern #endif /* mig_external */ kern_return_t mach_vm_region_info_64 ( - vm_map_t task, + vm_map_read_t task, vm_address_t address, vm_info_region_64_t *region, vm_info_object_array_t *objects, @@ -422,7 +425,7 @@ extern #endif /* mig_external */ kern_return_t vm_region_64 ( - vm_map_t target_task, + vm_map_read_t target_task, vm_address_t *address, vm_size_t *size, vm_region_flavor_t flavor, @@ -493,6 +496,27 @@ kern_return_t vm_map_exec_lockdown vm_map_t target_task ); +/* Routine vm_remap_new */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t vm_remap_new +( + vm_map_t target_task, + vm_address_t *target_address, + vm_size_t size, + vm_address_t mask, + int flags, + vm_map_read_t src_task, + vm_address_t src_address, + boolean_t copy, + vm_prot_t *cur_protection, + vm_prot_t *max_protection, + vm_inherit_t inheritance +); + __END_DECLS /********************** Caution **************************/ @@ -924,6 +948,30 @@ __END_DECLS #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t src_task; + /* end of the kernel processed data */ + NDR_record_t NDR; + vm_address_t target_address; + vm_size_t size; + vm_address_t mask; + int flags; + vm_address_t src_address; + boolean_t copy; + vm_prot_t cur_protection; + vm_prot_t max_protection; + vm_inherit_t inheritance; + } __Request__vm_remap_new_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Request__vm_map_subsystem__defined */ /* union of all requests */ @@ -959,6 +1007,7 @@ union __RequestUnion__vm_map_subsystem { __Request__vm_map_64_t Request_vm_map_64; __Request__vm_purgable_control_t Request_vm_purgable_control; __Request__vm_map_exec_lockdown_t Request_vm_map_exec_lockdown; + __Request__vm_remap_new_t Request_vm_remap_new; }; #endif /* !__RequestUnion__vm_map_subsystem__defined */ /* typedefs for all replies */ @@ -1363,6 +1412,21 @@ union __RequestUnion__vm_map_subsystem { #ifdef __MigPackStructs #pragma pack(pop) #endif + +#ifdef __MigPackStructs +#pragma pack(push, 4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + vm_address_t target_address; + vm_prot_t cur_protection; + vm_prot_t max_protection; + } __Reply__vm_remap_new_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Reply__vm_map_subsystem__defined */ /* union of all replies */ @@ -1398,6 +1462,7 @@ union __ReplyUnion__vm_map_subsystem { __Reply__vm_map_64_t Reply_vm_map_64; __Reply__vm_purgable_control_t Reply_vm_purgable_control; __Reply__vm_map_exec_lockdown_t Reply_vm_map_exec_lockdown; + __Reply__vm_remap_new_t Reply_vm_remap_new; }; #endif /* !__RequestUnion__vm_map_subsystem__defined */ @@ -1430,7 +1495,8 @@ union __ReplyUnion__vm_map_subsystem { { "mach_make_memory_entry_64", 3825 },\ { "vm_map_64", 3826 },\ { "vm_purgable_control", 3830 },\ - { "vm_map_exec_lockdown", 3831 } + { "vm_map_exec_lockdown", 3831 },\ + { "vm_remap_new", 3832 } #endif #ifdef __AfterMigUserHeader diff --git a/lib/libc/include/x86_64-macos.10-none/mach/vm_prot.h b/lib/libc/include/any-macos.13-any/mach/vm_prot.h similarity index 82% rename from lib/libc/include/x86_64-macos.10-none/mach/vm_prot.h rename to lib/libc/include/any-macos.13-any/mach/vm_prot.h index 75812fedf6..9b455415fc 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/vm_prot.h +++ b/lib/libc/include/any-macos.13-any/mach/vm_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2021 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -96,6 +96,13 @@ typedef int vm_prot_t; #define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE) +/* + * This is an alias to VM_PROT_EXECUTE to identify callers that + * want to allocate an hardware assisted Read-only/read-write + * trusted path in userland. + */ +#define VM_PROT_RORW_TP (VM_PROT_EXECUTE) + /* * An invalid protection value. * Used only by memory_object_lock_request to indicate no change @@ -103,7 +110,8 @@ typedef int vm_prot_t; * looks like VM_PROT_ALL and then some. */ -#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x08) +#define VM_PROT_NO_CHANGE_LEGACY ((vm_prot_t) 0x08) +#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x01000000) /* * When a caller finds that he cannot obtain write permission on a @@ -149,4 +157,22 @@ typedef int vm_prot_t; #define VM_PROT_STRIP_READ ((vm_prot_t) 0x80) #define VM_PROT_EXECUTE_ONLY (VM_PROT_EXECUTE|VM_PROT_STRIP_READ) + +#if defined(__x86_64__) +/* + * Another invalid protection value to support specifying different + * execute permissions for user- and supervisor- modes. When + * MBE is enabled in a VM, VM_PROT_EXECUTE is used to indicate + * supervisor-mode execute permission, and VM_PROT_UEXEC specifies + * user-mode execute permission. Currently only used by the + * x86 Hypervisor kext. + */ +#define VM_PROT_UEXEC ((vm_prot_t) 0x8) /* User-mode Execute Permission */ + +#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE | VM_PROT_UEXEC) +#else +#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE) +#endif /* defined(__x86_64__) */ + + #endif /* _MACH_VM_PROT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/vm_statistics.h b/lib/libc/include/any-macos.13-any/mach/vm_statistics.h similarity index 87% rename from lib/libc/include/x86_64-macos.10-none/mach/vm_statistics.h rename to lib/libc/include/any-macos.13-any/mach/vm_statistics.h index 2bfd8136b4..172e7f3bef 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/vm_statistics.h +++ b/lib/libc/include/any-macos.13-any/mach/vm_statistics.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2019 Apple Inc. All rights reserved. + * Copyright (c) 2000-2020 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -66,8 +66,12 @@ #ifndef _MACH_VM_STATISTICS_H_ #define _MACH_VM_STATISTICS_H_ -#include +#include +__BEGIN_DECLS + +#include +#include /* * vm_statistics @@ -167,6 +171,8 @@ struct vm_statistics64 { typedef struct vm_statistics64 *vm_statistics64_t; typedef struct vm_statistics64 vm_statistics64_data_t; +kern_return_t vm_stats(void *info, unsigned int *count); + /* * VM_STATISTICS_TRUNCATE_TO_32_BIT * @@ -225,7 +231,6 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t; #define VM_PAGE_QUERY_PAGE_CS_NX 0x400 #define VM_PAGE_QUERY_PAGE_REUSABLE 0x800 - /* * VM allocation flags: * @@ -258,24 +263,26 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t; * cached so that they will be stolen first if memory runs low. */ -#define VM_FLAGS_FIXED 0x0000 -#define VM_FLAGS_ANYWHERE 0x0001 -#define VM_FLAGS_PURGABLE 0x0002 -#define VM_FLAGS_4GB_CHUNK 0x0004 -#define VM_FLAGS_RANDOM_ADDR 0x0008 -#define VM_FLAGS_NO_CACHE 0x0010 -#define VM_FLAGS_RESILIENT_CODESIGN 0x0020 -#define VM_FLAGS_RESILIENT_MEDIA 0x0040 -#define VM_FLAGS_OVERWRITE 0x4000 /* delete any existing mappings first */ +#define VM_FLAGS_FIXED 0x00000000 +#define VM_FLAGS_ANYWHERE 0x00000001 +#define VM_FLAGS_PURGABLE 0x00000002 +#define VM_FLAGS_4GB_CHUNK 0x00000004 +#define VM_FLAGS_RANDOM_ADDR 0x00000008 +#define VM_FLAGS_NO_CACHE 0x00000010 +#define VM_FLAGS_RESILIENT_CODESIGN 0x00000020 +#define VM_FLAGS_RESILIENT_MEDIA 0x00000040 +#define VM_FLAGS_PERMANENT 0x00000080 +#define VM_FLAGS_TPRO 0x00001000 +#define VM_FLAGS_OVERWRITE 0x00004000 /* delete any existing mappings first */ /* * VM_FLAGS_SUPERPAGE_MASK * 3 bits that specify whether large pages should be used instead of * base pages (!=0), as well as the requested page size. */ -#define VM_FLAGS_SUPERPAGE_MASK 0x70000 /* bits 0x10000, 0x20000, 0x40000 */ -#define VM_FLAGS_RETURN_DATA_ADDR 0x100000 /* Return address of target data, rather than base of page */ -#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x800000 /* Return 4K aligned address of target data */ -#define VM_FLAGS_ALIAS_MASK 0xFF000000 +#define VM_FLAGS_SUPERPAGE_MASK 0x00070000 /* bits 0x10000, 0x20000, 0x40000 */ +#define VM_FLAGS_RETURN_DATA_ADDR 0x00100000 /* Return address of target data, rather than base of page */ +#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x00800000 /* Return 4K aligned address of target data */ +#define VM_FLAGS_ALIAS_MASK 0xFF000000 #define VM_GET_FLAGS_ALIAS(flags, alias) \ (alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24 #define VM_SET_FLAGS_ALIAS(flags, alias) \ @@ -289,8 +296,10 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t; VM_FLAGS_4GB_CHUNK | \ VM_FLAGS_RANDOM_ADDR | \ VM_FLAGS_NO_CACHE | \ + VM_FLAGS_PERMANENT | \ VM_FLAGS_OVERWRITE | \ VM_FLAGS_SUPERPAGE_MASK | \ + VM_FLAGS_TPRO | \ VM_FLAGS_ALIAS_MASK) #define VM_FLAGS_USER_MAP (VM_FLAGS_USER_ALLOCATE | \ VM_FLAGS_RETURN_4K_DATA_ADDR | \ @@ -318,7 +327,10 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t; /* Reasons for exception for virtual memory */ enum virtual_memory_guard_exception_codes { - kGUARD_EXC_DEALLOC_GAP = 1u << 0 + kGUARD_EXC_DEALLOC_GAP = 1u << 0, + kGUARD_EXC_RECLAIM_COPYIO_FAILURE = 1u << 1, + kGUARD_EXC_RECLAIM_INDEX_FAILURE = 1u << 2, + kGUARD_EXC_RECLAIM_DEALLOCATE_FAILURE = 1u << 3, }; @@ -333,9 +345,12 @@ enum virtual_memory_guard_exception_codes { #define VM_LEDGER_TAG_GRAPHICS 0x00000004 #define VM_LEDGER_TAG_NEURAL 0x00000005 #define VM_LEDGER_TAG_MAX 0x00000005 +#define VM_LEDGER_TAG_UNCHANGED ((int)-1) + /* individual bits: */ -#define VM_LEDGER_FLAG_NO_FOOTPRINT 0x00000001 -#define VM_LEDGER_FLAGS (VM_LEDGER_FLAG_NO_FOOTPRINT) +#define VM_LEDGER_FLAG_NO_FOOTPRINT (1 << 0) +#define VM_LEDGER_FLAG_NO_FOOTPRINT_FOR_DEBUG (1 << 1) +#define VM_LEDGER_FLAGS (VM_LEDGER_FLAG_NO_FOOTPRINT | VM_LEDGER_FLAG_NO_FOOTPRINT_FOR_DEBUG) #define VM_MEMORY_MALLOC 1 @@ -352,6 +367,8 @@ enum virtual_memory_guard_exception_codes { #define VM_MEMORY_MALLOC_NANO 11 #define VM_MEMORY_MALLOC_MEDIUM 12 +#define VM_MEMORY_MALLOC_PGUARD 13 // Will be removed +#define VM_MEMORY_MALLOC_PROB_GUARD 13 #define VM_MEMORY_MACH_MSG 20 #define VM_MEMORY_IOKIT 21 @@ -512,12 +529,38 @@ enum virtual_memory_guard_exception_codes { /* memory allocated by CoreMedia for global image registration of frames */ #define VM_MEMORY_CM_REGWARP 101 +/* memory allocated by EmbeddedAcousticRecognition for speech decoder */ +#define VM_MEMORY_EAR_DECODER 102 + +/* CoreUI cached image data */ +#define VM_MEMORY_COREUI_CACHED_IMAGE_DATA 103 + +/* ColorSync is using mmap for read-only copies of ICC profile data */ +#define VM_MEMORY_COLORSYNC 104 + +/* backtrace info for simulated crashes */ +#define VM_MEMORY_BTINFO 105 + +/* Reserve 230-239 for Rosetta */ +#define VM_MEMORY_ROSETTA 230 +#define VM_MEMORY_ROSETTA_THREAD_CONTEXT 231 +#define VM_MEMORY_ROSETTA_INDIRECT_BRANCH_MAP 232 +#define VM_MEMORY_ROSETTA_RETURN_STACK 233 +#define VM_MEMORY_ROSETTA_EXECUTABLE_HEAP 234 +#define VM_MEMORY_ROSETTA_USER_LDT 235 +#define VM_MEMORY_ROSETTA_ARENA 236 +#define VM_MEMORY_ROSETTA_10 239 + /* Reserve 240-255 for application */ #define VM_MEMORY_APPLICATION_SPECIFIC_1 240 #define VM_MEMORY_APPLICATION_SPECIFIC_16 255 +#define VM_MEMORY_COUNT 256 + #define VM_MAKE_TAG(tag) ((tag) << 24) +__END_DECLS + #endif /* _MACH_VM_STATISTICS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/vm_types.h b/lib/libc/include/any-macos.13-any/mach/vm_types.h similarity index 82% rename from lib/libc/include/x86_64-macos.10-none/mach/vm_types.h rename to lib/libc/include/any-macos.13-any/mach/vm_types.h index 18ff9ae771..e5aaa9bb93 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/vm_types.h +++ b/lib/libc/include/any-macos.13-any/mach/vm_types.h @@ -36,9 +36,10 @@ #include #include +#include -typedef vm_offset_t pointer_t; -typedef vm_offset_t vm_address_t; +typedef vm_offset_t pointer_t __kernel_ptr_semantics; +typedef vm_offset_t vm_address_t __kernel_ptr_semantics; /* * We use addr64_t for 64-bit addresses that are used on both @@ -70,10 +71,12 @@ typedef uint32_t ppnum_t; /* Physical page number */ -typedef mach_port_t vm_map_t; +typedef mach_port_t vm_map_t, vm_map_read_t, vm_map_inspect_t; #define VM_MAP_NULL ((vm_map_t) 0) +#define VM_MAP_INSPECT_NULL ((vm_map_inspect_t) 0) +#define VM_MAP_READ_NULL ((vm_map_read_t) 0) /* * Evolving definitions, likely to change. @@ -82,6 +85,20 @@ typedef mach_port_t vm_map_t; typedef uint64_t vm_object_offset_t; typedef uint64_t vm_object_size_t; +/*! + * @typedef + * + * @brief + * Pair of a min/max address used to denote a memory region. + * + * @discussion + * @c min_address must be smaller or equal to @c max_address. + */ +typedef struct mach_vm_range { + mach_vm_offset_t min_address; + mach_vm_offset_t max_address; +} *mach_vm_range_t; + diff --git a/lib/libc/include/x86_64-macos.10-none/mach_debug/ipc_info.h b/lib/libc/include/any-macos.13-any/mach_debug/ipc_info.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/mach_debug/ipc_info.h rename to lib/libc/include/any-macos.13-any/mach_debug/ipc_info.h index deb07cac5e..fa4a500788 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach_debug/ipc_info.h +++ b/lib/libc/include/any-macos.13-any/mach_debug/ipc_info.h @@ -78,7 +78,7 @@ typedef struct ipc_info_space { natural_t iis_genno_mask; /* generation number mask */ natural_t iis_table_size; /* size of table */ - natural_t iis_table_next; /* next possible size of table */ + natural_t iis_table_next; /* next possible size of table (UNUSED) */ natural_t iis_tree_size; /* size of tree (UNUSED) */ natural_t iis_tree_small; /* # of small entries in tree (UNUSED) */ natural_t iis_tree_hash; /* # of hashed entries in tree (UNUSED) */ @@ -87,7 +87,7 @@ typedef struct ipc_info_space { typedef struct ipc_info_space_basic { natural_t iisb_genno_mask; /* generation number mask */ natural_t iisb_table_size; /* size of table */ - natural_t iisb_table_next; /* next possible size of table */ + natural_t iisb_table_next; /* next possible size of table (UNUSED) */ natural_t iisb_table_inuse; /* number of entries in use */ natural_t iisb_reserved[2]; /* future expansion */ } ipc_info_space_basic_t; @@ -113,4 +113,11 @@ typedef struct ipc_info_tree_name { typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t; +typedef struct ipc_info_port { + natural_t iip_port_object; /* port object identifier */ + natural_t iip_receiver_object; /* receiver task identifier (if any) */ +} ipc_info_port_t; + +typedef ipc_info_port_t *exception_handler_info_array_t; + #endif /* _MACH_DEBUG_IPC_INFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/mach_debug/mach_debug_types.h b/lib/libc/include/any-macos.13-any/mach_debug/mach_debug_types.h new file mode 100644 index 0000000000..599a91346d --- /dev/null +++ b/lib/libc/include/any-macos.13-any/mach_debug/mach_debug_types.h @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * @OSF_COPYRIGHT@ + */ +/* + * Mach Operating System + * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + */ +/* + * Mach kernel debugging interface type declarations + */ + +#ifndef _MACH_DEBUG_MACH_DEBUG_TYPES_H_ +#define _MACH_DEBUG_MACH_DEBUG_TYPES_H_ + +#include +#include +#include +#include +#include +#include + +#define MACH_CORE_FILEHEADER_SIGNATURE 0x0063614d20646152ULL +#define MACH_CORE_FILEHEADER_V2_SIGNATURE 0x63614d2073736f42ULL +#define MACH_CORE_FILEHEADER_MAXFILES 16 +#define MACH_CORE_FILEHEADER_NAMELEN 16 + +/* The following are defined for mach_core_fileheader_v2 */ +#define MACH_CORE_FILEHEADER_V2_FLAG_LOG_ENCRYPTED_AEA (1ULL << 0) /* The log is encrypted using AEA */ +#define MACH_CORE_FILEHEADER_V2_FLAG_EXISTING_COREFILE_KEY_FORMAT_NIST_P256 (1ULL << 8) /* The public key is an NIST-P256 ECC key */ +#define MACH_CORE_FILEHEADER_V2_FLAG_NEXT_COREFILE_KEY_FORMAT_NIST_P256 (1ULL << 16) /* The next public key is an NIST-P256 ECC key */ + +#define MACH_CORE_FILEHEADER_V2_FLAGS_EXISTING_COREFILE_KEY_FORMAT_MASK (0x1ULL << 8) /* A bit-mask for all supported key formats */ +#define MACH_CORE_FILEHEADER_V2_FLAGS_NEXT_COREFILE_KEY_FORMAT_MASK (0x1ULL << 16) /* A bit-mask for all supported next key formats */ + +#define MACH_CORE_FILEHEADER_V2_FLAGS_NEXT_KEY_FORMAT_TO_KEY_FORMAT(x) (((x) >> 8) & MACH_CORE_FILEHEADER_V2_FLAGS_EXISTING_COREFILE_KEY_FORMAT_MASK) + +/* The following are defined for mach_core_details_v2 */ +#define MACH_CORE_DETAILS_V2_FLAG_ENCRYPTED_AEA (1ULL << 0) /* This core is encrypted using AEA */ +#define MACH_CORE_DETAILS_V2_FLAG_COMPRESSED_ZLIB (1ULL << 8) /* This core is compressed using ZLib */ +#define MACH_CORE_DETAILS_V2_FLAG_COMPRESSED_LZ4 (1ULL << 9) /* This core is compressed using LZ4 */ + +typedef char symtab_name_t[32]; + +/* + *********************** + * + * Mach corefile layout + * + *********************** + * + * uint64_t signature + * uint64_t log_offset >---+ + * uint64_t log_length | + * mach_core_details files[MACH_CORE_FILEHEADER_MAXFILES] | + * |--> uint64_t gzip_offset >---+ | + * | uint64_t gzip_length | | + * | char core_name[] | | + * |--> uint64_t gzip_offset >---+ | | + * | uint64_t gzip_length | | | + * | char core_name[] | | | + * |--> [...] | | | + * [log data. Plain-text] | | <---+ + * [core #1 data. Zlib compressed] | <---+ + * [core #2 data. Zlib compressed] <---+ + * [core #x data...] + */ + +struct mach_core_details { + uint64_t gzip_offset; + uint64_t gzip_length; + char core_name[MACH_CORE_FILEHEADER_NAMELEN]; +}; + +struct mach_core_fileheader { + uint64_t signature; /* MACH_CORE_FILEHEADER_SIGNATURE */ + uint64_t log_offset; + uint64_t log_length; + uint64_t num_files; + struct mach_core_details files[MACH_CORE_FILEHEADER_MAXFILES]; +}; + +/* + * Mach corefile V2 headers are denoted with MACH_CORE_FILEHEADER_V2_SIGNATURE. + * Note that the V2 headers contain a version field that further indicates the version of the + * header's contents. For example, if a V2 header's 'version' field indicates version 5, then + * the header follows the format of the 'mach_core_fileheader_v5' structure. + * + * Further note that 'mach_core_details_' structures are not bound to the same versioning scheme + * as the header itself. This means that it's perfectly acceptable for a 'mach_core_fileheader_v5' header + * to make use of 'mach_core_details_v2' + * + ************************** + * + * Mach corefile layout V2 (using a version 2 header struct as an example) + * + ************************** + * + * uint64_t signature + * uint32_t version + * uint64_t flags + * uint64_t pub_key_offset >---+ + * uint16_t pub_key_length | + * uint64_t log_offset >---+ | + * uint64_t log_length | | + * uint64_t num_files | | + * mach_core_details_v2 files[] | | + * |--> uint64_t flags | | + * | uint64_t offset >---+ | | + * | uint64_t length | | | + * | char core_name[] | | | + * |--> uint64_t flags | | | + * | uint64_t offset >---+ | | | + * | uint64_t length | | | | + * | char core_name[] | | | | + * |--> [...] | | | | + * [public key data] | | | <---+ + * [log data. Plain-text or an AEA container] | | <---+ + * [core #1 data. Zlib/LZ4 compressed. Possibly in an AEA container] | <---+ + * [core #2 data. Zlib/LZ4 compressed. Possibly in an AEA container] <---+ + * [core #x data...] + */ + +struct mach_core_details_v2 { + uint64_t flags; /* See the MACH_CORE_DETAILS_V2_FLAG_* definitions */ + uint64_t offset; + uint64_t length; + char core_name[MACH_CORE_FILEHEADER_NAMELEN]; +}; + +struct mach_core_fileheader_base { + uint64_t signature; /* MACH_CORE_FILEHEADER_V2_SIGNATURE */ + uint32_t version; +}; + +struct mach_core_fileheader_v2 { + uint64_t signature; /* MACH_CORE_FILEHEADER_V2_SIGNATURE */ + uint32_t version; /* 2 */ + uint64_t flags; /* See the MACH_CORE_FILEHEADER_V2_FLAG_* definitions */ + uint64_t pub_key_offset; /* Offset of the public key */ + uint16_t pub_key_length; /* Length of the public key */ + uint64_t log_offset; + uint64_t log_length; + uint64_t num_files; + struct mach_core_details_v2 files[]; +}; + +#define KOBJECT_DESCRIPTION_LENGTH 512 +typedef char kobject_description_t[KOBJECT_DESCRIPTION_LENGTH]; + +#endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/malloc/malloc.h b/lib/libc/include/any-macos.13-any/malloc/malloc.h similarity index 92% rename from lib/libc/include/x86_64-macos.10-none/malloc/malloc.h rename to lib/libc/include/any-macos.13-any/malloc/malloc.h index 0bddfda43b..41db5dbb1a 100644 --- a/lib/libc/include/x86_64-macos.10-none/malloc/malloc.h +++ b/lib/libc/include/any-macos.13-any/malloc/malloc.h @@ -97,6 +97,10 @@ typedef struct _malloc_zone_t { * not yet been allocated. False negatives are not allowed. */ boolean_t (* MALLOC_ZONE_FN_PTR(claimed_address))(struct _malloc_zone_t *zone, void *ptr); + + /* For zone 0 implementations: try to free ptr, promising to call find_zone_and_free + * if it turns out not to belong to us */ + void (* MALLOC_ZONE_FN_PTR(try_free_default))(struct _malloc_zone_t *zone, void *ptr); } malloc_zone_t; /********* Creation and destruction ************/ @@ -216,7 +220,7 @@ typedef void vm_range_recorder_t(task_t, void *, unsigned type, vm_range_t *, un /* given a task and context, "records" the specified addresses */ /* Print function for the print_task() operation. */ -typedef void print_task_printer_t(const char *fmt, ...); +typedef void print_task_printer_t(const char *fmt, ...) __printflike(1,2); typedef struct malloc_introspection_t { kern_return_t (* MALLOC_INTROSPECT_FN_PTR(enumerator))(task_t task, void *, unsigned type_mask, vm_address_t zone_address, memory_reader_t reader, vm_range_recorder_t recorder); /* enumerates all the malloc pointers in use */ @@ -309,6 +313,37 @@ extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); #endif /* __BLOCKS__ */ +/********* Zone version summary ************/ +// Version 0, but optional: +// malloc_zone_t::batch_malloc +// malloc_zone_t::batch_free +// Version 5: +// malloc_zone_t::memalign +// Version 6: +// malloc_zone_t::free_definite_size +// Version 7: +// malloc_introspection_t::enable_discharge_checking +// malloc_introspection_t::disable_discharge_checking +// malloc_introspection_t::discharge +// Version 8: +// malloc_zone_t::pressure_relief +// Version 9: +// malloc_introspection_t::reinit_lock +// Version 10: +// malloc_zone_t::claimed_address +// Version 11: +// malloc_introspection_t::print_task +// Version 12: +// malloc_introspection_t::task_statistics +// Version 13: +// - malloc_zone_t::malloc and malloc_zone_t::calloc assume responsibility for +// setting errno to ENOMEM on failure +// - malloc_zone_t::try_free_default + +// These functions are optional and calling them requires two checks: +// * Check zone version to ensure zone struct is large enough to include the member. +// * Check that the function pointer is not null. + __END_DECLS #endif /* _MALLOC_MALLOC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/net/if.h b/lib/libc/include/any-macos.13-any/net/if.h similarity index 95% rename from lib/libc/include/x86_64-macos.10-none/net/if.h rename to lib/libc/include/any-macos.13-any/net/if.h index c0729f0eb8..d06305aaa0 100644 --- a/lib/libc/include/x86_64-macos.10-none/net/if.h +++ b/lib/libc/include/any-macos.13-any/net/if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2019 Apple Inc. All rights reserved. + * Copyright (c) 2000-2021 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -63,28 +63,30 @@ #ifndef _NET_IF_H_ #define _NET_IF_H_ -#include -#include - #define IF_NAMESIZE 16 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include #include #ifdef __APPLE__ #include +#include #include #include #endif +#ifndef IFNAMSIZ +#define IFNAMSIZ IF_NAMESIZE +#endif + struct if_clonereq { int ifcr_total; /* total cloners (out) */ int ifcr_count; /* room for this many in user buffer */ char *ifcr_buffer; /* buffer for cloner names */ }; - #define IFF_UP 0x1 /* interface is up */ #define IFF_BROADCAST 0x2 /* broadcast address valid */ #define IFF_DEBUG 0x4 /* turn on debugging */ @@ -104,7 +106,6 @@ struct if_clonereq { #define IFF_MULTICAST 0x8000 /* supports multicast */ - /* * Capabilities that interfaces can advertise. * @@ -149,9 +150,14 @@ struct if_clonereq { #define IFQ_MAXLEN 128 #define IFNET_SLOWHZ 1 /* granularity is 1 second */ -#define IFQ_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ -#define IFQ_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ - +#define IFQ_DEF_C_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ +#define IFQ_DEF_C_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ +#define IFQ_DEF_L4S_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ +#define IFQ_DEF_L4S_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ +#define IFQ_LL_C_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ +#define IFQ_LL_C_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ +#define IFQ_LL_L4S_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ +#define IFQ_LL_L4S_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ /* * Message format for use in obtaining information about interfaces * from sysctl and the routing socket @@ -278,16 +284,17 @@ struct ifkpi { #pragma pack() + /* * Interface request structure used for socket * ioctl's. All interface ioctl's must have parameter * definitions which begin with ifr_name. The * remainder may be interface specific. */ +#ifdef IFREQ_OPAQUE +struct ifreq; +#else struct ifreq { -#ifndef IFNAMSIZ -#define IFNAMSIZ IF_NAMESIZE -#endif char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ union { struct sockaddr ifru_addr; @@ -343,12 +350,19 @@ struct ifreq { ((ifr).ifr_addr.sa_len > sizeof (struct sockaddr) ? \ (sizeof (struct ifreq) - sizeof (struct sockaddr) + \ (ifr).ifr_addr.sa_len) : sizeof (struct ifreq)) +#endif /* IFREQ_OPAQUE */ struct ifaliasreq { char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ +#if __has_ptrcheck + struct sockaddr_in ifra_addr; + struct sockaddr_in ifra_broadaddr; + struct sockaddr_in ifra_mask; +#else struct sockaddr ifra_addr; struct sockaddr ifra_broadaddr; struct sockaddr ifra_mask; +#endif /* __has_ptrcheck */ }; struct rslvmulti_req { @@ -371,7 +385,6 @@ struct ifmediareq { #pragma pack() - #pragma pack(4) struct ifdrv { char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */ @@ -413,7 +426,6 @@ struct ifconf { #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ - /* * DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure */ @@ -423,7 +435,6 @@ struct kev_dl_proto_data { u_int32_t proto_remaining_count; }; - #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ struct if_nameindex { @@ -439,4 +450,5 @@ void if_freenameindex(struct if_nameindex *); __END_DECLS + #endif /* !_NET_IF_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/uio.h b/lib/libc/include/any-macos.13-any/net/if_dl.h similarity index 59% rename from lib/libc/include/x86_64-macos.10-none/sys/uio.h rename to lib/libc/include/any-macos.13-any/net/if_dl.h index a5b1bad7cf..494aea0c85 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/uio.h +++ b/lib/libc/include/any-macos.13-any/net/if_dl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2008 Apple Inc. All rights reserved. + * Copyright (c) 2000-2011 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -25,9 +25,8 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ -/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* - * Copyright (c) 1982, 1986, 1993, 1994 + * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,43 +57,72 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)uio.h 8.5 (Berkeley) 2/22/94 + * @(#)if_dl.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_dl.h,v 1.10 2000/03/01 02:46:25 archie Exp $ */ -#ifndef _SYS_UIO_H_ -#define _SYS_UIO_H_ +#ifndef _NET_IF_DL_H_ +#define _NET_IF_DL_H_ +#include + +#include -#include -#include /* - * [XSI] The ssize_t and size_t types shall be defined as described - * in . + * A Link-Level Sockaddr may specify the interface in one of two + * ways: either by means of a system-provided index number (computed + * anew and possibly differently on every reboot), or by a human-readable + * string such as "il0" (for managerial convenience). + * + * Census taking actions, such as something akin to SIOCGCONF would return + * both the index and the human name. + * + * High volume transactions (such as giving a link-level ``from'' address + * in a recvfrom or recvmsg call) may be likely only to provide the indexed + * form, (which requires fewer copy operations and less space). + * + * The form and interpretation of the link-level address is purely a matter + * of convention between the device driver and its consumers; however, it is + * expected that all drivers for an interface of a given if_type will agree. */ -#include -#include /* - * [XSI] Structure whose address is passed as the second parameter to the - * readv() and writev() functions. + * Structure of a Link-Level sockaddr: */ -#include - - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -/* - * IO direction for uio_t. - * UIO_READ - data moves into iovec(s) associated with uio_t - * UIO_WRITE - data moves out of iovec(s) associated with uio_t - */ -enum uio_rw { UIO_READ, UIO_WRITE }; +#if __has_ptrcheck +#define DLIL_SDLDATACOUNT __counted_by(sdl_len - 8) +#else +#define DLIL_SDLDATACOUNT 12 #endif +struct sockaddr_dl { + u_char sdl_len; /* Total length of sockaddr */ + u_char sdl_family; /* AF_LINK */ + u_short sdl_index; /* if != 0, system given index for interface */ + u_char sdl_type; /* interface type */ + u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ + u_char sdl_alen; /* link level address length */ + u_char sdl_slen; /* link layer selector length */ + char sdl_data[DLIL_SDLDATACOUNT]; + /* minimum work area, can be larger; + * contains both if name and ll address */ +#ifndef __APPLE__ + /* For TokenRing */ + u_short sdl_rcf; /* source routing control */ + u_short sdl_route[16]; /* source routing information */ +#endif +}; +#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) + + + +#include __BEGIN_DECLS -ssize_t readv(int, const struct iovec *, int) __DARWIN_ALIAS_C(readv); -ssize_t writev(int, const struct iovec *, int) __DARWIN_ALIAS_C(writev); +void link_addr(const char *, struct sockaddr_dl *); +char *link_ntoa(const struct sockaddr_dl *); __END_DECLS -#endif /* !_SYS_UIO_H_ */ \ No newline at end of file + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/net/if_var.h b/lib/libc/include/any-macos.13-any/net/if_var.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/net/if_var.h rename to lib/libc/include/any-macos.13-any/net/if_var.h index 6dcaa3842e..32b7918282 100644 --- a/lib/libc/include/x86_64-macos.10-none/net/if_var.h +++ b/lib/libc/include/any-macos.13-any/net/if_var.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2019 Apple Inc. All rights reserved. + * Copyright (c) 2000-2021 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -70,6 +70,7 @@ #include #include /* get TAILQ macros */ #ifdef BSD_KERN_PRIVATE +#include #include #endif @@ -90,7 +91,7 @@ #define APPLE_IF_FAM_FIREWIRE 13 #define APPLE_IF_FAM_BOND 14 #define APPLE_IF_FAM_CELLULAR 15 -#define APPLE_IF_FAM_6LOWPAN 16 +#define APPLE_IF_FAM_UNUSED_16 16 /* Un-used */ #define APPLE_IF_FAM_UTUN 17 #define APPLE_IF_FAM_IPSEC 18 #endif /* __APPLE__ */ @@ -223,6 +224,13 @@ struct if_data64 { #pragma pack() +#if defined(DRIVERKIT) || defined(PRIVATE) || defined(DRIVERKIT_PRIVATE) +#include +#else +struct ifnet_interface_advisory; +#endif /* defined(DRIVERKIT) || defined(PRIVATE) || defined(DRIVERKIT_PRIVATE) */ + + /* * Structure defining a queue for a network interface. */ @@ -236,7 +244,4 @@ struct ifqueue { - - - #endif /* !_NET_IF_VAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/net/route.h b/lib/libc/include/any-macos.13-any/net/route.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/net/route.h rename to lib/libc/include/any-macos.13-any/net/route.h index 77ff23a3e1..968eb0c2aa 100644 --- a/lib/libc/include/x86_64-macos.10-none/net/route.h +++ b/lib/libc/include/any-macos.13-any/net/route.h @@ -84,7 +84,7 @@ struct rt_metrics { u_int32_t rmx_rttvar; /* estimated rtt variance */ u_int32_t rmx_pksent; /* packets sent using this route */ u_int32_t rmx_state; /* route state */ - u_int32_t rmx_filler[3]; /* will be used for T/TCP later */ + u_int32_t rmx_filler[3]; /* will be used for TCP's peer-MSS cache */ }; /* @@ -92,8 +92,6 @@ struct rt_metrics { */ #define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ - - #define RTF_UP 0x1 /* route usable */ #define RTF_GATEWAY 0x2 /* destination is a gateway */ #define RTF_HOST 0x4 /* host entry (net otherwise) */ @@ -127,7 +125,8 @@ struct rt_metrics { #define RTF_PROXY 0x8000000 /* proxying, no interface scope */ #define RTF_ROUTER 0x10000000 /* host is a router */ #define RTF_DEAD 0x20000000 /* Route entry is being freed */ - /* 0x40000000 and up unassigned */ +#define RTF_GLOBAL 0x40000000 /* route to destination of the global internet */ + /* 0x80000000 unassigned */ #define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ #define RTF_BITS \ @@ -135,10 +134,15 @@ struct rt_metrics { "\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \ "\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \ "\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \ - "\33IFREF\34PROXY\35ROUTER" + "\33IFREF\34PROXY\35ROUTER\37GLOBAL" #define IS_DIRECT_HOSTROUTE(rt) \ (((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST) + +#define IS_DYNAMIC_DIRECT_HOSTROUTE(rt) \ + (((rt)->rt_flags & (RTF_CLONING | RTF_PRCLONING | RTF_HOST | RTF_LLINFO |\ + RTF_WASCLONED | RTF_GATEWAY)) ==\ + (RTF_HOST | RTF_LLINFO | RTF_WASCLONED)) /* * Routing statistics. */ @@ -184,7 +188,6 @@ struct rt_msghdr2 { struct rt_metrics rtm_rmx; /* metrics themselves */ }; - #define RTM_VERSION 5 /* Up the ante and ignore older versions */ /* diff --git a/lib/libc/include/x86_64-macos.10-none/netinet/in.h b/lib/libc/include/any-macos.13-any/netinet/in.h similarity index 99% rename from lib/libc/include/x86_64-macos.10-none/netinet/in.h rename to lib/libc/include/any-macos.13-any/netinet/in.h index 0e921c2965..f2daff26a4 100644 --- a/lib/libc/include/x86_64-macos.10-none/netinet/in.h +++ b/lib/libc/include/any-macos.13-any/netinet/in.h @@ -63,14 +63,14 @@ #ifndef _NETINET_IN_H_ #define _NETINET_IN_H_ + #include -#include #include /* uint(8|16|32)_t */ #include -#include +#include #include /* @@ -360,7 +360,6 @@ struct in_addr { (((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \ (((u_int32_t)(i) & 0xffff0000) == 0xc0a80000)) - #define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & 0xffffff00) == 0xe0000000) #define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i)) @@ -384,7 +383,6 @@ struct sockaddr_in { (bcmp(&(a)->s_addr, &(b)->s_addr, \ sizeof (struct in_addr)) == 0) - #define INET_ADDRSTRLEN 16 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) @@ -435,6 +433,7 @@ struct ip_opts { #define IP_PKTINFO 26 /* get pktinfo on recv socket, set src on sent dgram */ #define IP_RECVPKTINFO IP_PKTINFO /* receive pktinfo w/dgram */ #define IP_RECVTOS 27 /* bool; receive IP TOS w/dgram */ +#define IP_DONTFRAG 28 /* don't fragment packet */ #define IP_FW_ADD 40 /* add a firewall rule to chain */ #define IP_FW_DEL 41 /* delete a firewall rule from chain */ @@ -628,7 +627,6 @@ struct in_pktinfo { */ #define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */ - /* * Names for IP sysctl objects */ @@ -660,7 +658,6 @@ struct in_pktinfo { #undef __KAME_NETINET_IN_H_INCLUDED_ - #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) __BEGIN_DECLS int bindresvport(int, struct sockaddr_in *); @@ -668,4 +665,6 @@ struct sockaddr; int bindresvport_sa(int, struct sockaddr *); __END_DECLS #endif + + #endif /* _NETINET_IN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/netinet/tcp.h b/lib/libc/include/any-macos.13-any/netinet/tcp.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/netinet/tcp.h rename to lib/libc/include/any-macos.13-any/netinet/tcp.h index f089db156e..34d9097140 100644 --- a/lib/libc/include/x86_64-macos.10-none/netinet/tcp.h +++ b/lib/libc/include/any-macos.13-any/netinet/tcp.h @@ -63,10 +63,15 @@ #ifndef _NETINET_TCP_H_ #define _NETINET_TCP_H_ -#include #include +#include +#include + #include #include /* __uint32_t */ +#include + +#include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) typedef __uint32_t tcp_seq; @@ -101,8 +106,11 @@ struct tcphdr { #define TH_URG 0x20 #define TH_ECE 0x40 #define TH_CWR 0x80 +#define TH_AE 0x100 /* maps into th_x2 */ #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) +#define TH_FLAGS_ALL (TH_FLAGS|TH_PUSH) #define TH_ACCEPT (TH_FIN|TH_SYN|TH_RST|TH_ACK) +#define TH_ACE (TH_AE|TH_CWR|TH_ECE) unsigned short th_win; /* window */ unsigned short th_sum; /* checksum */ @@ -143,6 +151,11 @@ struct tcphdr { #define TCPOPT_FASTOPEN 34 #define TCPOLEN_FASTOPEN_REQ 2 +#define TCPOPT_ACCECN0 0xAC /* AccECN Order 0 */ +#define TCPOPT_ACCECN1 0XAE /* AccECN Order 1 */ +#define TCPOLEN_ACCECN_EMPTY 2 /* Empty option contains kind and length */ +#define TCPOLEN_ACCECN_COUNTER 3 /* Length of each AccECN counter */ + /* Option definitions */ #define TCPOPT_SACK_PERMIT_HDR \ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK_PERMITTED<<8|TCPOLEN_SACK_PERMITTED) @@ -229,7 +242,6 @@ struct tcphdr { #define TCP_NOTSENT_LOWAT 0x201 /* Low water mark for TCP unsent data */ - struct tcp_connection_info { u_int8_t tcpi_state; /* connection state */ u_int8_t tcpi_snd_wscale; /* Window scale for send window */ @@ -280,4 +292,5 @@ struct tcp_connection_info { }; #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ + #endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/netinet6/in6.h b/lib/libc/include/any-macos.13-any/netinet6/in6.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/netinet6/in6.h rename to lib/libc/include/any-macos.13-any/netinet6/in6.h index 19899090ad..3d4f7035e3 100644 --- a/lib/libc/include/x86_64-macos.10-none/netinet6/in6.h +++ b/lib/libc/include/any-macos.13-any/netinet6/in6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2018 Apple Inc. All rights reserved. + * Copyright (c) 2008-2020 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -98,6 +98,7 @@ #ifndef _NETINET6_IN6_H_ #define _NETINET6_IN6_H_ #include + #include #include @@ -206,6 +207,7 @@ struct sockaddr_in6 { #define IN6ADDR_V4MAPPED_INIT \ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6ADDR_MULTICAST_PREFIX IN6MASK8 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ extern const struct in6_addr in6addr_any; @@ -297,6 +299,16 @@ extern const struct in6_addr in6addr_linklocal_allv2routers; */ #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) +#define IPV6_ADDR_MC_FLAGS(a) ((a)->s6_addr[1] & 0xf0) + +#define IPV6_ADDR_MC_FLAGS_TRANSIENT 0x10 +#define IPV6_ADDR_MC_FLAGS_PREFIX 0x20 +#define IPV6_ADDR_MC_FLAGS_UNICAST_BASED (IPV6_ADDR_MC_FLAGS_TRANSIENT | IPV6_ADDR_MC_FLAGS_PREFIX) + +#define IN6_IS_ADDR_UNICAST_BASED_MULTICAST(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED)) + /* * Unique Local IPv6 Unicast Addresses (per RFC 4193) */ @@ -311,8 +323,9 @@ extern const struct in6_addr in6addr_linklocal_allv2routers; #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) -#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_FLAGS(a) != IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL)) #define IN6_IS_ADDR_MC_SITELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ @@ -325,8 +338,6 @@ extern const struct in6_addr in6addr_linklocal_allv2routers; (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) - - /* * Options for use with [gs]etsockopt at the IPV6 level. * First word of comment is data type; bool is stored in int. @@ -369,9 +380,9 @@ extern const struct in6_addr in6addr_linklocal_allv2routers; #define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ #define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ -#define IPV6_MULTICAST_IF 9 /* __uint8_t; set/get IP6 multicast i/f */ -#define IPV6_MULTICAST_HOPS 10 /* __uint8_t; set/get IP6 multicast hops */ -#define IPV6_MULTICAST_LOOP 11 /* __uint8_t; set/get IP6 mcast loopback */ +#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */ +#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */ +#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 mcast loopback */ #define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */ #define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */ @@ -493,7 +504,6 @@ extern const struct in6_addr in6addr_linklocal_allv2routers; #define IPV6_BOUND_IF 125 /* int; set/get bound interface */ - /* to define items, should talk with KAME guys first, for *BSD compatibility */ #define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. */ @@ -613,15 +623,13 @@ struct ip6_mtuinfo { #define IPV6CTL_MAXIFDEFROUTERS 48 #define IPV6CTL_MAXDYNROUTES 49 #define ICMPV6CTL_ND6_ONLINKNSRFC4861 50 +#define IPV6CTL_ULA_USETEMPADDR 51 + /* New entries should be added here from current IPV6CTL_MAXID value. */ /* to define items, should talk with KAME guys first, for *BSD compatibility */ #define IPV6CTL_MAXID 51 - - - - __BEGIN_DECLS struct cmsghdr; diff --git a/lib/libc/include/x86_64-macos.10-none/objc/NSObjCRuntime.h b/lib/libc/include/any-macos.13-any/objc/NSObjCRuntime.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/objc/NSObjCRuntime.h rename to lib/libc/include/any-macos.13-any/objc/NSObjCRuntime.h index c0d01f928e..60ce1d99ca 100644 --- a/lib/libc/include/x86_64-macos.10-none/objc/NSObjCRuntime.h +++ b/lib/libc/include/any-macos.13-any/objc/NSObjCRuntime.h @@ -8,7 +8,7 @@ #include #include -#if __LP64__ || 0 || NS_BUILD_32_LIKE_64 +#if __LP64__ || NS_BUILD_32_LIKE_64 typedef long NSInteger; typedef unsigned long NSUInteger; #else diff --git a/lib/libc/include/x86_64-macos.10-none/objc/message.h b/lib/libc/include/any-macos.13-any/objc/message.h similarity index 83% rename from lib/libc/include/x86_64-macos.10-none/objc/message.h rename to lib/libc/include/any-macos.13-any/objc/message.h index 3c9a5e0d08..a4c17e3b95 100644 --- a/lib/libc/include/x86_64-macos.10-none/objc/message.h +++ b/lib/libc/include/any-macos.13-any/objc/message.h @@ -36,12 +36,8 @@ struct objc_super { __unsafe_unretained _Nonnull id receiver; /// Specifies the particular superclass of the instance to message. -#if !defined(__cplusplus) && !__OBJC2__ - /* For compatibility with old objc-runtime.h header */ - __unsafe_unretained _Nonnull Class class; -#else __unsafe_unretained _Nonnull Class super_class; -#endif + /* super_class is the first class to search */ }; #endif @@ -316,73 +312,4 @@ _objc_msgForward_stret(id _Nonnull receiver, SEL _Nonnull sel, ...) OBJC_ARM64_UNAVAILABLE; #endif - -/* Variable-argument Messaging Primitives - * - * Use these functions to call methods with a list of arguments, such - * as the one passed to forward:: . - * - * The contents of the argument list are architecture-specific. - * Consult your local function call ABI documentation for details. - * - * These functions must be cast to an appropriate function pointer type - * before being called, except for objc_msgSendv_stret() which must not - * be cast to a struct-returning type. - */ - -typedef void* marg_list; - -OBJC_EXPORT id _Nullable -objc_msgSendv(id _Nullable self, SEL _Nonnull op, size_t arg_size, - marg_list _Nonnull arg_frame) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT void -objc_msgSendv_stret(void * _Nonnull stretAddr, id _Nullable self, - SEL _Nonnull op, size_t arg_size, - marg_list _Nullable arg_frame) - OBJC2_UNAVAILABLE; -/* Note that objc_msgSendv_stret() does not return a structure type, - * and should not be cast to do so. This is unlike objc_msgSend_stret() - * and objc_msgSendSuper_stret(). - */ -#if defined(__i386__) -OBJC_EXPORT double -objc_msgSendv_fpret(id _Nullable self, SEL _Nonnull op, - unsigned arg_size, marg_list _Nullable arg_frame) - OBJC2_UNAVAILABLE; -#endif - - -/* The following marg_list macros are of marginal utility. They - * are included for compatibility with the old objc-class.h header. */ - -#if !__OBJC2__ - -#define marg_prearg_size 0 - -#define marg_malloc(margs, method) \ - do { \ - margs = (marg_list *)malloc (marg_prearg_size + ((7 + method_getSizeOfArguments(method)) & ~7)); \ - } while (0) - -#define marg_free(margs) \ - do { \ - free(margs); \ - } while (0) - -#define marg_adjustedOffset(method, offset) \ - (marg_prearg_size + offset) - -#define marg_getRef(margs, offset, type) \ - ( (type *)((char *)margs + marg_adjustedOffset(method,offset) ) ) - -#define marg_getValue(margs, offset, type) \ - ( *marg_getRef(margs, offset, type) ) - -#define marg_setValue(margs, offset, type, value) \ - ( marg_getValue(margs, offset, type) = (value) ) - -#endif - #endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/objc/objc-api.h b/lib/libc/include/any-macos.13-any/objc/objc-api.h similarity index 86% rename from lib/libc/include/x86_64-macos.10-none/objc/objc-api.h rename to lib/libc/include/any-macos.13-any/objc/objc-api.h index 504fee6113..493cc7f89a 100644 --- a/lib/libc/include/x86_64-macos.10-none/objc/objc-api.h +++ b/lib/libc/include/any-macos.13-any/objc/objc-api.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #ifndef __has_feature @@ -96,6 +97,12 @@ # define NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER 1 #endif +/* The arm64 ABI requires proper casting to ensure arguments are passed + * * correctly. */ +#if defined(__arm64__) && !__swift__ +# undef OBJC_OLD_DISPATCH_PROTOTYPES +# define OBJC_OLD_DISPATCH_PROTOTYPES 0 +#endif /* OBJC_OLD_DISPATCH_PROTOTYPES == 0 enforces the rule that the dispatch * functions must be cast to an appropriate function pointer type. */ @@ -147,25 +154,7 @@ /* OBJC_ISA_AVAILABILITY: `isa` will be deprecated or unavailable * in the future */ #if !defined(OBJC_ISA_AVAILABILITY) -# if __OBJC2__ -# define OBJC_ISA_AVAILABILITY __attribute__((deprecated)) -# else -# define OBJC_ISA_AVAILABILITY /* still available */ -# endif -#endif - - -/* OBJC2_UNAVAILABLE: unavailable in objc 2.0, deprecated in Leopard */ -#if !defined(OBJC2_UNAVAILABLE) -# if __OBJC2__ -# define OBJC2_UNAVAILABLE UNAVAILABLE_ATTRIBUTE -# else - /* plain C code also falls here, but this is close enough */ -# define OBJC2_UNAVAILABLE \ - __OSX_DEPRECATED(10.5, 10.5, "not available in __OBJC2__") \ - __IOS_DEPRECATED(2.0, 2.0, "not available in __OBJC2__") \ - __TVOS_UNAVAILABLE __WATCHOS_UNAVAILABLE -# endif +# define OBJC_ISA_AVAILABILITY __attribute__((deprecated)) #endif /* OBJC_UNAVAILABLE: unavailable, with a message where supported */ @@ -227,9 +216,7 @@ #endif #if !defined(OBJC_VISIBLE) - # define OBJC_VISIBLE __attribute__((visibility("default"))) - #endif #if !defined(OBJC_EXPORT) @@ -277,4 +264,41 @@ # endif #endif +/* OBJC_COLD: very rarely called, e.g. on error path */ +#if !defined(OBJC_COLD) +# if __OBJC__ && __has_attribute(cold) +# define OBJC_COLD __attribute__((cold)) +# else +# define OBJC_COLD +# endif +#endif + +/* OBJC_NORETURN: does not return normally, but may throw */ +#if !defined(OBJC_NORETURN) +# if __OBJC__ && __has_attribute(noreturn) +# define OBJC_NORETURN __attribute__((noreturn)) +# else +# define OBJC_NORETURN +# endif +#endif + +/* OBJC_NOESCAPE: marks a block as nonescaping */ +#if !defined(OBJC_NOESCAPE) +# if __has_attribute(noescape) +# define OBJC_NOESCAPE __attribute__((noescape)) +# else +# define OBJC_NOESCAPE +# endif +#endif + +/* OBJC_REFINED_FOR_SWIFT: hide the definition from Swift as we have a + better one in the overlay */ +#if !defined(OBJC_REFINED_FOR_SWIFT) +# if __has_attribute(swift_private) +# define OBJC_REFINED_FOR_SWIFT __attribute__((swift_private)) +# else +# define OBJC_REFINED_FOR_SWIFT +# endif +#endif + #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/objc/objc.h b/lib/libc/include/any-macos.13-any/objc/objc.h new file mode 100644 index 0000000000..fa90236f63 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/objc/objc.h @@ -0,0 +1,236 @@ +/* + * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * objc.h + * Copyright 1988-1996, NeXT Software, Inc. + */ + +#ifndef _OBJC_OBJC_H_ +#define _OBJC_OBJC_H_ + +#include +#include +#include +#include + +#if !OBJC_TYPES_DEFINED +/// An opaque type that represents an Objective-C class. +typedef struct objc_class *Class; + +/// Represents an instance of a class. +struct objc_object { + Class _Nonnull isa OBJC_ISA_AVAILABILITY; +}; + +/// A pointer to an instance of a class. +typedef struct objc_object *id; +#endif + +/// An opaque type that represents a method selector. +typedef struct objc_selector *SEL; + +/// A pointer to the function of a method implementation. +#if !OBJC_OLD_DISPATCH_PROTOTYPES +typedef void (*IMP)(void /* id, SEL, ... */ ); +#else +typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...); +#endif + +/// Type to represent a boolean value. + +#if defined(__OBJC_BOOL_IS_BOOL) + // Honor __OBJC_BOOL_IS_BOOL when available. +# if __OBJC_BOOL_IS_BOOL +# define OBJC_BOOL_IS_BOOL 1 +# else +# define OBJC_BOOL_IS_BOOL 0 +# endif +#else + // __OBJC_BOOL_IS_BOOL not set. +# if TARGET_OS_OSX || TARGET_OS_MACCATALYST || ((TARGET_OS_IOS || 0) && !__LP64__ && !__ARM_ARCH_7K) +# define OBJC_BOOL_IS_BOOL 0 +# else +# define OBJC_BOOL_IS_BOOL 1 +# endif +#endif + +#if OBJC_BOOL_IS_BOOL + typedef bool BOOL; +#else +# define OBJC_BOOL_IS_CHAR 1 + typedef signed char BOOL; + // BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C" + // even if -funsigned-char is used. +#endif + +#define OBJC_BOOL_DEFINED + +#if __has_feature(objc_bool) +#define YES __objc_yes +#define NO __objc_no +#else +#define YES ((BOOL)1) +#define NO ((BOOL)0) +#endif + +#ifndef Nil +# if __has_feature(cxx_nullptr) +# define Nil nullptr +# else +# define Nil __DARWIN_NULL +# endif +#endif + +#ifndef nil +# if __has_feature(cxx_nullptr) +# define nil nullptr +# else +# define nil __DARWIN_NULL +# endif +#endif + +#ifndef __strong +# if !__has_feature(objc_arc) +# define __strong /* empty */ +# endif +#endif + +#ifndef __unsafe_unretained +# if !__has_feature(objc_arc) +# define __unsafe_unretained /* empty */ +# endif +#endif + +#ifndef __autoreleasing +# if !__has_feature(objc_arc) +# define __autoreleasing /* empty */ +# endif +#endif + +/// Forward declaration for zone support +typedef struct _malloc_zone_t *objc_zone_t; + +/** + * Returns the name of the method specified by a given selector. + * + * @param sel A pointer of type \c SEL. Pass the selector whose name you wish to determine. + * + * @return A C string indicating the name of the selector. + */ +OBJC_EXPORT const char * _Nonnull sel_getName(SEL _Nonnull sel) + OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0); + +/** + * Registers a method with the Objective-C runtime system, maps the method + * name to a selector, and returns the selector value. + * + * @param str A pointer to a C string. Pass the name of the method you wish to register. + * + * @return A pointer of type SEL specifying the selector for the named method. + * + * @note You must register a method name with the Objective-C runtime system to obtain the + * method’s selector before you can add the method to a class definition. If the method name + * has already been registered, this function simply returns the selector. + */ +OBJC_EXPORT SEL _Nonnull sel_registerName(const char * _Nonnull str) + OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0); + +/** + * Returns the class name of a given object. + * + * @param obj An Objective-C object. + * + * @return The name of the class of which \e obj is an instance. + */ +OBJC_EXPORT const char * _Nonnull object_getClassName(id _Nullable obj) + OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0); + +/** + * Returns a pointer to any extra bytes allocated with an instance given object. + * + * @param obj An Objective-C object. + * + * @return A pointer to any extra bytes allocated with \e obj. If \e obj was + * not allocated with any extra bytes, then dereferencing the returned pointer is undefined. + * + * @note This function returns a pointer to any extra bytes allocated with the instance + * (as specified by \c class_createInstance with extraBytes>0). This memory follows the + * object's ordinary ivars, but may not be adjacent to the last ivar. + * @note The returned pointer is guaranteed to be pointer-size aligned, even if the area following + * the object's last ivar is less aligned than that. Alignment greater than pointer-size is never + * guaranteed, even if the area following the object's last ivar is more aligned than that. + * @note In a garbage-collected environment, the memory is scanned conservatively. + */ +OBJC_EXPORT void * _Nullable object_getIndexedIvars(id _Nullable obj) + OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0); + +/** + * Identifies a selector as being valid or invalid. + * + * @param sel The selector you want to identify. + * + * @return YES if selector is valid and has a function implementation, NO otherwise. + * + * @warning On some platforms, an invalid reference (to invalid memory addresses) can cause + * a crash. + */ +OBJC_EXPORT BOOL sel_isMapped(SEL _Nonnull sel) + OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0); + +/** + * Registers a method name with the Objective-C runtime system. + * + * @param str A pointer to a C string. Pass the name of the method you wish to register. + * + * @return A pointer of type SEL specifying the selector for the named method. + * + * @note The implementation of this method is identical to the implementation of \c sel_registerName. + * @note Prior to OS X version 10.0, this method tried to find the selector mapped to the given name + * and returned \c NULL if the selector was not found. This was changed for safety, because it was + * observed that many of the callers of this function did not check the return value for \c NULL. + */ +OBJC_EXPORT SEL _Nonnull sel_getUid(const char * _Nonnull str) + OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0); + +typedef const void* objc_objectptr_t; + + +// Obsolete ARC conversions. + +OBJC_EXPORT id _Nullable objc_retainedObject(objc_objectptr_t _Nullable obj) +#if !OBJC_DECLARE_SYMBOLS + OBJC_UNAVAILABLE("use CFBridgingRelease() or a (__bridge_transfer id) cast instead") +#endif + ; +OBJC_EXPORT id _Nullable objc_unretainedObject(objc_objectptr_t _Nullable obj) +#if !OBJC_DECLARE_SYMBOLS + OBJC_UNAVAILABLE("use a (__bridge id) cast instead") +#endif + ; +OBJC_EXPORT objc_objectptr_t _Nullable objc_unretainedPointer(id _Nullable obj) +#if !OBJC_DECLARE_SYMBOLS + OBJC_UNAVAILABLE("use a __bridge cast instead") +#endif + ; + +#endif /* _OBJC_OBJC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/objc/runtime.h b/lib/libc/include/any-macos.13-any/objc/runtime.h similarity index 85% rename from lib/libc/include/x86_64-macos.10-none/objc/runtime.h rename to lib/libc/include/any-macos.13-any/objc/runtime.h index 0b49b72559..5d8cf96e06 100644 --- a/lib/libc/include/x86_64-macos.10-none/objc/runtime.h +++ b/lib/libc/include/any-macos.13-any/objc/runtime.h @@ -32,7 +32,7 @@ #include #if TARGET_OS_MAC -#include +#include #endif @@ -52,24 +52,6 @@ typedef struct objc_category *Category; /// An opaque type that represents an Objective-C declared property. typedef struct objc_property *objc_property_t; -struct objc_class { - Class _Nonnull isa OBJC_ISA_AVAILABILITY; - -#if !__OBJC2__ - Class _Nullable super_class OBJC2_UNAVAILABLE; - const char * _Nonnull name OBJC2_UNAVAILABLE; - long version OBJC2_UNAVAILABLE; - long info OBJC2_UNAVAILABLE; - long instance_size OBJC2_UNAVAILABLE; - struct objc_ivar_list * _Nullable ivars OBJC2_UNAVAILABLE; - struct objc_method_list * _Nullable * _Nullable methodLists OBJC2_UNAVAILABLE; - struct objc_cache * _Nonnull cache OBJC2_UNAVAILABLE; - struct objc_protocol_list * _Nullable protocols OBJC2_UNAVAILABLE; -#endif - -} OBJC2_UNAVAILABLE; -/* Use `Class` instead of `struct objc_class *` */ - #endif #ifdef __OBJC__ @@ -277,13 +259,8 @@ object_getInstanceVariable(id _Nullable obj, const char * _Nonnull name, * @return The Class object for the named class, or \c nil * if the class is not registered with the Objective-C runtime. * - * @note \c objc_getClass is different from \c objc_lookUpClass in that if the class - * is not registered, \c objc_getClass calls the class handler callback and then checks - * a second time to see whether the class is registered. \c objc_lookUpClass does - * not call the class handler callback. - * - * @warning Earlier implementations of this function (prior to OS X v10.0) - * terminate the program if the class does not exist. + * @note The implementation of \c objc_getClass is identical to the implementation + * of \c objc_lookUpClass. */ OBJC_EXPORT Class _Nullable objc_getClass(const char * _Nonnull name) @@ -314,9 +291,8 @@ objc_getMetaClass(const char * _Nonnull name) * @return The Class object for the named class, or \c nil if the class * is not registered with the Objective-C runtime. * - * @note \c objc_getClass is different from this function in that if the class is not - * registered, \c objc_getClass calls the class handler callback and then checks a second - * time to see whether the class is registered. This function does not call the class handler callback. + * @note The implementation of \c objc_lookUpClass is identical to the implementation + * of \c objc_getClass. */ OBJC_EXPORT Class _Nullable objc_lookUpClass(const char * _Nonnull name) @@ -330,7 +306,6 @@ objc_lookUpClass(const char * _Nonnull name) * @return The Class object for the named class. * * @note This function is the same as \c objc_getClass, but kills the process if the class is not found. - * @note This function is used by ZeroLink, where failing to find a class would be a compile-time link error without ZeroLink. */ OBJC_EXPORT Class _Nonnull objc_getRequiredClass(const char * _Nonnull name) @@ -373,6 +348,32 @@ OBJC_EXPORT Class _Nonnull * _Nullable objc_copyClassList(unsigned int * _Nullable outCount) OBJC_AVAILABLE(10.7, 3.1, 9.0, 1.0, 2.0); +/** + * Enumerates classes, filtering by image, name, protocol conformance and superclass. + * + * @param image The image to search. Can be NULL (search the caller's image), + * OBJC_DYNAMIC_CLASSES (search dynamically registered classes), + * a handle returned by dlopen(3), or the Mach header of an image + * loaded into the current process. + * @param namePrefix If non-NULL, a required prefix for the class name. + * @param conformingTo If non-NULL, a protocol to which the enumerated classes + * must conform. + * @param subclassing If non-NULL, a class which the enumerated classes must + * subclass. + * @param block A block that is called for each matching class. Can abort + * enumeration by setting *stop to YES. + * + */ +#define OBJC_DYNAMIC_CLASSES ((const void *)-1) +OBJC_EXPORT void +objc_enumerateClasses(const void * _Nullable image, + const char * _Nullable namePrefix, + Protocol * _Nullable conformingTo, + Class _Nullable subclassing, + void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop) + OBJC_NOESCAPE) + OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0) + OBJC_REFINED_FOR_SWIFT; /* Working with Classes */ @@ -1063,7 +1064,7 @@ method_getDescription(Method _Nonnull m) * Sets the implementation of a method. * * @param m The method for which to set an implementation. - * @param imp The implemention to set to this method. + * @param imp The implementation to set to this method. * * @return The previous implementation of the method. */ @@ -1556,6 +1557,8 @@ OBJC_EXPORT void objc_setForwardHandler(void * _Nonnull fwd, void * _Nonnull fwd_stret) OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); +#if !0 + /** * Creates a pointer to a function that will call the block * when the method is called. @@ -1598,6 +1601,8 @@ OBJC_EXPORT BOOL imp_removeBlock(IMP _Nonnull anImp) OBJC_AVAILABLE(10.7, 4.3, 9.0, 1.0, 2.0); +#endif + /** * This loads the object referenced by a weak pointer and returns it, after * retaining and autoreleasing the object to ensure that it stays alive @@ -1765,43 +1770,6 @@ OBJC_EXPORT void objc_setHook_getClass(objc_hook_getClass _Nonnull newValue, OBJC_AVAILABLE(10.14.4, 12.2, 12.2, 5.2, 3.2); #endif -/** - * Function type for a hook that assists objc_setAssociatedObject(). - * - * @param object The source object for the association. - * @param key The key for the association. - * @param value The value to associate with the key key for object. Pass nil to clear an existing association. - * @param policy The policy for the association. For possible values, see “Associative Object Behaviors.” - * - * @see objc_setAssociatedObject - * @see objc_setHook_setAssociatedObject - */ -typedef void (*objc_hook_setAssociatedObject)(id _Nonnull object, const void * _Nonnull key, - id _Nullable value, objc_AssociationPolicy policy); - -/** - * Install a hook for objc_setAssociatedObject(). - * - * @param newValue The hook function to install. - * @param outOldValue The address of a function pointer variable. On return, - * the old hook function is stored in the variable. - * - * @note The store to *outOldValue is thread-safe: the variable will be - * updated before objc_setAssociatedObject() calls your new hook to read it, - * even if your new hook is called from another thread before this - * setter completes. - * @note Your hook should always call the previous hook. - * - * @see objc_setAssociatedObject - * @see objc_hook_setAssociatedObject - */ -#if !(TARGET_OS_OSX && __i386__) -#define OBJC_SETASSOCIATEDOBJECTHOOK_DEFINED 1 -OBJC_EXPORT void objc_setHook_setAssociatedObject(objc_hook_setAssociatedObject _Nonnull newValue, - objc_hook_setAssociatedObject _Nullable * _Nonnull outOldValue) - OBJC_AVAILABLE(10.15, 13.0, 13.0, 6.0, 4.0); -#endif - /** * Function type for a function that is called when an image is loaded. * @@ -1829,7 +1797,39 @@ typedef void (*objc_func_loadImage)(const struct mach_header * _Nonnull header); OBJC_EXPORT void objc_addLoadImageFunc(objc_func_loadImage _Nonnull func) OBJC_AVAILABLE(10.15, 13.0, 13.0, 6.0, 4.0); -/** +/** + * Function type for a hook that provides a name for lazily named classes. + * + * @param cls The class to generate a name for. + * @return The name of the class, or NULL if the name isn't known or can't me generated. + * + * @see objc_setHook_lazyClassNamer + */ +typedef const char * _Nullable (*objc_hook_lazyClassNamer)(_Nonnull Class cls); + +/** + * Install a hook to provide a name for lazily-named classes. + * + * @param newValue The hook function to install. + * @param outOldValue The address of a function pointer variable. On return, + * the old hook function is stored in the variable. + * + * @note The store to *outOldValue is thread-safe: the variable will be + * updated before objc_getClass() calls your new hook to read it, + * even if your new hook is called from another thread before this + * setter completes. + * @note Your hook must call the previous hook for class names + * that you do not recognize. + */ +#if !(TARGET_OS_OSX && __i386__) +#define OBJC_SETHOOK_LAZYCLASSNAMER_DEFINED 1 +OBJC_EXPORT +void objc_setHook_lazyClassNamer(_Nonnull objc_hook_lazyClassNamer newValue, + _Nonnull objc_hook_lazyClassNamer * _Nonnull oldOutValue) + OBJC_AVAILABLE(11.0, 14.0, 14.0, 7.0, 5.0); +#endif + +/** * Callback from Objective-C to Swift to perform Swift class initialization. */ #if !(TARGET_OS_OSX && __i386__) @@ -1850,188 +1850,58 @@ _objc_realizeClassFromSwift(Class _Nullable cls, void * _Nullable previously) OBJC_AVAILABLE(10.14.4, 12.2, 12.2, 5.2, 3.2); #endif +// Type encoding characters +#define _C_ID '@' +#define _C_CLASS '#' +#define _C_SEL ':' +#define _C_CHR 'c' +#define _C_UCHR 'C' +#define _C_SHT 's' +#define _C_USHT 'S' +#define _C_INT 'i' +#define _C_UINT 'I' +#define _C_LNG 'l' +#define _C_ULNG 'L' +#define _C_LNG_LNG 'q' +#define _C_ULNG_LNG 'Q' +#define _C_INT128 't' +#define _C_UINT128 'T' +#define _C_FLT 'f' +#define _C_DBL 'd' +#define _C_LNG_DBL 'D' +#define _C_BFLD 'b' +#define _C_BOOL 'B' +#define _C_VOID 'v' +#define _C_UNDEF '?' +#define _C_PTR '^' +#define _C_CHARPTR '*' +#define _C_ATOM '%' +#define _C_ARY_B '[' +#define _C_ARY_E ']' +#define _C_UNION_B '(' +#define _C_UNION_E ')' +#define _C_STRUCT_B '{' +#define _C_STRUCT_E '}' +#define _C_VECTOR '!' -#define _C_ID '@' -#define _C_CLASS '#' -#define _C_SEL ':' -#define _C_CHR 'c' -#define _C_UCHR 'C' -#define _C_SHT 's' -#define _C_USHT 'S' -#define _C_INT 'i' -#define _C_UINT 'I' -#define _C_LNG 'l' -#define _C_ULNG 'L' -#define _C_LNG_LNG 'q' -#define _C_ULNG_LNG 'Q' -#define _C_FLT 'f' -#define _C_DBL 'd' -#define _C_BFLD 'b' -#define _C_BOOL 'B' -#define _C_VOID 'v' -#define _C_UNDEF '?' -#define _C_PTR '^' -#define _C_CHARPTR '*' -#define _C_ATOM '%' -#define _C_ARY_B '[' -#define _C_ARY_E ']' -#define _C_UNION_B '(' -#define _C_UNION_E ')' -#define _C_STRUCT_B '{' -#define _C_STRUCT_E '}' -#define _C_VECTOR '!' -#define _C_CONST 'r' - - -/* Obsolete types */ - -#if !__OBJC2__ - -#define CLS_GETINFO(cls,infomask) ((cls)->info & (infomask)) -#define CLS_SETINFO(cls,infomask) ((cls)->info |= (infomask)) - -// class is not a metaclass -#define CLS_CLASS 0x1 -// class is a metaclass -#define CLS_META 0x2 -// class's +initialize method has completed -#define CLS_INITIALIZED 0x4 -// class is posing -#define CLS_POSING 0x8 -// unused -#define CLS_MAPPED 0x10 -// class and subclasses need cache flush during image loading -#define CLS_FLUSH_CACHE 0x20 -// method cache should grow when full -#define CLS_GROW_CACHE 0x40 -// unused -#define CLS_NEED_BIND 0x80 -// methodLists is array of method lists -#define CLS_METHOD_ARRAY 0x100 -// the JavaBridge constructs classes with these markers -#define CLS_JAVA_HYBRID 0x200 -#define CLS_JAVA_CLASS 0x400 -// thread-safe +initialize -#define CLS_INITIALIZING 0x800 -// bundle unloading -#define CLS_FROM_BUNDLE 0x1000 -// C++ ivar support -#define CLS_HAS_CXX_STRUCTORS 0x2000 -// Lazy method list arrays -#define CLS_NO_METHOD_ARRAY 0x4000 -// +load implementation -#define CLS_HAS_LOAD_METHOD 0x8000 -// objc_allocateClassPair API -#define CLS_CONSTRUCTING 0x10000 -// class compiled with bigger class structure -#define CLS_EXT 0x20000 - - -struct objc_method_description_list { - int count; - struct objc_method_description list[1]; -}; - - -struct objc_protocol_list { - struct objc_protocol_list * _Nullable next; - long count; - __unsafe_unretained Protocol * _Nullable list[1]; -}; - - -struct objc_category { - char * _Nonnull category_name OBJC2_UNAVAILABLE; - char * _Nonnull class_name OBJC2_UNAVAILABLE; - struct objc_method_list * _Nullable instance_methods OBJC2_UNAVAILABLE; - struct objc_method_list * _Nullable class_methods OBJC2_UNAVAILABLE; - struct objc_protocol_list * _Nullable protocols OBJC2_UNAVAILABLE; -} OBJC2_UNAVAILABLE; - - -struct objc_ivar { - char * _Nullable ivar_name OBJC2_UNAVAILABLE; - char * _Nullable ivar_type OBJC2_UNAVAILABLE; - int ivar_offset OBJC2_UNAVAILABLE; -#ifdef __LP64__ - int space OBJC2_UNAVAILABLE; -#endif -} OBJC2_UNAVAILABLE; - -struct objc_ivar_list { - int ivar_count OBJC2_UNAVAILABLE; -#ifdef __LP64__ - int space OBJC2_UNAVAILABLE; -#endif - /* variable length structure */ - struct objc_ivar ivar_list[1] OBJC2_UNAVAILABLE; -} OBJC2_UNAVAILABLE; - - -struct objc_method { - SEL _Nonnull method_name OBJC2_UNAVAILABLE; - char * _Nullable method_types OBJC2_UNAVAILABLE; - IMP _Nonnull method_imp OBJC2_UNAVAILABLE; -} OBJC2_UNAVAILABLE; - -struct objc_method_list { - struct objc_method_list * _Nullable obsolete OBJC2_UNAVAILABLE; - - int method_count OBJC2_UNAVAILABLE; -#ifdef __LP64__ - int space OBJC2_UNAVAILABLE; -#endif - /* variable length structure */ - struct objc_method method_list[1] OBJC2_UNAVAILABLE; -} OBJC2_UNAVAILABLE; - - -typedef struct objc_symtab *Symtab OBJC2_UNAVAILABLE; - -struct objc_symtab { - unsigned long sel_ref_cnt OBJC2_UNAVAILABLE; - SEL _Nonnull * _Nullable refs OBJC2_UNAVAILABLE; - unsigned short cls_def_cnt OBJC2_UNAVAILABLE; - unsigned short cat_def_cnt OBJC2_UNAVAILABLE; - void * _Nullable defs[1] /* variable size */ OBJC2_UNAVAILABLE; -} OBJC2_UNAVAILABLE; - - -typedef struct objc_cache *Cache OBJC2_UNAVAILABLE; - -#define CACHE_BUCKET_NAME(B) ((B)->method_name) -#define CACHE_BUCKET_IMP(B) ((B)->method_imp) -#define CACHE_BUCKET_VALID(B) (B) -#ifndef __LP64__ -#define CACHE_HASH(sel, mask) (((uintptr_t)(sel)>>2) & (mask)) -#else -#define CACHE_HASH(sel, mask) (((unsigned int)((uintptr_t)(sel)>>3)) & (mask)) -#endif -struct objc_cache { - unsigned int mask /* total = mask + 1 */ OBJC2_UNAVAILABLE; - unsigned int occupied OBJC2_UNAVAILABLE; - Method _Nullable buckets[1] OBJC2_UNAVAILABLE; -}; - - -typedef struct objc_module *Module OBJC2_UNAVAILABLE; - -struct objc_module { - unsigned long version OBJC2_UNAVAILABLE; - unsigned long size OBJC2_UNAVAILABLE; - const char * _Nullable name OBJC2_UNAVAILABLE; - Symtab _Nullable symtab OBJC2_UNAVAILABLE; -} OBJC2_UNAVAILABLE; - -#else +// Modifiers +#define _C_COMPLEX 'j' +#define _C_ATOMIC 'A' +#define _C_CONST 'r' +#define _C_IN 'n' +#define _C_INOUT 'N' +#define _C_OUT 'o' +#define _C_BYCOPY 'O' +#define _C_BYREF 'R' +#define _C_ONEWAY 'V' +#define _C_GNUREGISTER '+' struct objc_method_list; -#endif - - /* Obsolete functions */ +#if !0 + OBJC_EXPORT IMP _Nullable class_lookupMethod(Class _Nullable cls, SEL _Nonnull sel) __OSX_DEPRECATED(10.0, 10.5, "use class_getMethodImplementation instead") @@ -2062,108 +1932,11 @@ OBJC_EXPORT id _Nullable object_copyFromZone(id _Nullable anObject, size_t nBytes, void * _Nullable z) OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE(10.0, 10.5, "use object_copy instead"); -OBJC_EXPORT id _Nullable -object_realloc(id _Nullable anObject, size_t nBytes) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT id _Nullable -object_reallocFromZone(id _Nullable anObject, size_t nBytes, void * _Nullable z) - OBJC2_UNAVAILABLE; - -#define OBSOLETE_OBJC_GETCLASSES 1 -OBJC_EXPORT void * _Nonnull -objc_getClasses(void) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT void -objc_addClass(Class _Nonnull myClass) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT void -objc_setClassHandler(int (* _Nullable )(const char * _Nonnull)) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT void -objc_setMultithreaded(BOOL flag) - OBJC2_UNAVAILABLE; - OBJC_EXPORT id _Nullable class_createInstanceFromZone(Class _Nullable, size_t idxIvars, void * _Nullable z) OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE(10.0, 10.5, "use class_createInstance instead"); -OBJC_EXPORT void -class_addMethods(Class _Nullable, struct objc_method_list * _Nonnull) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT void -class_removeMethods(Class _Nullable, struct objc_method_list * _Nonnull) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT void -_objc_resolve_categories_for_class(Class _Nonnull cls) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT Class _Nonnull -class_poseAs(Class _Nonnull imposter, Class _Nonnull original) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT unsigned int -method_getSizeOfArguments(Method _Nonnull m) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT unsigned -method_getArgumentInfo(struct objc_method * _Nonnull m, int arg, - const char * _Nullable * _Nonnull type, - int * _Nonnull offset) - UNAVAILABLE_ATTRIBUTE // This function was accidentally deleted in 10.9. - OBJC2_UNAVAILABLE; - -OBJC_EXPORT Class _Nullable -objc_getOrigClass(const char * _Nonnull name) - OBJC2_UNAVAILABLE; - -#define OBJC_NEXT_METHOD_LIST 1 -OBJC_EXPORT struct objc_method_list * _Nullable -class_nextMethodList(Class _Nullable, void * _Nullable * _Nullable) - OBJC2_UNAVAILABLE; -// usage for nextMethodList -// -// void *iterator = 0; -// struct objc_method_list *mlist; -// while ( mlist = class_nextMethodList( cls, &iterator ) ) -// ; - -OBJC_EXPORT id _Nullable -(* _Nonnull _alloc)(Class _Nullable, size_t) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT id _Nullable -(* _Nonnull _copy)(id _Nullable, size_t) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT id _Nullable -(* _Nonnull _realloc)(id _Nullable, size_t) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT id _Nullable -(* _Nonnull _dealloc)(id _Nullable) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT id _Nullable -(* _Nonnull _zoneAlloc)(Class _Nullable, size_t, void * _Nullable) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT id _Nullable -(* _Nonnull _zoneRealloc)(id _Nullable, size_t, void * _Nullable) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT id _Nullable -(* _Nonnull _zoneCopy)(id _Nullable, size_t, void * _Nullable) - OBJC2_UNAVAILABLE; - -OBJC_EXPORT void -(* _Nonnull _error)(id _Nullable, const char * _Nonnull, va_list) - OBJC2_UNAVAILABLE; +#endif #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/os/availability.h b/lib/libc/include/any-macos.13-any/os/availability.h new file mode 100644 index 0000000000..ea0a9a8d14 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/os/availability.h @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2008-2017 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __OS_AVAILABILITY__ +#define __OS_AVAILABILITY__ + +/* + * API_TO_BE_DEPRECATED is used as a version number in API that will be deprecated + * in an upcoming release. This soft deprecation is an intermediate step before formal + * deprecation to notify developers about the API before compiler warnings are generated. + * You can find all places in your code that use soft deprecated API by redefining the + * value of this macro to your current minimum deployment target, for example: + * (macOS) + * clang -DAPI_TO_BE_DEPRECATED=10.12 + * (iOS) + * clang -DAPI_TO_BE_DEPRECATED=11.0 + */ + +#ifndef API_TO_BE_DEPRECATED +#define API_TO_BE_DEPRECATED 100000 +#endif + +#ifndef API_TO_BE_DEPRECATED_MACOS +#define API_TO_BE_DEPRECATED_MACOS 100000 +#endif + +#ifndef API_TO_BE_DEPRECATED_IOS +#define API_TO_BE_DEPRECATED_IOS 100000 +#endif + +#ifndef API_TO_BE_DEPRECATED_TVOS +#define API_TO_BE_DEPRECATED_TVOS 100000 +#endif + +#ifndef API_TO_BE_DEPRECATED_WATCHOS +#define API_TO_BE_DEPRECATED_WATCHOS 100000 +#endif + +#ifndef __API_TO_BE_DEPRECATED_BRIDGEOS + +#endif + +#ifndef __API_TO_BE_DEPRECATED_MACCATALYST +#define __API_TO_BE_DEPRECATED_MACCATALYST 100000 +#endif + +#ifndef API_TO_BE_DEPRECATED_DRIVERKIT +#define API_TO_BE_DEPRECATED_DRIVERKIT 100000 +#endif + + + +#include + + + +#if defined(__has_feature) && defined(__has_attribute) + #if __has_attribute(availability) + + /* + * API Introductions + * + * Use to specify the release that a particular API became available. + * + * Platform names: + * macos, ios, tvos, watchos + * + * Examples: + * API_AVAILABLE(macos(10.10)) + * API_AVAILABLE(macos(10.9), ios(10.0)) + * API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0)) + */ + + #define API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE8, __API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__) + + #define API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE8,__API_AVAILABLE_BEGIN7,__API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__) + #define API_AVAILABLE_END _Pragma("clang attribute pop") + + /* + * API Deprecations + * + * Use to specify the release that a particular API became unavailable. + * + * Platform names: + * macos, ios, tvos, watchos + * + * Examples: + * + * API_DEPRECATED("No longer supported", macos(10.4, 10.8)) + * API_DEPRECATED("No longer supported", macos(10.4, 10.8), ios(2.0, 3.0), watchos(2.0, 3.0), tvos(9.0, 10.0)) + * + * API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0)) + * API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0)) + */ + + #define API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG9,__API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7, __API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__) + #define API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP9,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7, __API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__) + + #define API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG9,__API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__) + #define API_DEPRECATED_END _Pragma("clang attribute pop") + + #define API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP9,__API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__) + #define API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop") + + + /* + * API Unavailability + * Use to specify that an API is unavailable for a particular platform. + * + * Example: + * API_UNAVAILABLE(macos) + * API_UNAVAILABLE(watchos, tvos) + */ + + #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE8,__API_UNAVAILABLE7,__API_UNAVAILABLE6, __API_UNAVAILABLE5, __API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__) + + #define API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN8,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__) + #define API_UNAVAILABLE_END _Pragma("clang attribute pop") + #else + + /* + * Evaluate to nothing for compilers that don't support availability. + */ + + #define API_AVAILABLE(...) + #define API_AVAILABLE_BEGIN(...) + #define API_AVAILABLE_END + #define API_DEPRECATED(...) + #define API_DEPRECATED_WITH_REPLACEMENT(...) + #define API_DEPRECATED_BEGIN(...) + #define API_DEPRECATED_END + #define API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) + #define API_DEPRECATED_WITH_REPLACEMENT_END + #define API_UNAVAILABLE(...) + #define API_UNAVAILABLE_BEGIN(...) + #define API_UNAVAILABLE_END + #endif /* __has_attribute(availability) */ +#else + + /* + * Evaluate to nothing for compilers that don't support clang language extensions. + */ + + #define API_AVAILABLE(...) + #define API_AVAILABLE_BEGIN(...) + #define API_AVAILABLE_END + #define API_DEPRECATED(...) + #define API_DEPRECATED_WITH_REPLACEMENT(...) + #define API_DEPRECATED_BEGIN(...) + #define API_DEPRECATED_END + #define API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) + #define API_DEPRECATED_WITH_REPLACEMENT_END + #define API_UNAVAILABLE(...) + #define API_UNAVAILABLE_BEGIN(...) + #define API_UNAVAILABLE_END +#endif /* #if defined(__has_feature) && defined(__has_attribute) */ + +#if __has_include() + #include +#endif + +/* + * If SPI decorations have not been defined elsewhere, disable them. + */ + +#ifndef SPI_AVAILABLE + #define SPI_AVAILABLE(...) +#endif + +#ifndef SPI_DEPRECATED + #define SPI_DEPRECATED(...) +#endif + +#ifndef SPI_DEPRECATED_WITH_REPLACEMENT + #define SPI_DEPRECATED_WITH_REPLACEMENT(...) +#endif + +#endif /* __OS_AVAILABILITY__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/os/base.h b/lib/libc/include/any-macos.13-any/os/base.h similarity index 82% rename from lib/libc/include/x86_64-macos.10-none/os/base.h rename to lib/libc/include/any-macos.13-any/os/base.h index a57f8373a4..ab587fa02b 100644 --- a/lib/libc/include/x86_64-macos.10-none/os/base.h +++ b/lib/libc/include/any-macos.13-any/os/base.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2013 Apple Inc. All rights reserved. + * Copyright (c) 2008-2020 Apple Inc. All rights reserved. * * @APPLE_APACHE_LICENSE_HEADER_START@ * @@ -23,6 +23,7 @@ #include + #ifndef __has_builtin #define __has_builtin(x) 0 #endif @@ -73,7 +74,7 @@ #define OS_ALWAYS_INLINE __attribute__((__always_inline__)) #define OS_TRANSPARENT_UNION __attribute__((__transparent_union__)) #define OS_ALIGNED(n) __attribute__((__aligned__((n)))) -#define OS_FORMAT_PRINTF(x,y) __attribute__((__format__(printf,x,y))) +#define OS_FORMAT_PRINTF(x, y) __attribute__((__format__(printf,x,y))) #define OS_EXPORT extern __attribute__((__visibility__("default"))) #define OS_INLINE static __inline__ #define OS_EXPECT(x, v) __builtin_expect((x), (v)) @@ -110,7 +111,7 @@ #define OS_ALWAYS_INLINE #define OS_TRANSPARENT_UNION #define OS_ALIGNED(n) -#define OS_FORMAT_PRINTF(x,y) +#define OS_FORMAT_PRINTF(x, y) #define OS_EXPORT extern #define OS_INLINE static inline #define OS_EXPECT(x, v) (x) @@ -124,6 +125,8 @@ #if defined(__cplusplus) && defined(__clang__) #define OS_FALLTHROUGH [[clang::fallthrough]] +#elif __has_attribute(fallthrough) +#define OS_FALLTHROUGH __attribute__((__fallthrough__)) #else #define OS_FALLTHROUGH #endif @@ -148,6 +151,12 @@ #define OS_OVERLOADABLE #endif +#if __has_attribute(analyzer_suppress) +#define OS_ANALYZER_SUPPRESS(RADAR) __attribute__((analyzer_suppress)) +#else +#define OS_ANALYZER_SUPPRESS(RADAR) +#endif + #if __has_attribute(enum_extensibility) #define __OS_ENUM_ATTR __attribute__((enum_extensibility(open))) #define __OS_ENUM_ATTR_CLOSED __attribute__((enum_extensibility(closed))) @@ -164,30 +173,21 @@ * -Wassign-enum prevents you from assigning illegal values to a variable of the * enum type. */ -#ifndef __OPEN_SOURCE__ -/*! - * @internal - * - */ -#endif // __OPEN_SOURCE__ #define __OS_OPTIONS_ATTR __attribute__((flag_enum)) #else #define __OS_OPTIONS_ATTR #endif // __has_attribute(flag_enum) #if __has_feature(objc_fixed_enum) || __has_extension(cxx_fixed_enum) || \ - __has_extension(cxx_strong_enums) + __has_extension(cxx_strong_enums) #define OS_ENUM(_name, _type, ...) \ - typedef enum : _type { __VA_ARGS__ } _name##_t + typedef enum : _type { __VA_ARGS__ } _name##_t #define OS_CLOSED_ENUM(_name, _type, ...) \ - typedef enum : _type { __VA_ARGS__ } \ - __OS_ENUM_ATTR_CLOSED _name##_t + typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED _name##_t #define OS_OPTIONS(_name, _type, ...) \ - typedef enum : _type { __VA_ARGS__ } \ - __OS_ENUM_ATTR __OS_OPTIONS_ATTR _name##_t + typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR __OS_OPTIONS_ATTR _name##_t #define OS_CLOSED_OPTIONS(_name, _type, ...) \ - typedef enum : _type { __VA_ARGS__ } \ - __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR _name##_t + typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR _name##_t #else /*! * There is unfortunately no good way in plain C to have both fixed-type enums @@ -220,29 +220,36 @@ * When compiling in ObjC or C++, both of the above assignments are illegal. */ #define __OS_ENUM_C_FALLBACK(_name, _type, ...) \ - typedef _type _name##_t; enum _name { __VA_ARGS__ } + typedef _type _name##_t; enum _name { __VA_ARGS__ } #define OS_ENUM(_name, _type, ...) \ - typedef _type _name##_t; enum { __VA_ARGS__ } + typedef _type _name##_t; enum { __VA_ARGS__ } #define OS_CLOSED_ENUM(_name, _type, ...) \ - __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ - __OS_ENUM_ATTR_CLOSED + __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ + __OS_ENUM_ATTR_CLOSED #define OS_OPTIONS(_name, _type, ...) \ - __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ - __OS_ENUM_ATTR __OS_OPTIONS_ATTR + __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ + __OS_ENUM_ATTR __OS_OPTIONS_ATTR #define OS_CLOSED_OPTIONS(_name, _type, ...) \ - __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ - __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR + __OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \ + __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR #endif // __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) #if __has_feature(attribute_availability_swift) // equivalent to __SWIFT_UNAVAILABLE from Availability.h #define OS_SWIFT_UNAVAILABLE(_msg) \ - __attribute__((__availability__(swift, unavailable, message=_msg))) + __attribute__((__availability__(swift, unavailable, message=_msg))) #else #define OS_SWIFT_UNAVAILABLE(_msg) #endif +#if __has_attribute(__swift_attr__) +#define OS_SWIFT_UNAVAILABLE_FROM_ASYNC(msg) \ + __attribute__((__swift_attr__("@_unavailableFromAsync(message: \"" msg "\")"))) +#else +#define OS_SWIFT_UNAVAILABLE_FROM_ASYNC(msg) +#endif + #if __has_attribute(swift_private) # define OS_REFINED_FOR_SWIFT __attribute__((__swift_private__)) #else @@ -262,12 +269,12 @@ #ifdef __GNUC__ #define os_prevent_tail_call_optimization() __asm__("") -#define os_is_compile_time_constant(expr) __builtin_constant_p(expr) -#define os_compiler_barrier() __asm__ __volatile__("" ::: "memory") +#define os_is_compile_time_constant(expr) __builtin_constant_p(expr) +#define os_compiler_barrier() __asm__ __volatile__("" ::: "memory") #else #define os_prevent_tail_call_optimization() do { } while (0) -#define os_is_compile_time_constant(expr) 0 -#define os_compiler_barrier() do { } while (0) +#define os_is_compile_time_constant(expr) 0 +#define os_compiler_barrier() do { } while (0) #endif #if __has_attribute(not_tail_called) @@ -276,6 +283,7 @@ #define OS_NOT_TAIL_CALLED #endif + typedef void (*os_function_t)(void *_Nullable); #ifdef __BLOCKS__ @@ -322,4 +330,13 @@ typedef void (*os_function_t)(void *_Nullable); typedef void (^os_block_t)(void); #endif + + +#define OS_ASSUME_PTR_ABI_SINGLE_BEGIN __ASSUME_PTR_ABI_SINGLE_BEGIN +#define OS_ASSUME_PTR_ABI_SINGLE_END __ASSUME_PTR_ABI_SINGLE_END +#define OS_UNSAFE_INDEXABLE __unsafe_indexable +#define OS_HEADER_INDEXABLE __header_indexable +#define OS_COUNTED_BY(N) __counted_by(N) +#define OS_SIZED_BY(N) __sized_by(N) + #endif // __OS_BASE__ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/os/lock.h b/lib/libc/include/any-macos.13-any/os/lock.h new file mode 100644 index 0000000000..e141d029f5 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/os/lock.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2016 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __OS_LOCK__ +#define __OS_LOCK__ + +#include +#include +#include +#include +#include +#include + +OS_ASSUME_NONNULL_BEGIN + +/*! @header + * Low-level lock API. + */ + +#define OS_LOCK_API_VERSION 20160309 + +__BEGIN_DECLS + +#define OS_UNFAIR_LOCK_AVAILABILITY \ + __API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) + +/*! + * @typedef os_unfair_lock + * + * @abstract + * Low-level lock that allows waiters to block efficiently on contention. + * + * os_unfair_lock is an appropriate lock for cases where simple and lightweight + * mutual exclusion is needed. + * It can be intrusively stored inline in a datastructure without needing a + * separate allocation, reducing memory consumption and cost of indirection. + * For situations where something more sophisticated like condition waits or + * FIFO ordering is needed, use appropriate higher level APIs such as those from + * the pthread or dispatch subsystems. + * + * The values stored in the lock should be considered opaque and implementation + * defined, they contain thread ownership information that the system may use + * to attempt to resolve priority inversions. + * + * This lock must be unlocked from the same thread that locked it, attempts to + * unlock from a different thread will cause an assertion aborting the process. + * + * This lock must not be accessed from multiple processes or threads via shared + * or multiply-mapped memory, because the lock implementation relies on the + * address of the lock value and identity of the owning process. + * + * Must be initialized with OS_UNFAIR_LOCK_INIT. + * + * @discussion + * The name 'unfair' indicates that there is no attempt at enforcing acquisition + * fairness, e.g. an unlocker can potentially immediately reacquire the lock + * before a woken up waiter gets an opportunity to attempt to acquire the lock. + * This is often advantageous for performance reasons, but also makes starvation + * of waiters a possibility. + * + * This lock is suitable as a drop-in replacement for the deprecated OSSpinLock, + * providing much better behavior under contention. + * + * In Swift, note that use of the `&` operator on an unfair lock can copy or move + * the lock memory, leading to misbehavior. Use an OSAllocatedUnfairLock to safely wrap + * access to the lock memory instead. If you use os_unfair_lock APIs directly, + * always make sure to store and use the lock in memory with a stable address. + */ +OS_UNFAIR_LOCK_AVAILABILITY +typedef struct os_unfair_lock_s { + uint32_t _os_unfair_lock_opaque; +} os_unfair_lock, *os_unfair_lock_t; + +#ifndef OS_UNFAIR_LOCK_INIT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define OS_UNFAIR_LOCK_INIT ((os_unfair_lock){0}) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#define OS_UNFAIR_LOCK_INIT (os_unfair_lock{}) +#elif defined(__cplusplus) +#define OS_UNFAIR_LOCK_INIT (os_unfair_lock()) +#else +#define OS_UNFAIR_LOCK_INIT {0} +#endif +#endif // OS_UNFAIR_LOCK_INIT + +/*! + * @function os_unfair_lock_lock + * + * @abstract + * Locks an os_unfair_lock. + * + * @param lock + * Pointer to an os_unfair_lock. + */ +OS_UNFAIR_LOCK_AVAILABILITY +OS_EXPORT OS_NOTHROW OS_NONNULL_ALL +OS_SWIFT_UNAVAILABLE_FROM_ASYNC("Use OSAllocatedUnfairLock.performWhileLocked() for async-safe scoped locking") +void os_unfair_lock_lock(os_unfair_lock_t lock); + +/*! + * @function os_unfair_lock_trylock + * + * @abstract + * Locks an os_unfair_lock if it is not already locked. + * + * @discussion + * It is invalid to surround this function with a retry loop, if this function + * returns false, the program must be able to proceed without having acquired + * the lock, or it must call os_unfair_lock_lock() directly (a retry loop around + * os_unfair_lock_trylock() amounts to an inefficient implementation of + * os_unfair_lock_lock() that hides the lock waiter from the system and prevents + * resolution of priority inversions). + * + * @param lock + * Pointer to an os_unfair_lock. + * + * @result + * Returns true if the lock was succesfully locked and false if the lock was + * already locked. + */ +OS_UNFAIR_LOCK_AVAILABILITY +OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_NONNULL_ALL +OS_SWIFT_UNAVAILABLE_FROM_ASYNC("Use OSAllocatedUnfairLock.tryPerformWhileLocked() for async-safe scoped locking") +bool os_unfair_lock_trylock(os_unfair_lock_t lock); + +/*! + * @function os_unfair_lock_unlock + * + * @abstract + * Unlocks an os_unfair_lock. + * + * @param lock + * Pointer to an os_unfair_lock. + */ +OS_UNFAIR_LOCK_AVAILABILITY +OS_EXPORT OS_NOTHROW OS_NONNULL_ALL +OS_SWIFT_UNAVAILABLE_FROM_ASYNC("Use OSAllocatedUnfairLock.performWhileLocked() for async-safe scoped locking") +void os_unfair_lock_unlock(os_unfair_lock_t lock); + +/*! + * @function os_unfair_lock_assert_owner + * + * @abstract + * Asserts that the calling thread is the current owner of the specified + * unfair lock. + * + * @discussion + * If the lock is currently owned by the calling thread, this function returns. + * + * If the lock is unlocked or owned by a different thread, this function + * asserts and terminates the process. + * + * @param lock + * Pointer to an os_unfair_lock. + */ +OS_UNFAIR_LOCK_AVAILABILITY +OS_EXPORT OS_NOTHROW OS_NONNULL_ALL +void os_unfair_lock_assert_owner(const os_unfair_lock *lock); + +/*! + * @function os_unfair_lock_assert_not_owner + * + * @abstract + * Asserts that the calling thread is not the current owner of the specified + * unfair lock. + * + * @discussion + * If the lock is unlocked or owned by a different thread, this function + * returns. + * + * If the lock is currently owned by the current thread, this function asserts + * and terminates the process. + * + * @param lock + * Pointer to an os_unfair_lock. + */ +OS_UNFAIR_LOCK_AVAILABILITY +OS_EXPORT OS_NOTHROW OS_NONNULL_ALL +void os_unfair_lock_assert_not_owner(const os_unfair_lock *lock); + +__END_DECLS + +OS_ASSUME_NONNULL_END + +#endif // __OS_LOCK__ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/os/object.h b/lib/libc/include/any-macos.13-any/os/object.h similarity index 82% rename from lib/libc/include/x86_64-macos.10-none/os/object.h rename to lib/libc/include/any-macos.13-any/os/object.h index be281bcd9a..4b5a77974a 100644 --- a/lib/libc/include/x86_64-macos.10-none/os/object.h +++ b/lib/libc/include/any-macos.13-any/os/object.h @@ -55,6 +55,9 @@ * or iOS 6.0 deployment target. */ +#define OS_OBJECT_ASSUME_ABI_SINGLE_BEGIN OS_ASSUME_PTR_ABI_SINGLE_BEGIN +#define OS_OBJECT_ASSUME_ABI_SINGLE_END OS_ASSUME_PTR_ABI_SINGLE_END + #ifndef OS_OBJECT_HAVE_OBJC_SUPPORT #if !defined(__OBJC__) || defined(__OBJC_GC__) # define OS_OBJECT_HAVE_OBJC_SUPPORT 0 @@ -98,6 +101,15 @@ #endif // __swift__ #endif // OS_OBJECT_SWIFT3 +#if __has_feature(assume_nonnull) +#define OS_OBJECT_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") +#define OS_OBJECT_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") +#else +#define OS_OBJECT_ASSUME_NONNULL_BEGIN +#define OS_OBJECT_ASSUME_NONNULL_END +#endif +#define OS_OBJECT_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #if OS_OBJECT_USE_OBJC #import #if __has_attribute(objc_independent_class) @@ -116,9 +128,9 @@ #define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, proto) \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL( \ OS_OBJECT_CLASS(name), OS_OBJECT_CLASS(proto)) -#define OS_OBJECT_DECL_IMPL(name, ...) \ +#define OS_OBJECT_DECL_IMPL(name, adhere, ...) \ OS_OBJECT_DECL_PROTOCOL(name, __VA_ARGS__) \ - typedef NSObject \ + typedef adhere \ * OS_OBJC_INDEPENDENT_CLASS name##_t #define OS_OBJECT_DECL_BASE(name, ...) \ @interface OS_OBJECT_CLASS(name) : __VA_ARGS__ \ @@ -129,9 +141,9 @@ typedef OS_OBJECT_CLASS(name) \ * OS_OBJC_INDEPENDENT_CLASS name##_t #define OS_OBJECT_DECL(name, ...) \ - OS_OBJECT_DECL_IMPL(name, ) + OS_OBJECT_DECL_IMPL(name, NSObject, ) #define OS_OBJECT_DECL_SUBCLASS(name, super) \ - OS_OBJECT_DECL_IMPL(name, ) + OS_OBJECT_DECL_IMPL(name, NSObject, ) #if __has_attribute(ns_returns_retained) #define OS_OBJECT_RETURNS_RETAINED __attribute__((__ns_returns_retained__)) #else @@ -149,6 +161,8 @@ #define OS_OBJECT_BRIDGE #define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT #endif + + #if __has_attribute(objc_runtime_visible) && \ ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12) || \ @@ -163,7 +177,7 @@ /* * To provide backward deployment of ObjC objects in Swift on pre-10.12 * SDKs, OS_object classes can be marked as OS_OBJECT_OBJC_RUNTIME_VISIBLE. - * When compiling with a deployment target earlier than OS X 10.12 (iOS 10.0, + * When compiling with a deployment target earlier than OS X 10.12 (iOS 10.0, * tvOS 10.0, watchOS 3.0) the Swift compiler will only refer to this type at * runtime (using the ObjC runtime). */ @@ -187,9 +201,9 @@ #define OS_OBJECT_DECL_SUBCLASS_SWIFT(name, super) \ OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ OS_OBJECT_DECL_IMPL_CLASS(name, OS_OBJECT_CLASS(super)) +#endif // OS_OBJECT_SWIFT3 OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE OS_OBJECT_DECL_BASE(object, NSObject); -#endif // OS_OBJECT_SWIFT3 #else /*! @parseOnly */ #define OS_OBJECT_RETURNS_RETAINED @@ -215,9 +229,31 @@ OS_OBJECT_DECL_BASE(object, NSObject); typedef struct name##_s *name##_t #endif +#if OS_OBJECT_USE_OBJC +/* Declares a class of the specific name and exposes the interface and typedefs + * name##_t to the pointer to the class */ +#define OS_OBJECT_SHOW_CLASS(name, ...) \ + OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ + OS_OBJECT_DECL_IMPL_CLASS(name, ## __VA_ARGS__ ) +/* Declares a subclass of the same name, and + * subclass adheres to protocol specified. Typedefs baseclass * to subclass##_t */ +#define OS_OBJECT_SHOW_SUBCLASS(subclass_name, super, proto_name) \ + OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \ + OS_OBJECT_DECL_BASE(subclass_name, OS_OBJECT_CLASS(super)); \ + typedef OS_OBJECT_CLASS(super) \ + * OS_OBJC_INDEPENDENT_CLASS subclass_name##_t +#else /* Plain C */ +#define OS_OBJECT_DECL_PROTOCOL(name, ...) +#define OS_OBJECT_SHOW_CLASS(name, ...) \ + typedef struct name##_s *name##_t +#define OS_OBJECT_SHOW_SUBCLASS(name, super, ...) \ + typedef super##_t name##_t +#endif + #define OS_OBJECT_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object)) __BEGIN_DECLS +OS_OBJECT_ASSUME_ABI_SINGLE_BEGIN /*! * @function os_retain @@ -266,6 +302,7 @@ os_release(void *object); #define os_release(object) [object release] #endif +OS_OBJECT_ASSUME_ABI_SINGLE_END __END_DECLS #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/os/workgroup_base.h b/lib/libc/include/any-macos.13-any/os/workgroup_base.h new file mode 100644 index 0000000000..e705496f2a --- /dev/null +++ b/lib/libc/include/any-macos.13-any/os/workgroup_base.h @@ -0,0 +1,85 @@ +#ifndef __OS_WORKGROUP_BASE__ +#define __OS_WORKGROUP_BASE__ + +#ifndef __OS_WORKGROUP_INDIRECT__ +#error "Please #include instead of this file directly." +#endif + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#if __has_feature(assume_nonnull) +#define OS_WORKGROUP_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") +#define OS_WORKGROUP_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") +#else +#define OS_WORKGROUP_ASSUME_NONNULL_BEGIN +#define OS_WORKGROUP_ASSUME_NONNULL_END +#endif +#define OS_WORKGROUP_WARN_RESULT __attribute__((__warn_unused_result__)) +#define OS_WORKGROUP_EXPORT OS_EXPORT +#define OS_WORKGROUP_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED +#define OS_WORKGROUP_ASSUME_ABI_SINGLE_BEGIN OS_ASSUME_PTR_ABI_SINGLE_BEGIN +#define OS_WORKGROUP_ASSUME_ABI_SINGLE_END OS_ASSUME_PTR_ABI_SINGLE_END +#define OS_WORKGROUP_UNSAFE_INDEXABLE OS_UNSAFE_INDEXABLE + +#define OS_WORKGROUP_DECL(name, swift_name) \ + OS_SWIFT_NAME(swift_name) \ + OS_OBJECT_SHOW_CLASS(name, OS_OBJECT_CLASS(object)) + +#if OS_OBJECT_USE_OBJC +#define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...) \ + OS_SWIFT_NAME(swift_name) \ + OS_OBJECT_DECL_PROTOCOL(name ## __VA_ARGS__ ) +#else +#define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...) +#endif + +#define OS_WORKGROUP_SUBCLASS_DECL(name, super, swift_name, ...) \ + OS_SWIFT_NAME(swift_name) \ + OS_OBJECT_SHOW_SUBCLASS(name, super, name, ## __VA_ARGS__) + +#if defined(__LP64__) +#define __OS_WORKGROUP_ATTR_SIZE__ 60 +#define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56 +#define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 36 +#else +#define __OS_WORKGROUP_ATTR_SIZE__ 60 +#define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56 +#define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 28 +#endif + +#define _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT 0x2FA863B4 +#define _OS_WORKGROUP_ATTR_SIG_EMPTY_INIT 0x2FA863C4 + +OS_WORKGROUP_ASSUME_ABI_SINGLE_BEGIN + +struct OS_REFINED_FOR_SWIFT os_workgroup_attr_opaque_s { + uint32_t sig; + char opaque[__OS_WORKGROUP_ATTR_SIZE__]; +}; + +#define _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT 0x52A74C4D +struct OS_REFINED_FOR_SWIFT os_workgroup_interval_data_opaque_s { + uint32_t sig; + char opaque[__OS_WORKGROUP_INTERVAL_DATA_SIZE__]; +}; + +struct OS_REFINED_FOR_SWIFT os_workgroup_join_token_opaque_s { + uint32_t sig; + char opaque[__OS_WORKGROUP_JOIN_TOKEN_SIZE__]; +}; + +OS_WORKGROUP_ASSUME_ABI_SINGLE_END + +#endif /* __OS_WORKGROUP_BASE__ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/os/workgroup_interval.h b/lib/libc/include/any-macos.13-any/os/workgroup_interval.h new file mode 100644 index 0000000000..84aa507634 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/os/workgroup_interval.h @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2020 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __OS_WORKGROUP_INTERVAL__ +#define __OS_WORKGROUP_INTERVAL__ + +#ifndef __OS_WORKGROUP_INDIRECT__ +#error "Please #include instead of this file directly." +#include // For header doc +#endif + +__BEGIN_DECLS + +OS_WORKGROUP_ASSUME_NONNULL_BEGIN +OS_WORKGROUP_ASSUME_ABI_SINGLE_BEGIN + +/*! + * @typedef os_workgroup_interval_t + * + * @abstract + * A subclass of an os_workgroup_t for tracking work performed as part of + * a repeating interval-driven workload. + */ +OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_interval, Repeatable); +OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_interval, os_workgroup, WorkGroupInterval); + +/* During the first instance of this API, the only supported interval + * workgroups are for audio workloads. Please refer to the AudioToolbox + * framework for more information. + */ + +/* + * @typedef os_workgroup_interval_data, os_workgroup_interval_data_t + * + * @abstract + * An opaque structure containing additional configuration for the workgroup + * interval. + */ +typedef struct os_workgroup_interval_data_opaque_s os_workgroup_interval_data_s; +typedef struct os_workgroup_interval_data_opaque_s *os_workgroup_interval_data_t; +#define OS_WORKGROUP_INTERVAL_DATA_INITIALIZER \ + { .sig = _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT } + +/*! + * @function os_workgroup_interval_start + * + * @abstract + * Indicates to the system that the member threads of this + * os_workgroup_interval_t have begun working on an instance of the repeatable + * interval workload with the specified timestamps. This function is real time + * safe. + * + * This function will set and return an errno in the following cases: + * + * - The current thread is not a member of the os_workgroup_interval_t + * - The os_workgroup_interval_t has been cancelled + * - The timestamps passed in are malformed + * - os_workgroup_interval_start() was previously called on the + * os_workgroup_interval_t without an intervening os_workgroup_interval_finish() + * - A concurrent workgroup interval configuration operation is taking place. + * + * @param start + * Start timestamp specified in the os_clockid_t with which the + * os_workgroup_interval_t was created. This is generally a time in the past and + * indicates when the workgroup started working on an interval period + * + * @param deadline + * Deadline timestamp specified in the os_clockid_t with which the + * os_workgroup_interval_t was created. This specifies the deadline which the + * interval period would like to meet. + * + * @param data + * This field is currently unused and should be NULL + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT +int +os_workgroup_interval_start(os_workgroup_interval_t wg, uint64_t start, uint64_t + deadline, os_workgroup_interval_data_t _Nullable data); + +/*! + * @function os_workgroup_interval_update + * + * @abstract + * Updates an already started interval workgroup to have the new + * deadline specified. This function is real time safe. + * + * This function will return an error in the following cases: + * - The current thread is not a member of the os_workgroup_interval_t + * - The os_workgroup_interval_t has been cancelled + * - The timestamp passed in is malformed + * - os_workgroup_interval_start() was not previously called on the + * os_workgroup_interval_t or was already matched with an + * os_workgroup_interval_finish() + * - A concurrent workgroup interval configuration operation is taking place + * + * @param deadline + * Timestamp specified in the os_clockid_t with + * which the os_workgroup_interval_t was created. + * + * @param data + * This field is currently unused and should be NULL + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT +int +os_workgroup_interval_update(os_workgroup_interval_t wg, uint64_t deadline, + os_workgroup_interval_data_t _Nullable data); + +/*! + * @function os_workgroup_interval_finish + * + * @abstract + * Indicates to the system that the member threads of + * this os_workgroup_interval_t have finished working on the current instance + * of the interval workload. This function is real time safe. + * + * This function will return an error in the following cases: + * - The current thread is not a member of the os_workgroup_interval_t + * - os_workgroup_interval_start() was not previously called on the + * os_workgroup_interval_t or was already matched with an + * os_workgroup_interval_finish() + * - A concurrent workgroup interval configuration operation is taking place. + * + * @param data + * This field is currently unused and should be NULL + * + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT +int +os_workgroup_interval_finish(os_workgroup_interval_t wg, + os_workgroup_interval_data_t _Nullable data); + +OS_WORKGROUP_ASSUME_ABI_SINGLE_END +OS_WORKGROUP_ASSUME_NONNULL_END + +__END_DECLS + +#endif /* __OS_WORKGROUP_INTERVAL__ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/os/workgroup_object.h b/lib/libc/include/any-macos.13-any/os/workgroup_object.h new file mode 100644 index 0000000000..fdf5ae7211 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/os/workgroup_object.h @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2020 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __OS_WORKGROUP_OBJECT__ +#define __OS_WORKGROUP_OBJECT__ + +#ifndef __OS_WORKGROUP_INDIRECT__ +#error "Please #include instead of this file directly." +#include // For header doc +#endif + +__BEGIN_DECLS + +OS_WORKGROUP_ASSUME_NONNULL_BEGIN +OS_WORKGROUP_ASSUME_ABI_SINGLE_BEGIN + +/*! + * @typedef os_workgroup_t + * + * @abstract + * A reference counted os object representing a workload that needs to + * be distinctly recognized and tracked by the system. The workgroup + * tracks a collection of threads all working cooperatively. An os_workgroup + * object - when not an instance of a specific os_workgroup_t subclass - + * represents a generic workload and makes no assumptions about the kind of + * work done. + * + * @discussion + * Threads can explicitly join an os_workgroup_t to mark themselves as + * participants in the workload. + */ +OS_WORKGROUP_DECL(os_workgroup, WorkGroup); + + +/* Attribute creation and specification */ + +/*! + * @typedef os_workgroup_attr_t + * + * @abstract + * Pointer to an opaque structure for describing attributes that can be + * configured on a workgroup at creation. + */ +typedef struct os_workgroup_attr_opaque_s os_workgroup_attr_s; +typedef struct os_workgroup_attr_opaque_s *os_workgroup_attr_t; + +/* os_workgroup_t attributes need to be initialized before use. This initializer + * allows you to create a workgroup with the system default attributes. */ +#define OS_WORKGROUP_ATTR_INITIALIZER_DEFAULT \ + { .sig = _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT } + + + +/* The main use of the workgroup API is through instantiations of the concrete + * subclasses - please refer to os/workgroup_interval.h and + * os/workgroup_parallel.h for more information on creating workgroups. + * + * The functions below operate on all subclasses of os_workgroup_t. + */ + +/*! + * @function os_workgroup_copy_port + * + * @abstract + * Returns a reference to a send right representing this workgroup that is to be + * sent to other processes. This port is to be passed to + * os_workgroup_create_with_port() to create a workgroup object. + * + * It is the client's responsibility to release the send right reference. + * + * If an error is encountered, errno is set and returned. + */ +API_AVAILABLE(macos(11.0)) +API_UNAVAILABLE(ios, tvos, watchos) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT +int +os_workgroup_copy_port(os_workgroup_t wg, mach_port_t *mach_port_out); + +/*! + * @function os_workgroup_create_with_port + * + * @abstract + * Create an os_workgroup_t object from a send right returned by a previous + * call to os_workgroup_copy_port, potentially in a different process. + * + * A newly created os_workgroup_t has no initial member threads - in particular + * the creating thread does not join the os_workgroup_t implicitly. + * + * @param name + * A client specified string for labelling the workgroup. This parameter is + * optional and can be NULL. + * + * @param mach_port + * The send right to create the workgroup from. No reference is consumed + * on the specified send right. + */ +API_AVAILABLE(macos(11.0)) +API_UNAVAILABLE(ios, tvos, watchos) +OS_SWIFT_NAME(WorkGroup.init(__name:port:)) OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED +os_workgroup_t _Nullable +os_workgroup_create_with_port(const char *OS_WORKGROUP_UNSAFE_INDEXABLE _Nullable name, mach_port_t mach_port); + +/*! + * @function os_workgroup_create_with_workgroup + * + * @abstract + * Create a new os_workgroup object from an existing os_workgroup. + * + * The newly created os_workgroup has no initial member threads - in particular + * the creating threaad does not join the os_workgroup_t implicitly. + * + * @param name + * A client specified string for labelling the workgroup. This parameter is + * optional and can be NULL. + * + * @param wg + * The existing workgroup to create a new workgroup object from. + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED +os_workgroup_t _Nullable +os_workgroup_create_with_workgroup(const char * OS_WORKGROUP_UNSAFE_INDEXABLE _Nullable name, os_workgroup_t wg); + +/*! + * @typedef os_workgroup_join_token, os_workgroup_join_token_t + * + * @abstract + * An opaque join token which the client needs to pass to os_workgroup_join + * and os_workgroup_leave + */ +OS_REFINED_FOR_SWIFT +typedef struct os_workgroup_join_token_opaque_s os_workgroup_join_token_s; +OS_REFINED_FOR_SWIFT +typedef struct os_workgroup_join_token_opaque_s *os_workgroup_join_token_t; + + +/*! + * @function os_workgroup_join + * + * @abstract + * Joins the current thread to the specified workgroup and populates the join + * token that has been passed in. This API is real-time safe. + * + * @param wg + * The workgroup that the current thread would like to join + * + * @param token_out + * Pointer to a client allocated struct which the function will populate + * with the join token. This token must be passed in by the thread when it calls + * os_workgroup_leave(). + * + * Errors will be returned in the following cases: + * + * EALREADY The thread is already part of a workgroup that the specified + * workgroup does not nest with + * EINVAL The workgroup has been cancelled + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT +int +os_workgroup_join(os_workgroup_t wg, os_workgroup_join_token_t token_out); + +/*! + * @function os_workgroup_leave + * + * @abstract + * This removes the current thread from a workgroup it has previously + * joined. Threads must leave all workgroups in the reverse order that they + * have joined them. Failing to do so before exiting will result in undefined + * behavior. + * + * If the join token is malformed, the process will be aborted. + * + * This API is real time safe. + * + * @param wg + * The workgroup that the current thread would like to leave. + * + * @param token + * This is the join token populated by the most recent call to + * os_workgroup_join(). + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT +void +os_workgroup_leave(os_workgroup_t wg, os_workgroup_join_token_t token); + +/* Working Arena index of a thread in a workgroup */ +typedef uint32_t os_workgroup_index; +/* Destructor for Working Arena */ +typedef void (*os_workgroup_working_arena_destructor_t)(void * _Nullable); + +/*! + * @function os_workgroup_set_working_arena + * + * @abstract + * Associates a client defined working arena with the workgroup. The arena + * is local to the workgroup object in the process. This is intended for + * distributing a manually managed memory allocation between member threads + * of the workgroup. + * + * This function can be called multiple times and the client specified + * destructor will be called on the previously assigned arena, if any. This + * function can only be called when no threads have currently joined the + * workgroup and all workloops associated with the workgroup are idle. + * + * @param wg + * The workgroup to associate the working arena with + * + * @param arena + * The client managed arena to associate with the workgroup. This value can + * be NULL. + * + * @param max_workers + * The maximum number of threads that will ever query the workgroup for the + * arena and request an index into it. If the arena is not used to partition + * work amongst member threads, then this field can be 0. + * + * @param destructor + * A destructor to call on the previously assigned working arena, if any + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT +int +os_workgroup_set_working_arena(os_workgroup_t wg, void * _Nullable arena, + uint32_t max_workers, os_workgroup_working_arena_destructor_t destructor); + +/*! + * @function os_workgroup_get_working_arena + * + * @abstract + * Returns the working arena associated with the workgroup and the current + * thread's index in the workgroup. This function can only be called by a member + * of the workgroup. Multiple calls to this API by a member thread will return + * the same arena and index until the thread leaves the workgroup. + * + * For workloops with an associated workgroup, every work item on the workloop + * will receive the same index in the arena. + * + * This method returns NULL if no arena is set on the workgroup. The index + * returned by this function is zero-based and is namespaced per workgroup + * object in the process. The indices provided are strictly monotonic and never + * reused until a future call to os_workgroup_set_working_arena. + * + * @param wg + * The workgroup to get the working arena from. + * + * @param index_out + * A pointer to a os_workgroup_index which will be populated by the caller's + * index in the workgroup. + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT +void * _Nullable +os_workgroup_get_working_arena(os_workgroup_t wg, + os_workgroup_index * _Nullable index_out); + +/*! + * @function os_workgroup_cancel + * + * @abstract + * This API invalidates a workgroup and indicates to the system that the + * workload is no longer relevant to the caller. + * + * No new work should be initiated for a cancelled workgroup and + * work that is already underway should periodically check for + * cancellation with os_workgroup_testcancel and initiate cleanup if needed. + * + * Threads currently in the workgroup continue to be tracked together but no + * new threads may join this workgroup - the only possible operation allowed is + * to leave the workgroup. Other actions may have undefined behavior or + * otherwise fail. + * + * This API is idempotent. Cancellation is local to the workgroup object + * it is called on and does not affect other workgroups. + * + * @param wg + * The workgroup that that the thread would like to cancel + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT +void +os_workgroup_cancel(os_workgroup_t wg); + +/*! + * @function os_workgroup_testcancel + * + * @abstract + * Returns true if the workgroup object has been cancelled. See also + * os_workgroup_cancel + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT +bool +os_workgroup_testcancel(os_workgroup_t wg); + +/*! + * @typedef os_workgroup_max_parallel_threads_attr_t + * + * @abstract + * A pointer to a structure describing the set of properties of a workgroup to + * override with the explicitly specified values in the structure. + * + * See also os_workgroup_max_parallel_threads. + */ +OS_REFINED_FOR_SWIFT +typedef struct os_workgroup_max_parallel_threads_attr_s os_workgroup_mpt_attr_s; +OS_REFINED_FOR_SWIFT +typedef struct os_workgroup_max_parallel_threads_attr_s *os_workgroup_mpt_attr_t; + +/*! + * @function os_workgroup_max_parallel_threads + * + * @abstract + * Returns the system's recommendation for maximum number of threads the client + * should make for a multi-threaded workload in a given workgroup. + * + * This API takes into consideration the current hardware the code is running on + * and the attributes of the workgroup. It does not take into consideration the + * current load of the system and therefore always provides the most optimal + * recommendation for the workload. + * + * @param wg + * The workgroup in which the multi-threaded workload will be performed in. The + * threads performing the multi-threaded workload are expected to join this + * workgroup. + * + * @param attr + * This value is currently unused and should be NULL. + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT +int +os_workgroup_max_parallel_threads(os_workgroup_t wg, os_workgroup_mpt_attr_t + _Nullable attr); + +OS_WORKGROUP_ASSUME_ABI_SINGLE_END +OS_WORKGROUP_ASSUME_NONNULL_END + +__END_DECLS + +#endif /* __OS_WORKGROUP_OBJECT__ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/os/workgroup_parallel.h b/lib/libc/include/any-macos.13-any/os/workgroup_parallel.h new file mode 100644 index 0000000000..740e67b66c --- /dev/null +++ b/lib/libc/include/any-macos.13-any/os/workgroup_parallel.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2020 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __OS_WORKGROUP_PARALLEL__ +#define __OS_WORKGROUP_PARALLEL__ + +#ifndef __OS_WORKGROUP_INDIRECT__ +#error "Please #include instead of this file directly." +#include // For header doc +#endif + +#include + +__BEGIN_DECLS + +OS_WORKGROUP_ASSUME_NONNULL_BEGIN +OS_WORKGROUP_ASSUME_ABI_SINGLE_BEGIN + +/*! + * @typedef os_workgroup_parallel_t + * + * @abstract + * A subclass of an os_workgroup_t for tracking parallel work. + */ +OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_parallel, Parallelizable); +OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_parallel, os_workgroup, WorkGroupParallel); + +/*! + * @function os_workgroup_parallel_create + * + * @abstract + * Creates an os_workgroup_t which tracks a parallel workload. + * A newly created os_workgroup_interval_t has no initial member threads - + * in particular the creating thread does not join the os_workgroup_parallel_t + * implicitly. + * + * See also os_workgroup_max_parallel_threads(). + * + * @param name + * A client specified string for labelling the workgroup. This parameter is + * optional and can be NULL. + * + * @param attr + * The requested set of workgroup attributes. NULL is to be specified for the + * default set of attributes. + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED +OS_SWIFT_NAME(WorkGroupParallel.init(__name:attr:)) +os_workgroup_parallel_t _Nullable +os_workgroup_parallel_create(const char *OS_WORKGROUP_UNSAFE_INDEXABLE _Nullable name, + os_workgroup_attr_t _Nullable attr); + +OS_WORKGROUP_ASSUME_ABI_SINGLE_END +OS_WORKGROUP_ASSUME_NONNULL_END + +__END_DECLS + +#endif /* __OS_WORKGROUP_PARALLEL__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/pthread.h b/lib/libc/include/any-macos.13-any/pthread.h similarity index 66% rename from lib/libc/include/x86_64-macos.10-none/pthread.h rename to lib/libc/include/any-macos.13-any/pthread.h index 0826a7dc70..7bc20229a3 100644 --- a/lib/libc/include/x86_64-macos.10-none/pthread.h +++ b/lib/libc/include/any-macos.13-any/pthread.h @@ -53,9 +53,6 @@ #define _PTHREAD_H #include <_types.h> -#ifndef __POSIX_LIB__ -#include -#endif #include #include #include @@ -199,6 +196,13 @@ __BEGIN_DECLS #define _PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT \ defined(SWIFT_CLASS_EXTRA) && (!defined(SWIFT_SDK_OVERLAY_PTHREAD_EPOCH) || (SWIFT_SDK_OVERLAY_PTHREAD_EPOCH < 1)) +#if __has_attribute(__swift_attr__) +#define __PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC(msg) \ + __attribute__((__swift_attr__("@_unavailableFromAsync(message: \"" msg "\")"))) +#else +#define __PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC(msg) +#endif + /* * Condition variable attributes */ @@ -305,12 +309,14 @@ __API_AVAILABLE(macos(10.4), ios(2.0)) int pthread_cond_signal(pthread_cond_t *); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use an asynchronous wait instead of a synchronous wait") int pthread_cond_timedwait( pthread_cond_t * __restrict, pthread_mutex_t * __restrict, const struct timespec * _Nullable __restrict) __DARWIN_ALIAS_C(pthread_cond_timedwait); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use an asynchronous wait instead of a synchronous wait") int pthread_cond_wait(pthread_cond_t * __restrict, pthread_mutex_t * __restrict) __DARWIN_ALIAS_C(pthread_cond_wait); @@ -346,6 +352,7 @@ __API_AVAILABLE(macos(10.4), ios(2.0)) int pthread_equal(pthread_t _Nullable, pthread_t _Nullable); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Thread lifecycle is owned by Swift Concurrency runtime") void pthread_exit(void * _Nullable) __dead2; __API_AVAILABLE(macos(10.4), ios(2.0)) @@ -355,10 +362,12 @@ __API_AVAILABLE(macos(10.4), ios(2.0)) int pthread_getschedparam(pthread_t , int * _Nullable __restrict, struct sched_param * _Nullable __restrict); +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use Task Local Values instead") __API_AVAILABLE(macos(10.4), ios(2.0)) void* _Nullable pthread_getspecific(pthread_key_t); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use an asynchronous wait instead of a synchronous wait") int pthread_join(pthread_t , void * _Nullable * _Nullable) __DARWIN_ALIAS_C(pthread_join); @@ -380,6 +389,7 @@ int pthread_mutex_init(pthread_mutex_t * __restrict, const pthread_mutexattr_t * _Nullable __restrict); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use OSAllocatedUnfairLock's withLock or NSLock for async-safe scoped locking") int pthread_mutex_lock(pthread_mutex_t *); __API_AVAILABLE(macos(10.4), ios(2.0)) @@ -387,9 +397,11 @@ int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int, int * __restrict); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use OSAllocatedUnfairLock's withLockIfAvailable or NSLock for async-safe scoped locking") int pthread_mutex_trylock(pthread_mutex_t *); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use OSAllocatedUnfairLock's withLock or NSLock for async-safe scoped locking") int pthread_mutex_unlock(pthread_mutex_t *); __API_AVAILABLE(macos(10.4), ios(2.0)) @@ -446,18 +458,23 @@ int pthread_rwlock_init(pthread_rwlock_t * __restrict, __DARWIN_ALIAS(pthread_rwlock_init); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use async-safe scoped locking instead") int pthread_rwlock_rdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_rdlock); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use async-safe scoped locking instead") int pthread_rwlock_tryrdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_tryrdlock); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use async-safe scoped locking instead") int pthread_rwlock_trywrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_trywrlock); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use async-safe scoped locking instead") int pthread_rwlock_wrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_wrlock); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use async-safe scoped locking instead") int pthread_rwlock_unlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_unlock); __API_AVAILABLE(macos(10.4), ios(2.0)) @@ -477,10 +494,12 @@ __API_AVAILABLE(macos(10.4), ios(2.0)) pthread_t pthread_self(void); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use Task cancellation instead") int pthread_setcancelstate(int , int * _Nullable) __DARWIN_ALIAS(pthread_setcancelstate); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use Task cancellation instead") int pthread_setcanceltype(int , int * _Nullable) __DARWIN_ALIAS(pthread_setcanceltype); @@ -491,9 +510,11 @@ __API_AVAILABLE(macos(10.4), ios(2.0)) int pthread_setschedparam(pthread_t, int, const struct sched_param *); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use Task Local Values instead") int pthread_setspecific(pthread_key_t , const void * _Nullable); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use Task cancellation instead") void pthread_testcancel(void) __DARWIN_ALIAS(pthread_testcancel); #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(__cplusplus) @@ -510,6 +531,7 @@ __API_AVAILABLE(macos(10.6), ios(3.2)) int pthread_getname_np(pthread_t,char*,size_t); __API_AVAILABLE(macos(10.6), ios(3.2)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Thread lifecycle is owned by Swift Concurrency runtime") int pthread_setname_np(const char*); /* returns non-zero if the current thread is the main thread */ @@ -532,6 +554,7 @@ int pthread_cond_signal_thread_np(pthread_cond_t *, pthread_t _Nullable); /* Like pthread_cond_timedwait, but use a relative timeout */ __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use an asynchronous wait instead of a synchronous wait") int pthread_cond_timedwait_relative_np(pthread_cond_t *, pthread_mutex_t *, const struct timespec * _Nullable); @@ -557,8 +580,171 @@ int pthread_sigmask(int, const sigset_t * _Nullable, sigset_t * _Nullable) __DARWIN_ALIAS(pthread_sigmask); __API_AVAILABLE(macos(10.4), ios(2.0)) +__PTHREAD_SWIFT_UNAVAILABLE_FROM_ASYNC("Use Task.yield(), or await a condition instead of spinning") void pthread_yield_np(void); +__API_AVAILABLE(macos(11.0)) +__API_UNAVAILABLE(ios, tvos, watchos, driverkit) +void pthread_jit_write_protect_np(int enabled); + +__API_AVAILABLE(macos(11.0)) +__API_UNAVAILABLE(ios, tvos, watchos, driverkit) +int pthread_jit_write_protect_supported_np(void); + +/*! + * @typedef pthread_jit_write_callback_t + * The type of a function that can be supplied to {@link + * pthread_jit_write_with_callback_np} to write to the MAP_JIT region while it + * is writeable. + * + * @param ctx + * A pointer to context that will be passed through to the callback function. + * + * @result + * A result code to be returned to the caller of @{link + * pthread_jit_write_with_callback_np}. The system does not interpret/act on + * the value of this result. + */ +typedef int (*pthread_jit_write_callback_t)(void * _Nullable ctx); + +/*! + * @define PTHREAD_JIT_WRITE_ALLOW_CALLBACKS_NP + * A macro to be used at file scope to list the functions allowed to be passed + * to {@link pthread_jit_write_with_callback_np} to write to the MAP_JIT region + * while it is writeable. It may be invoked only once per executable/library. + * + * @param callbacks + * The pthread_jit_write_callback_t functions to allow. They should be supplied + * as a comma-delimited list. + */ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__OBJC__) || defined(__cplusplus) +#define PTHREAD_JIT_WRITE_ALLOW_CALLBACKS_NP(...) \ + __attribute__((__used__, __section__("__DATA_CONST,__pth_jit_func"))) \ + static const pthread_jit_write_callback_t __pthread_jit_write_callback_allowlist[] = { \ + __VA_ARGS__, NULL \ + } +#endif /* (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__OBJC__) || defined(__cplusplus) */ + +/*! + * @function pthread_jit_write_with_callback_np + * + * @abstract + * Toggles per-thread write-protection of the MAP_JIT region to writeable, + * invokes an allowed callback function to write to it, and toggles protection + * back to executable. + * + * @param callback + * The callback function to invoke to write to the MAP_JIT region. It must be + * statically allowed using {@link PTHREAD_JIT_WRITE_ALLOW_CALLBACKS_NP}. + * + * @param ctx + * Context to pass through to the invocation of the callback function. + * + * @result + * The result code returned by the callback function. + * + * @discussion + * This function assumes that the MAP_JIT region has executable protection when + * called. It is therefore invalid to call it recursively from within a write + * callback. The implementation does not detect such invalid recursive calls, + * so the client is responsible for preventing them. + * + * Callbacks _must not_ perform any non-local transfer of control flow (e.g. + * throw an exception, longjmp(3)), as doing so would leave the MAP_JIT region + * writeable. + * + * On systems where pthread_jit_write_protect_supported_np(3) is false, this + * function calls @callback directly and does nothing else. + * + * This function only enforces that @callback is allowed if the caller has the + * com.apple.security.cs.jit-write-allowlist entitlement. That entitlement also + * disallows use of pthread_jit_write_protect_np(3). Adopting the entitlement + * is therefore crucial in realizing the security benefits of this interface. + * + * If the entitlement is not present then this function toggles protection of + * the MAP_JIT to writeable, calls @callback and then toggles protection back to + * executable, without validating that @callback is an allowed function. This + * behavior is intended to permit independent adoption of this interface by + * libraries - once all libraries in an application have adopted, the + * application should add the entitlement. + * + * By default, only callbacks in libraries/images present at process start-up + * are allowed - callbacks in images loaded dynamically via dlopen(3)/etc. are + * not permitted. However, if the additional entitlement + * com.apple.security.cs.jit-write-allowlist-freeze-late is _also_ present, any + * callbacks in dlopen'd libraries are also added to the set of allowed + * callbacks until the {@link pthread_jit_write_freeze_callbacks_np} function is + * called. + * + * The goal of this interface is to allow applications that execute JIT-compiled + * code to mitigate against attempts from attackers to escalate to code + * execution by getting their own instructions written to the MAP_JIT region. + * + * Callbacks should assume an attacker can control the input to this function. + * They must therefore carefully validate the data that they are passed and do + * so using as little attackable state as possible. This means simplifying + * control flow and avoiding spills of sensitive registers (e.g. those used for + * validation or control flow). + * + * In the event a callback detects that its input is invalid, it should either + * abort in the simplest fashion possible (preferring e.g. __builtin_trap() over + * abort(3), the latter being encumbered by various conformance requirements) or + * return a result indicating failure. + */ +__API_AVAILABLE(macos(11.4)) +__API_UNAVAILABLE(ios, tvos, watchos, driverkit) +__SWIFT_UNAVAILABLE_MSG("This interface cannot be safely used from Swift") +int pthread_jit_write_with_callback_np( + pthread_jit_write_callback_t _Nonnull callback, void * _Nullable ctx); + +/*! + * @function pthread_jit_write_freeze_callbacks_np + * + * @abstract + * Freezes the set of allowed pthread JIT write callbacks, preventing any + * callbacks in subsequently dlopen'd libraries from being allowed as arguments + * to {@link pthread_jit_write_with_callback_np} + * + * @discussion + * If the com.apple.security.cs.jit-write-allowlist-freeze-late entitlement is + * present, this function must be called exactly once after all libraries + * containing JIT write callbacks have been loaded to prevent any further + * runtime modifications to the set of allowed callbacks. Failing to call this + * function before calling pthread_jit_write_with_callback_np(3) for the first + * time is an error, as is calling it multiple times. + * + * If the jit-write-allowlist-freeze-late entitlement is not present, calling + * this function is an error. + * + * If an application does not need to dlopen(3) any libraries or frameworks + * containing needed JIT write callbacks, it is best to avoid the + * jit-write-allowlist-freeze-late entitlement and accompanying need to call + * this function, as this allows the runtime to automatically freeze the set of + * allowed callbacks early in process initialization. + */ +__API_AVAILABLE(macos(12.1)) +__API_UNAVAILABLE(ios, tvos, watchos, driverkit) +void pthread_jit_write_freeze_callbacks_np(void); + +/*! + * @function pthread_cpu_number_np + * + * @param cpu_number_out + * The CPU number that the thread was running on at the time of query. + * This cpu number is in the interval [0, ncpus) (from sysctlbyname("hw.ncpu")) + * + * @result + * This function returns 0 or the value of errno if an error occurred. + * + * @note + * Optimizations of per-CPU datastructures based on the result of this function + * still require synchronization since it is not guaranteed that the thread will + * still be on the same CPU by the time the function returns. + */ +__API_AVAILABLE(macos(11.0), ios(14.2), tvos(14.2), watchos(7.1)) +int +pthread_cpu_number_np(size_t *cpu_number_out); + #endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE || __cplusplus */ __END_DECLS #if __has_feature(assume_nonnull) diff --git a/lib/libc/include/x86_64-macos.10-none/simd/base.h b/lib/libc/include/any-macos.13-any/simd/base.h similarity index 84% rename from lib/libc/include/x86_64-macos.10-none/simd/base.h rename to lib/libc/include/any-macos.13-any/simd/base.h index fdc2e3c879..fe3b05e356 100644 --- a/lib/libc/include/x86_64-macos.10-none/simd/base.h +++ b/lib/libc/include/any-macos.13-any/simd/base.h @@ -41,7 +41,21 @@ * way in which simd functions are overloaded, the usual weak-linking tricks * do not work; these functions are simply unavailable when targeting older * versions of the library. */ -# if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_13 || \ +# if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_13_0 || \ + __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_16_0 || \ + __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_9_0 || \ + __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_16_0 || \ + __BRIDGE_OS_VERSION_MIN_REQUIRED >= 70000 || \ + __DRIVERKIT_VERSION_MIN_REQUIRED >= __DRIVERKIT_22_0 +# define SIMD_LIBRARY_VERSION 5 +# elif __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_12_0 || \ + __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_15_0 || \ + __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_8_0 || \ + __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_15_0 || \ + __BRIDGE_OS_VERSION_MIN_REQUIRED >= 60000 || \ + __DRIVERKIT_VERSION_MIN_REQUIRED >= __DRIVERKIT_21_0 +# define SIMD_LIBRARY_VERSION 4 +# elif __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_13 || \ __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_11_0 || \ __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_4_0 || \ __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_11_0 || \ diff --git a/lib/libc/include/x86_64-macos.10-none/simd/math.h b/lib/libc/include/any-macos.13-any/simd/math.h similarity index 81% rename from lib/libc/include/x86_64-macos.10-none/simd/math.h rename to lib/libc/include/any-macos.13-any/simd/math.h index 5e2b31cae2..9b8ce556f0 100644 --- a/lib/libc/include/x86_64-macos.10-none/simd/math.h +++ b/lib/libc/include/any-macos.13-any/simd/math.h @@ -25,10 +25,12 @@ * cos(x) simd::cos(x) * sin(x) simd::sin(x) * tan(x) simd::tan(x) - * + * sincos(x) simd::sincos(x) Computes sin(x) and cos(x) more efficiently + * * cospi(x) simd::cospi(x) Returns cos(pi*x), sin(pi*x), tan(pi*x) * sinpi(x) simd::sinpi(x) more efficiently and accurately than * tanpi(x) simd::tanpi(x) would otherwise be possible + * sincospi(x) simd::sincospi(x) Computes sin(pi*x) and cos(pi*x) more efficiently * * acosh(x) simd::acosh(x) * asinh(x) simd::asinh(x) @@ -58,6 +60,7 @@ * erf(x) simd::erf(x) * erfc(x) simd::erfc(x) * tgamma(x) simd::tgamma(x) + * lgamma(x) simd::lgamma(x) * * fmod(x,y) simd::fmod(x,y) * remainder(x,y) simd::remainder(x,y) @@ -78,7 +81,6 @@ * and later; may be quite expensive on * older hardware. * simd_muladd(x,y,z) simd::muladd(x,y,z) - * * @copyright 2014-2017 Apple, Inc. All rights reserved. * @unsorted */ @@ -913,6 +915,34 @@ static inline SIMD_CFUNC simd_double4 __tg_tgamma(simd_double4 x); * Objective-C, and `simd::tgamma` in C++. */ static inline SIMD_CFUNC simd_double8 __tg_tgamma(simd_double8 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_float2 __tg_lgamma(simd_float2 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_float3 __tg_lgamma(simd_float3 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_float4 __tg_lgamma(simd_float4 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_float8 __tg_lgamma(simd_float8 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_float16 __tg_lgamma(simd_float16 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_double2 __tg_lgamma(simd_double2 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_double3 __tg_lgamma(simd_double3 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_double4 __tg_lgamma(simd_double4 x); +/*! @abstract Do not call this function; instead use `lgamma` in C and + * Objective-C, and `simd::lgamma` in C++. */ +static inline SIMD_CFUNC simd_double8 __tg_lgamma(simd_double8 x); + /*! @abstract Do not call this function; instead use `ceil` in C and * Objective-C, and `simd::ceil` in C++. */ static inline SIMD_CFUNC simd_float2 __tg_ceil(simd_float2 x); @@ -1053,7 +1083,177 @@ static inline SIMD_CFUNC simd_double4 __tg_trunc(simd_double4 x); * Objective-C, and `simd::trunc` in C++. */ static inline SIMD_CFUNC simd_double8 __tg_trunc(simd_double8 x); - +#if SIMD_LIBRARY_VERSION >= 5 +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp); +/*! @abstract Do not call this function; instead use `sincos` in C and + * Objective-C, and `simd::sincos` in C++. */ +static inline SIMD_NONCONST void __tg_sincos(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp); + +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp); +/*! @abstract Do not call this function; instead use `sincospi` in C and + * Objective-C, and `simd::sincospi` in C++. */ +static inline SIMD_NONCONST void __tg_sincospi(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp); + +#endif +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_int2 __tg_isfinite(simd_float2 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_int3 __tg_isfinite(simd_float3 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_int4 __tg_isfinite(simd_float4 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_int8 __tg_isfinite(simd_float8 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_int16 __tg_isfinite(simd_float16 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_long2 __tg_isfinite(simd_double2 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_long3 __tg_isfinite(simd_double3 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_long4 __tg_isfinite(simd_double4 x); +/*! @abstract Do not call this function; instead use `isfinite` in C and + * Objective-C, and `simd::isfinite` in C++. */ +static inline SIMD_CFUNC simd_long8 __tg_isfinite(simd_double8 x); + +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_int2 __tg_isinf(simd_float2 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_int3 __tg_isinf(simd_float3 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_int4 __tg_isinf(simd_float4 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_int8 __tg_isinf(simd_float8 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_int16 __tg_isinf(simd_float16 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_long2 __tg_isinf(simd_double2 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_long3 __tg_isinf(simd_double3 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_long4 __tg_isinf(simd_double4 x); +/*! @abstract Do not call this function; instead use `isinf` in C and + * Objective-C, and `simd::isinf` in C++. */ +static inline SIMD_CFUNC simd_long8 __tg_isinf(simd_double8 x); + +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_int2 __tg_isnan(simd_float2 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_int3 __tg_isnan(simd_float3 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_int4 __tg_isnan(simd_float4 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_int8 __tg_isnan(simd_float8 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_int16 __tg_isnan(simd_float16 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_long2 __tg_isnan(simd_double2 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_long3 __tg_isnan(simd_double3 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_long4 __tg_isnan(simd_double4 x); +/*! @abstract Do not call this function; instead use `isnan` in C and + * Objective-C, and `simd::isnan` in C++. */ +static inline SIMD_CFUNC simd_long8 __tg_isnan(simd_double8 x); + +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_int2 __tg_isnormal(simd_float2 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_int3 __tg_isnormal(simd_float3 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_int4 __tg_isnormal(simd_float4 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_int8 __tg_isnormal(simd_float8 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_int16 __tg_isnormal(simd_float16 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_long2 __tg_isnormal(simd_double2 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_long3 __tg_isnormal(simd_double3 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_long4 __tg_isnormal(simd_double4 x); +/*! @abstract Do not call this function; instead use `isnormal` in C and + * Objective-C, and `simd::isnormal` in C++. */ +static inline SIMD_CFUNC simd_long8 __tg_isnormal(simd_double8 x); + + /*! @abstract Do not call this function; instead use `atan2` in C and * Objective-C, and `simd::atan2` in C++. */ static inline SIMD_CFUNC simd_float2 __tg_atan2(simd_float2 y, simd_float2 x); @@ -1402,189 +1602,225 @@ static inline SIMD_CFUNC simd_double8 simd_muladd(simd_double8 x, simd_double8 y #include /*! @abstract Do not call this function directly; use simd::acos instead. */ -static SIMD_CPPFUNC float __tg_acos(float x) { return ::acos(x); } +static SIMD_CPPFUNC float __tg_acos(float x) { return ::acosf(x); } /*! @abstract Do not call this function directly; use simd::acos instead. */ static SIMD_CPPFUNC double __tg_acos(double x) { return ::acos(x); } /*! @abstract Do not call this function directly; use simd::asin instead. */ -static SIMD_CPPFUNC float __tg_asin(float x) { return ::asin(x); } +static SIMD_CPPFUNC float __tg_asin(float x) { return ::asinf(x); } /*! @abstract Do not call this function directly; use simd::asin instead. */ static SIMD_CPPFUNC double __tg_asin(double x) { return ::asin(x); } /*! @abstract Do not call this function directly; use simd::atan instead. */ -static SIMD_CPPFUNC float __tg_atan(float x) { return ::atan(x); } +static SIMD_CPPFUNC float __tg_atan(float x) { return ::atanf(x); } /*! @abstract Do not call this function directly; use simd::atan instead. */ static SIMD_CPPFUNC double __tg_atan(double x) { return ::atan(x); } /*! @abstract Do not call this function directly; use simd::cos instead. */ -static SIMD_CPPFUNC float __tg_cos(float x) { return ::cos(x); } +static SIMD_CPPFUNC float __tg_cos(float x) { return ::cosf(x); } /*! @abstract Do not call this function directly; use simd::cos instead. */ static SIMD_CPPFUNC double __tg_cos(double x) { return ::cos(x); } /*! @abstract Do not call this function directly; use simd::sin instead. */ -static SIMD_CPPFUNC float __tg_sin(float x) { return ::sin(x); } +static SIMD_CPPFUNC float __tg_sin(float x) { return ::sinf(x); } /*! @abstract Do not call this function directly; use simd::sin instead. */ static SIMD_CPPFUNC double __tg_sin(double x) { return ::sin(x); } /*! @abstract Do not call this function directly; use simd::tan instead. */ -static SIMD_CPPFUNC float __tg_tan(float x) { return ::tan(x); } +static SIMD_CPPFUNC float __tg_tan(float x) { return ::tanf(x); } /*! @abstract Do not call this function directly; use simd::tan instead. */ static SIMD_CPPFUNC double __tg_tan(double x) { return ::tan(x); } /*! @abstract Do not call this function directly; use simd::cospi instead. */ -static SIMD_CPPFUNC float __tg_cospi(float x) { return ::__cospi(x); } +static SIMD_CPPFUNC float __tg_cospi(float x) { return ::__cospif(x); } /*! @abstract Do not call this function directly; use simd::cospi instead. */ static SIMD_CPPFUNC double __tg_cospi(double x) { return ::__cospi(x); } /*! @abstract Do not call this function directly; use simd::sinpi instead. */ -static SIMD_CPPFUNC float __tg_sinpi(float x) { return ::__sinpi(x); } +static SIMD_CPPFUNC float __tg_sinpi(float x) { return ::__sinpif(x); } /*! @abstract Do not call this function directly; use simd::sinpi instead. */ static SIMD_CPPFUNC double __tg_sinpi(double x) { return ::__sinpi(x); } /*! @abstract Do not call this function directly; use simd::tanpi instead. */ -static SIMD_CPPFUNC float __tg_tanpi(float x) { return ::__tanpi(x); } +static SIMD_CPPFUNC float __tg_tanpi(float x) { return ::__tanpif(x); } /*! @abstract Do not call this function directly; use simd::tanpi instead. */ static SIMD_CPPFUNC double __tg_tanpi(double x) { return ::__tanpi(x); } /*! @abstract Do not call this function directly; use simd::acosh instead. */ -static SIMD_CPPFUNC float __tg_acosh(float x) { return ::acosh(x); } +static SIMD_CPPFUNC float __tg_acosh(float x) { return ::acoshf(x); } /*! @abstract Do not call this function directly; use simd::acosh instead. */ static SIMD_CPPFUNC double __tg_acosh(double x) { return ::acosh(x); } /*! @abstract Do not call this function directly; use simd::asinh instead. */ -static SIMD_CPPFUNC float __tg_asinh(float x) { return ::asinh(x); } +static SIMD_CPPFUNC float __tg_asinh(float x) { return ::asinhf(x); } /*! @abstract Do not call this function directly; use simd::asinh instead. */ static SIMD_CPPFUNC double __tg_asinh(double x) { return ::asinh(x); } /*! @abstract Do not call this function directly; use simd::atanh instead. */ -static SIMD_CPPFUNC float __tg_atanh(float x) { return ::atanh(x); } +static SIMD_CPPFUNC float __tg_atanh(float x) { return ::atanhf(x); } /*! @abstract Do not call this function directly; use simd::atanh instead. */ static SIMD_CPPFUNC double __tg_atanh(double x) { return ::atanh(x); } /*! @abstract Do not call this function directly; use simd::cosh instead. */ -static SIMD_CPPFUNC float __tg_cosh(float x) { return ::cosh(x); } +static SIMD_CPPFUNC float __tg_cosh(float x) { return ::coshf(x); } /*! @abstract Do not call this function directly; use simd::cosh instead. */ static SIMD_CPPFUNC double __tg_cosh(double x) { return ::cosh(x); } /*! @abstract Do not call this function directly; use simd::sinh instead. */ -static SIMD_CPPFUNC float __tg_sinh(float x) { return ::sinh(x); } +static SIMD_CPPFUNC float __tg_sinh(float x) { return ::sinhf(x); } /*! @abstract Do not call this function directly; use simd::sinh instead. */ static SIMD_CPPFUNC double __tg_sinh(double x) { return ::sinh(x); } /*! @abstract Do not call this function directly; use simd::tanh instead. */ -static SIMD_CPPFUNC float __tg_tanh(float x) { return ::tanh(x); } +static SIMD_CPPFUNC float __tg_tanh(float x) { return ::tanhf(x); } /*! @abstract Do not call this function directly; use simd::tanh instead. */ static SIMD_CPPFUNC double __tg_tanh(double x) { return ::tanh(x); } /*! @abstract Do not call this function directly; use simd::exp instead. */ -static SIMD_CPPFUNC float __tg_exp(float x) { return ::exp(x); } +static SIMD_CPPFUNC float __tg_exp(float x) { return ::expf(x); } /*! @abstract Do not call this function directly; use simd::exp instead. */ static SIMD_CPPFUNC double __tg_exp(double x) { return ::exp(x); } /*! @abstract Do not call this function directly; use simd::exp2 instead. */ -static SIMD_CPPFUNC float __tg_exp2(float x) { return ::exp2(x); } +static SIMD_CPPFUNC float __tg_exp2(float x) { return ::exp2f(x); } /*! @abstract Do not call this function directly; use simd::exp2 instead. */ static SIMD_CPPFUNC double __tg_exp2(double x) { return ::exp2(x); } /*! @abstract Do not call this function directly; use simd::exp10 instead. */ -static SIMD_CPPFUNC float __tg_exp10(float x) { return ::__exp10(x); } +static SIMD_CPPFUNC float __tg_exp10(float x) { return ::__exp10f(x); } /*! @abstract Do not call this function directly; use simd::exp10 instead. */ static SIMD_CPPFUNC double __tg_exp10(double x) { return ::__exp10(x); } /*! @abstract Do not call this function directly; use simd::expm1 instead. */ -static SIMD_CPPFUNC float __tg_expm1(float x) { return ::expm1(x); } +static SIMD_CPPFUNC float __tg_expm1(float x) { return ::expm1f(x); } /*! @abstract Do not call this function directly; use simd::expm1 instead. */ static SIMD_CPPFUNC double __tg_expm1(double x) { return ::expm1(x); } /*! @abstract Do not call this function directly; use simd::log instead. */ -static SIMD_CPPFUNC float __tg_log(float x) { return ::log(x); } +static SIMD_CPPFUNC float __tg_log(float x) { return ::logf(x); } /*! @abstract Do not call this function directly; use simd::log instead. */ static SIMD_CPPFUNC double __tg_log(double x) { return ::log(x); } /*! @abstract Do not call this function directly; use simd::log2 instead. */ -static SIMD_CPPFUNC float __tg_log2(float x) { return ::log2(x); } +static SIMD_CPPFUNC float __tg_log2(float x) { return ::log2f(x); } /*! @abstract Do not call this function directly; use simd::log2 instead. */ static SIMD_CPPFUNC double __tg_log2(double x) { return ::log2(x); } /*! @abstract Do not call this function directly; use simd::log10 instead. */ -static SIMD_CPPFUNC float __tg_log10(float x) { return ::log10(x); } +static SIMD_CPPFUNC float __tg_log10(float x) { return ::log10f(x); } /*! @abstract Do not call this function directly; use simd::log10 instead. */ static SIMD_CPPFUNC double __tg_log10(double x) { return ::log10(x); } /*! @abstract Do not call this function directly; use simd::log1p instead. */ -static SIMD_CPPFUNC float __tg_log1p(float x) { return ::log1p(x); } +static SIMD_CPPFUNC float __tg_log1p(float x) { return ::log1pf(x); } /*! @abstract Do not call this function directly; use simd::log1p instead. */ static SIMD_CPPFUNC double __tg_log1p(double x) { return ::log1p(x); } /*! @abstract Do not call this function directly; use simd::fabs instead. */ -static SIMD_CPPFUNC float __tg_fabs(float x) { return ::fabs(x); } +static SIMD_CPPFUNC float __tg_fabs(float x) { return ::fabsf(x); } /*! @abstract Do not call this function directly; use simd::fabs instead. */ static SIMD_CPPFUNC double __tg_fabs(double x) { return ::fabs(x); } /*! @abstract Do not call this function directly; use simd::cbrt instead. */ -static SIMD_CPPFUNC float __tg_cbrt(float x) { return ::cbrt(x); } +static SIMD_CPPFUNC float __tg_cbrt(float x) { return ::cbrtf(x); } /*! @abstract Do not call this function directly; use simd::cbrt instead. */ static SIMD_CPPFUNC double __tg_cbrt(double x) { return ::cbrt(x); } /*! @abstract Do not call this function directly; use simd::sqrt instead. */ -static SIMD_CPPFUNC float __tg_sqrt(float x) { return ::sqrt(x); } +static SIMD_CPPFUNC float __tg_sqrt(float x) { return ::sqrtf(x); } /*! @abstract Do not call this function directly; use simd::sqrt instead. */ static SIMD_CPPFUNC double __tg_sqrt(double x) { return ::sqrt(x); } /*! @abstract Do not call this function directly; use simd::erf instead. */ -static SIMD_CPPFUNC float __tg_erf(float x) { return ::erf(x); } +static SIMD_CPPFUNC float __tg_erf(float x) { return ::erff(x); } /*! @abstract Do not call this function directly; use simd::erf instead. */ static SIMD_CPPFUNC double __tg_erf(double x) { return ::erf(x); } /*! @abstract Do not call this function directly; use simd::erfc instead. */ -static SIMD_CPPFUNC float __tg_erfc(float x) { return ::erfc(x); } +static SIMD_CPPFUNC float __tg_erfc(float x) { return ::erfcf(x); } /*! @abstract Do not call this function directly; use simd::erfc instead. */ static SIMD_CPPFUNC double __tg_erfc(double x) { return ::erfc(x); } /*! @abstract Do not call this function directly; use simd::tgamma instead. */ -static SIMD_CPPFUNC float __tg_tgamma(float x) { return ::tgamma(x); } +static SIMD_CPPFUNC float __tg_tgamma(float x) { return ::tgammaf(x); } /*! @abstract Do not call this function directly; use simd::tgamma instead. */ static SIMD_CPPFUNC double __tg_tgamma(double x) { return ::tgamma(x); } +/*! @abstract Do not call this function directly; use simd::lgamma instead. */ +static SIMD_CPPFUNC float __tg_lgamma(float x) { return ::lgammaf(x); } +/*! @abstract Do not call this function directly; use simd::lgamma instead. */ +static SIMD_CPPFUNC double __tg_lgamma(double x) { return ::lgamma(x); } /*! @abstract Do not call this function directly; use simd::ceil instead. */ -static SIMD_CPPFUNC float __tg_ceil(float x) { return ::ceil(x); } +static SIMD_CPPFUNC float __tg_ceil(float x) { return ::ceilf(x); } /*! @abstract Do not call this function directly; use simd::ceil instead. */ static SIMD_CPPFUNC double __tg_ceil(double x) { return ::ceil(x); } /*! @abstract Do not call this function directly; use simd::floor instead. */ -static SIMD_CPPFUNC float __tg_floor(float x) { return ::floor(x); } +static SIMD_CPPFUNC float __tg_floor(float x) { return ::floorf(x); } /*! @abstract Do not call this function directly; use simd::floor instead. */ static SIMD_CPPFUNC double __tg_floor(double x) { return ::floor(x); } /*! @abstract Do not call this function directly; use simd::rint instead. */ -static SIMD_CPPFUNC float __tg_rint(float x) { return ::rint(x); } +static SIMD_CPPFUNC float __tg_rint(float x) { return ::rintf(x); } /*! @abstract Do not call this function directly; use simd::rint instead. */ static SIMD_CPPFUNC double __tg_rint(double x) { return ::rint(x); } /*! @abstract Do not call this function directly; use simd::round instead. */ -static SIMD_CPPFUNC float __tg_round(float x) { return ::round(x); } +static SIMD_CPPFUNC float __tg_round(float x) { return ::roundf(x); } /*! @abstract Do not call this function directly; use simd::round instead. */ static SIMD_CPPFUNC double __tg_round(double x) { return ::round(x); } /*! @abstract Do not call this function directly; use simd::trunc instead. */ -static SIMD_CPPFUNC float __tg_trunc(float x) { return ::trunc(x); } +static SIMD_CPPFUNC float __tg_trunc(float x) { return ::truncf(x); } /*! @abstract Do not call this function directly; use simd::trunc instead. */ static SIMD_CPPFUNC double __tg_trunc(double x) { return ::trunc(x); } +#if SIMD_LIBRARY_VERSION >= 5 +/*! @abstract Do not call this function directly; use simd::sincos instead. */ +static SIMD_INLINE SIMD_NODEBUG void __tg_sincos(float x, float *sinp, float *cosp) { ::__sincosf(x, sinp, cosp); } +/*! @abstract Do not call this function directly; use simd::sincos instead. */ +static SIMD_INLINE SIMD_NODEBUG void __tg_sincos(double x, double *sinp, double *cosp) { ::__sincos(x, sinp, cosp); } +/*! @abstract Do not call this function directly; use simd::sincospi + * instead. */ +static SIMD_INLINE SIMD_NODEBUG void __tg_sincospi(float x, float *sinp, float *cosp) { ::__sincospif(x, sinp, cosp); } +/*! @abstract Do not call this function directly; use simd::sincospi + * instead. */ +static SIMD_INLINE SIMD_NODEBUG void __tg_sincospi(double x, double *sinp, double *cosp) { ::__sincospi(x, sinp, cosp); } +#endif +/*! @abstract Do not call this function directly; use simd::isfinite + * instead. */ +static SIMD_CPPFUNC float __tg_isfinite(float x) { return ::isfinite(x); } +/*! @abstract Do not call this function directly; use simd::isfinite + * instead. */ +static SIMD_CPPFUNC double __tg_isfinite(double x) { return ::isfinite(x); } +/*! @abstract Do not call this function directly; use simd::isinf instead. */ +static SIMD_CPPFUNC float __tg_isinf(float x) { return ::isinf(x); } +/*! @abstract Do not call this function directly; use simd::isinf instead. */ +static SIMD_CPPFUNC double __tg_isinf(double x) { return ::isinf(x); } +/*! @abstract Do not call this function directly; use simd::isnan instead. */ +static SIMD_CPPFUNC float __tg_isnan(float x) { return ::isnan(x); } +/*! @abstract Do not call this function directly; use simd::isnan instead. */ +static SIMD_CPPFUNC double __tg_isnan(double x) { return ::isnan(x); } +/*! @abstract Do not call this function directly; use simd::isnormal + * instead. */ +static SIMD_CPPFUNC float __tg_isnormal(float x) { return ::isnormal(x); } +/*! @abstract Do not call this function directly; use simd::isnormal + * instead. */ +static SIMD_CPPFUNC double __tg_isnormal(double x) { return ::isnormal(x); } /*! @abstract Do not call this function directly; use simd::atan2 instead. */ -static SIMD_CPPFUNC float __tg_atan2(float x, float y) { return ::atan2(x, y); } +static SIMD_CPPFUNC float __tg_atan2(float x, float y) { return ::atan2f(x, y); } /*! @abstract Do not call this function directly; use simd::atan2 instead. */ -static SIMD_CPPFUNC double __tg_atan2(double x, float y) { return ::atan2(x, y); } +static SIMD_CPPFUNC double __tg_atan2(double x, double y) { return ::atan2(x, y); } /*! @abstract Do not call this function directly; use simd::hypot instead. */ -static SIMD_CPPFUNC float __tg_hypot(float x, float y) { return ::hypot(x, y); } +static SIMD_CPPFUNC float __tg_hypot(float x, float y) { return ::hypotf(x, y); } /*! @abstract Do not call this function directly; use simd::hypot instead. */ -static SIMD_CPPFUNC double __tg_hypot(double x, float y) { return ::hypot(x, y); } +static SIMD_CPPFUNC double __tg_hypot(double x, double y) { return ::hypot(x, y); } /*! @abstract Do not call this function directly; use simd::pow instead. */ -static SIMD_CPPFUNC float __tg_pow(float x, float y) { return ::pow(x, y); } +static SIMD_CPPFUNC float __tg_pow(float x, float y) { return ::powf(x, y); } /*! @abstract Do not call this function directly; use simd::pow instead. */ -static SIMD_CPPFUNC double __tg_pow(double x, float y) { return ::pow(x, y); } +static SIMD_CPPFUNC double __tg_pow(double x, double y) { return ::pow(x, y); } /*! @abstract Do not call this function directly; use simd::fmod instead. */ -static SIMD_CPPFUNC float __tg_fmod(float x, float y) { return ::fmod(x, y); } +static SIMD_CPPFUNC float __tg_fmod(float x, float y) { return ::fmodf(x, y); } /*! @abstract Do not call this function directly; use simd::fmod instead. */ -static SIMD_CPPFUNC double __tg_fmod(double x, float y) { return ::fmod(x, y); } +static SIMD_CPPFUNC double __tg_fmod(double x, double y) { return ::fmod(x, y); } /*! @abstract Do not call this function directly; use simd::remainder * instead. */ -static SIMD_CPPFUNC float __tg_remainder(float x, float y) { return ::remainder(x, y); } +static SIMD_CPPFUNC float __tg_remainder(float x, float y) { return ::remainderf(x, y); } /*! @abstract Do not call this function directly; use simd::remainder * instead. */ -static SIMD_CPPFUNC double __tg_remainder(double x, float y) { return ::remainder(x, y); } +static SIMD_CPPFUNC double __tg_remainder(double x, double y) { return ::remainder(x, y); } /*! @abstract Do not call this function directly; use simd::copysign * instead. */ -static SIMD_CPPFUNC float __tg_copysign(float x, float y) { return ::copysign(x, y); } +static SIMD_CPPFUNC float __tg_copysign(float x, float y) { return ::copysignf(x, y); } /*! @abstract Do not call this function directly; use simd::copysign * instead. */ -static SIMD_CPPFUNC double __tg_copysign(double x, float y) { return ::copysign(x, y); } +static SIMD_CPPFUNC double __tg_copysign(double x, double y) { return ::copysign(x, y); } /*! @abstract Do not call this function directly; use simd::nextafter * instead. */ -static SIMD_CPPFUNC float __tg_nextafter(float x, float y) { return ::nextafter(x, y); } +static SIMD_CPPFUNC float __tg_nextafter(float x, float y) { return ::nextafterf(x, y); } /*! @abstract Do not call this function directly; use simd::nextafter * instead. */ -static SIMD_CPPFUNC double __tg_nextafter(double x, float y) { return ::nextafter(x, y); } +static SIMD_CPPFUNC double __tg_nextafter(double x, double y) { return ::nextafter(x, y); } /*! @abstract Do not call this function directly; use simd::fdim instead. */ -static SIMD_CPPFUNC float __tg_fdim(float x, float y) { return ::fdim(x, y); } +static SIMD_CPPFUNC float __tg_fdim(float x, float y) { return ::fdimf(x, y); } /*! @abstract Do not call this function directly; use simd::fdim instead. */ -static SIMD_CPPFUNC double __tg_fdim(double x, float y) { return ::fdim(x, y); } +static SIMD_CPPFUNC double __tg_fdim(double x, double y) { return ::fdim(x, y); } /*! @abstract Do not call this function directly; use simd::fmax instead. */ -static SIMD_CPPFUNC float __tg_fmax(float x, float y) { return ::fmax(x, y); } +static SIMD_CPPFUNC float __tg_fmax(float x, float y) { return ::fmaxf(x, y); } /*! @abstract Do not call this function directly; use simd::fmax instead. */ -static SIMD_CPPFUNC double __tg_fmax(double x, float y) { return ::fmax(x, y); } +static SIMD_CPPFUNC double __tg_fmax(double x, double y) { return ::fmax(x, y); } /*! @abstract Do not call this function directly; use simd::fmin instead. */ -static SIMD_CPPFUNC float __tg_fmin(float x, float y) { return ::fmin(x, y); } +static SIMD_CPPFUNC float __tg_fmin(float x, float y) { return ::fminf(x, y); } /*! @abstract Do not call this function directly; use simd::fmin instead. */ -static SIMD_CPPFUNC double __tg_fmin(double x, float y) { return ::fmin(x, y); } +static SIMD_CPPFUNC double __tg_fmin(double x, double y) { return ::fmin(x, y); } /*! @abstract Do not call this function directly; use simd::fma instead. */ -static SIMD_CPPFUNC float __tg_fma(float x, float y, float z) { return ::fma(x, y, z); } +static SIMD_CPPFUNC float __tg_fma(float x, float y, float z) { return ::fmaf(x, y, z); } /*! @abstract Do not call this function directly; use simd::fma instead. */ static SIMD_CPPFUNC double __tg_fma(double x, double y, double z) { return ::fma(x, y, z); } @@ -1742,6 +1978,11 @@ namespace simd { template static SIMD_CPPFUNC fptypeN tgamma(fptypeN x) { return ::__tg_tgamma(x); } +/*! @abstract Generalizes the function lgamma to operate on vectors + * of floats and doubles. */ + template + static SIMD_CPPFUNC fptypeN lgamma(fptypeN x) { return ::__tg_lgamma(x); } + /*! @abstract Generalizes the function ceil to operate on vectors of * floats and doubles. */ template @@ -1767,6 +2008,44 @@ namespace simd { template static SIMD_CPPFUNC fptypeN trunc(fptypeN x) { return ::__tg_trunc(x); } +#if SIMD_LIBRARY_VERSION >= 5 +/*! @abstract Computes sincos more efficiently than separate computations. */ + template + static SIMD_INLINE SIMD_NODEBUG void sincos(fptypeN x, fptypeN *sinp, fptypeN *cosp) { ::__tg_sincos(x, sinp, cosp); } + +/*! @abstract Computes sincospi more efficiently than separate computations. */ + template + static SIMD_INLINE SIMD_NODEBUG void sincospi(fptypeN x, fptypeN *sinp, fptypeN *cosp) { ::__tg_sincospi(x, sinp, cosp); } + +#endif +/*! @abstract Generalizes the function isfinite to operate on + * vectors of floats and doubles. */ + template + static SIMD_CPPFUNC + typename std::enable_if::scalar_t>::value, typename traits::mask_t>::type + isfinite(fptypeN x) { return ::__tg_isfinite(x); } + +/*! @abstract Generalizes the function isinf to operate on vectors + * of floats and doubles. */ + template + static SIMD_CPPFUNC + typename std::enable_if::scalar_t>::value, typename traits::mask_t>::type + isinf(fptypeN x) { return ::__tg_isinf(x); } + +/*! @abstract Generalizes the function isnan to operate on vectors + * of floats and doubles. */ + template + static SIMD_CPPFUNC + typename std::enable_if::scalar_t>::value, typename traits::mask_t>::type + isnan(fptypeN x) { return ::__tg_isnan(x); } + +/*! @abstract Generalizes the function isnormal to operate on + * vectors of floats and doubles. */ + template + static SIMD_CPPFUNC + typename std::enable_if::scalar_t>::value, typename traits::mask_t>::type + isnormal(fptypeN x) { return ::__tg_isnormal(x); } + /*! @abstract Generalizes the function atan2 to operate on vectors * of floats and doubles. */ template @@ -1876,6 +2155,26 @@ static inline SIMD_CFUNC double __tg_tanpi(double x) { return __tanpi(x); } * floats and doubles as provided by ``. */ #define tanpi(__x) __tg_tanpi(__tg_promote1((__x))(__x)) +#if SIMD_LIBRARY_VERSION >= 5 +static inline SIMD_NONCONST void __tg_sincos(float x, float *sinp, float *cosp) { __sincosf(x, sinp, cosp); } +static inline SIMD_NONCONST void __tg_sincos(double x, double *sinp, double *cosp) { __sincos(x, sinp, cosp); } +#undef sincos +/*! @abstract `sincos(x)` computes `sin(x)` and `cos(x)` more efficiently. + * + * @discussion Defined for `float` and `double` as well as vectors of + * floats and doubles as provided by ``. */ +#define sincos(__x, __sinp, __cosp) __tg_sincos(__tg_promote1((__x))(__x), __sinp, __cosp) + +static inline SIMD_NONCONST void __tg_sincospi(float x, float *sinp, float *cosp) { __sincospif(x, sinp, cosp); } +static inline SIMD_NONCONST void __tg_sincospi(double x, double *sinp, double *cosp) { __sincospi(x, sinp, cosp); } +#undef sincospi +/*! @abstract `sincospi(x)` computes `sin(pi * x)` and `cos(pi * x)` more efficiently. + * + * @discussion Defined for `float` and `double` as well as vectors of + * floats and doubles as provided by ``. */ +#define sincospi(__x, __sinp, __cosp) __tg_sincospi(__tg_promote1((__x))(__x), __sinp, __cosp) +#endif // SIMD_LIBRARY_VERSION >= 5 + static inline SIMD_CFUNC float __tg_exp10(float x) { return __exp10f(x); } static inline SIMD_CFUNC double __tg_exp10(double x) { return __exp10(x); } #undef exp10 @@ -1886,7 +2185,90 @@ static inline SIMD_CFUNC double __tg_exp10(double x) { return __exp10(x); } * and doubles as provided by ``. */ #define exp10(__x) __tg_exp10(__tg_promote1((__x))(__x)) #endif - + +#if (defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__) +static inline SIMD_CFUNC int __tg_isfinite(float x) { return __inline_isfinitef(x); } +static inline SIMD_CFUNC int __tg_isfinite(double x) { return __inline_isfinited(x); } +static inline SIMD_CFUNC int __tg_isfinite(long double x) { return __inline_isfinitel(x); } +#undef isfinite +/*! @abstract `__tg_isfinite(x)` determines if x is a finite value. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isfinite(__x) __tg_isfinite(__tg_promote1((__x))(__x)) + +static inline SIMD_CFUNC int __tg_isinf(float x) { return __inline_isinff(x); } +static inline SIMD_CFUNC int __tg_isinf(double x) { return __inline_isinfd(x); } +static inline SIMD_CFUNC int __tg_isinf(long double x) { return __inline_isinfl(x); } +#undef isinf +/*! @abstract `__tg_isinf(x)` determines if x is positive or negative infinity. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isinf(__x) __tg_isinf(__tg_promote1((__x))(__x)) + +static inline SIMD_CFUNC int __tg_isnan(float x) { return __inline_isnanf(x); } +static inline SIMD_CFUNC int __tg_isnan(double x) { return __inline_isnand(x); } +static inline SIMD_CFUNC int __tg_isnan(long double x) { return __inline_isnanl(x); } +#undef isnan +/*! @abstract `__tg_isnan(x)` determines if x is a not-a-number (NaN) value. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isnan(__x) __tg_isnan(__tg_promote1((__x))(__x)) + +static inline SIMD_CFUNC int __tg_isnormal(float x) { return __inline_isnormalf(x); } +static inline SIMD_CFUNC int __tg_isnormal(double x) { return __inline_isnormald(x); } +static inline SIMD_CFUNC int __tg_isnormal(long double x) { return __inline_isnormall(x); } +#undef isnormal +/*! @abstract `__tg_isnormal(x)` determines if x is a normal value. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isnormal(__x) __tg_isnormal(__tg_promote1((__x))(__x)) + +#else /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */ + +static inline SIMD_CFUNC int __tg_isfinite(float x) { return __isfinitef(x); } +static inline SIMD_CFUNC int __tg_isfinite(double x) { return __isfinited(x); } +static inline SIMD_CFUNC int __tg_isfinite(long double x) { return __isfinitel(x); } +#undef isfinite +/*! @abstract `__tg_isfinite(x)` determines if x is a finite value. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isfinite(__x) __tg_isfinite(__tg_promote1((__x))(__x)) + +static inline SIMD_CFUNC int __tg_isinf(float x) { return __isinff(x); } +static inline SIMD_CFUNC int __tg_isinf(double x) { return __isinfd(x); } +static inline SIMD_CFUNC int __tg_isinf(long double x) { return __isinfl(x); } +#undef isinf +/*! @abstract `__tg_isinf(x)` determines if x is positive or negative infinity. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isinf(__x) __tg_isinf(__tg_promote1((__x))(__x)) + +static inline SIMD_CFUNC int __tg_isnan(float x) { return __isnanf(x); } +static inline SIMD_CFUNC int __tg_isnan(double x) { return __isnand(x); } +static inline SIMD_CFUNC int __tg_isnan(long double x) { return __isnanl(x); } +#undef isnan +/*! @abstract `__tg_isnan(x)` determines if x is a not-a-number (NaN) value. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isnan(__x) __tg_isnan(__tg_promote1((__x))(__x)) + +static inline SIMD_CFUNC int __tg_isnormal(float x) { return __isnormalf(x); } +static inline SIMD_CFUNC int __tg_isnormal(double x) { return __isnormald(x); } +static inline SIMD_CFUNC int __tg_isnormal(long double x) { return __isnormall(x); } +#undef isnormal +/*! @abstract `__tg_isnormal(x)` determines if x is a normal value. + * + * @discussion Defined for `float`, `double` and `long double` as well as vectors of floats + * and doubles as provided by ``. */ +#define isnormal(__x) __tg_isnormal(__tg_promote1((__x))(__x)) +#endif /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */ #endif /* !__cplusplus */ #pragma mark - fabs implementation @@ -1895,11 +2277,55 @@ static inline SIMD_CFUNC simd_float3 __tg_fabs(simd_float3 x) { return simd_bits static inline SIMD_CFUNC simd_float4 __tg_fabs(simd_float4 x) { return simd_bitselect(0.0, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float8 __tg_fabs(simd_float8 x) { return simd_bitselect(0.0, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float16 __tg_fabs(simd_float16 x) { return simd_bitselect(0.0, x, 0x7fffffff); } -static inline SIMD_CFUNC simd_double2 __tg_fabs(simd_double2 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffffL); } -static inline SIMD_CFUNC simd_double3 __tg_fabs(simd_double3 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffffL); } -static inline SIMD_CFUNC simd_double4 __tg_fabs(simd_double4 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffffL); } -static inline SIMD_CFUNC simd_double8 __tg_fabs(simd_double8 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffffL); } +static inline SIMD_CFUNC simd_double2 __tg_fabs(simd_double2 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); } +static inline SIMD_CFUNC simd_double3 __tg_fabs(simd_double3 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); } +static inline SIMD_CFUNC simd_double4 __tg_fabs(simd_double4 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); } +static inline SIMD_CFUNC simd_double8 __tg_fabs(simd_double8 x) { return simd_bitselect(0.0, x, 0x7fffffffffffffff); } +#pragma mark - isfinite implementation +static inline SIMD_CFUNC simd_int2 __tg_isfinite(simd_float2 x) { return x == x && __tg_fabs(x) != (simd_float2)INFINITY; } +static inline SIMD_CFUNC simd_int3 __tg_isfinite(simd_float3 x) { return x == x && __tg_fabs(x) != (simd_float3)INFINITY; } +static inline SIMD_CFUNC simd_int4 __tg_isfinite(simd_float4 x) { return x == x && __tg_fabs(x) != (simd_float4)INFINITY; } +static inline SIMD_CFUNC simd_int8 __tg_isfinite(simd_float8 x) { return x == x && __tg_fabs(x) != (simd_float8)INFINITY; } +static inline SIMD_CFUNC simd_int16 __tg_isfinite(simd_float16 x) { return x == x && __tg_fabs(x) != (simd_float16)INFINITY; } +static inline SIMD_CFUNC simd_long2 __tg_isfinite(simd_double2 x) { return x == x && __tg_fabs(x) != (simd_double2)INFINITY; } +static inline SIMD_CFUNC simd_long3 __tg_isfinite(simd_double3 x) { return x == x && __tg_fabs(x) != (simd_double3)INFINITY; } +static inline SIMD_CFUNC simd_long4 __tg_isfinite(simd_double4 x) { return x == x && __tg_fabs(x) != (simd_double4)INFINITY; } +static inline SIMD_CFUNC simd_long8 __tg_isfinite(simd_double8 x) { return x == x && __tg_fabs(x) != (simd_double8)INFINITY; } + +#pragma mark - isinf implementation +static inline SIMD_CFUNC simd_int2 __tg_isinf(simd_float2 x) { return __tg_fabs(x) == (simd_float2)INFINITY; } +static inline SIMD_CFUNC simd_int3 __tg_isinf(simd_float3 x) { return __tg_fabs(x) == (simd_float3)INFINITY; } +static inline SIMD_CFUNC simd_int4 __tg_isinf(simd_float4 x) { return __tg_fabs(x) == (simd_float4)INFINITY; } +static inline SIMD_CFUNC simd_int8 __tg_isinf(simd_float8 x) { return __tg_fabs(x) == (simd_float8)INFINITY; } +static inline SIMD_CFUNC simd_int16 __tg_isinf(simd_float16 x) { return __tg_fabs(x) == (simd_float16)INFINITY; } +static inline SIMD_CFUNC simd_long2 __tg_isinf(simd_double2 x) { return __tg_fabs(x) == (simd_double2)INFINITY; } +static inline SIMD_CFUNC simd_long3 __tg_isinf(simd_double3 x) { return __tg_fabs(x) == (simd_double3)INFINITY; } +static inline SIMD_CFUNC simd_long4 __tg_isinf(simd_double4 x) { return __tg_fabs(x) == (simd_double4)INFINITY; } +static inline SIMD_CFUNC simd_long8 __tg_isinf(simd_double8 x) { return __tg_fabs(x) == (simd_double8)INFINITY; } + +#pragma mark - isnan implementation +static inline SIMD_CFUNC simd_int2 __tg_isnan(simd_float2 x) { return x != x; } +static inline SIMD_CFUNC simd_int3 __tg_isnan(simd_float3 x) { return x != x; } +static inline SIMD_CFUNC simd_int4 __tg_isnan(simd_float4 x) { return x != x; } +static inline SIMD_CFUNC simd_int8 __tg_isnan(simd_float8 x) { return x != x; } +static inline SIMD_CFUNC simd_int16 __tg_isnan(simd_float16 x) { return x != x; } +static inline SIMD_CFUNC simd_long2 __tg_isnan(simd_double2 x) { return x != x; } +static inline SIMD_CFUNC simd_long3 __tg_isnan(simd_double3 x) { return x != x; } +static inline SIMD_CFUNC simd_long4 __tg_isnan(simd_double4 x) { return x != x; } +static inline SIMD_CFUNC simd_long8 __tg_isnan(simd_double8 x) { return x != x; } + +#pragma mark - isnormal implementation +static inline SIMD_CFUNC simd_int2 __tg_isnormal(simd_float2 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float2)__FLT_MIN__; } +static inline SIMD_CFUNC simd_int3 __tg_isnormal(simd_float3 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float3)__FLT_MIN__; } +static inline SIMD_CFUNC simd_int4 __tg_isnormal(simd_float4 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float4)__FLT_MIN__; } +static inline SIMD_CFUNC simd_int8 __tg_isnormal(simd_float8 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float8)__FLT_MIN__; } +static inline SIMD_CFUNC simd_int16 __tg_isnormal(simd_float16 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_float16)__FLT_MIN__; } +static inline SIMD_CFUNC simd_long2 __tg_isnormal(simd_double2 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double2)__DBL_MIN__; } +static inline SIMD_CFUNC simd_long3 __tg_isnormal(simd_double3 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double3)__DBL_MIN__; } +static inline SIMD_CFUNC simd_long4 __tg_isnormal(simd_double4 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double4)__DBL_MIN__; } +static inline SIMD_CFUNC simd_long8 __tg_isnormal(simd_double8 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_double8)__DBL_MIN__; } + #pragma mark - fmin, fmax implementation static SIMD_CFUNC simd_float2 __tg_fmin(simd_float2 x, simd_float2 y) { #if defined __SSE2__ @@ -1946,11 +2372,11 @@ static SIMD_CFUNC simd_float8 __tg_fmin(simd_float8 x, simd_float8 y) { } static SIMD_CFUNC simd_float16 __tg_fmin(simd_float16 x, simd_float16 y) { -#if defined __AVX512DQ__ && !__FINITE_MATH_ONLY__ +#if defined __x86_64__ && defined __AVX512DQ__ && !__FINITE_MATH_ONLY__ return _mm512_range_ps(x, y, 4); -#elif defined __AVX512F__ && __FINITE_MATH_ONLY__ +#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__ return _mm512_min_ps(x, y); -#elif defined __AVX512F__ +#elif defined __x86_64__ && defined __AVX512F__ return simd_bitselect(_mm512_min_ps(x, y), x, y != y); #else return simd_make_float16(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi)); @@ -1988,11 +2414,11 @@ static SIMD_CFUNC simd_double4 __tg_fmin(simd_double4 x, simd_double4 y) { } static SIMD_CFUNC simd_double8 __tg_fmin(simd_double8 x, simd_double8 y) { -#if defined __AVX512DQ__ +#if defined __x86_64__ && defined __AVX512DQ__ return _mm512_range_pd(x, y, 4); -#elif defined __AVX512F__ && __FINITE_MATH_ONLY__ +#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__ return _mm512_min_pd(x, y); -#elif defined __AVX512F__ +#elif defined __x86_64__ && defined __AVX512F__ return simd_bitselect(_mm512_min_pd(x, y), x, y != y); #else return simd_make_double8(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi)); @@ -2044,11 +2470,11 @@ static SIMD_CFUNC simd_float8 __tg_fmax(simd_float8 x, simd_float8 y) { } static SIMD_CFUNC simd_float16 __tg_fmax(simd_float16 x, simd_float16 y) { -#if defined __AVX512DQ__ && !__FINITE_MATH_ONLY__ +#if defined __x86_64__ && defined __AVX512DQ__ && !__FINITE_MATH_ONLY__ return _mm512_range_ps(x, y, 5); -#elif defined __AVX512F__ && __FINITE_MATH_ONLY__ +#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__ return _mm512_max_ps(x, y); -#elif defined __AVX512F__ +#elif defined __x86_64__ && defined __AVX512F__ return simd_bitselect(_mm512_max_ps(x, y), x, y != y); #else return simd_make_float16(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi)); @@ -2086,11 +2512,11 @@ static SIMD_CFUNC simd_double4 __tg_fmax(simd_double4 x, simd_double4 y) { } static SIMD_CFUNC simd_double8 __tg_fmax(simd_double8 x, simd_double8 y) { -#if defined __AVX512DQ__ +#if defined __x86_64__ && defined __AVX512DQ__ return _mm512_range_pd(x, y, 5); -#elif defined __AVX512F__ && __FINITE_MATH_ONLY__ +#elif defined __x86_64__ && defined __AVX512F__ && __FINITE_MATH_ONLY__ return _mm512_max_pd(x, y); -#elif defined __AVX512F__ +#elif defined __x86_64__ && defined __AVX512F__ return simd_bitselect(_mm512_max_pd(x, y), x, y != y); #else return simd_make_double8(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi)); @@ -2103,10 +2529,10 @@ static inline SIMD_CFUNC simd_float3 __tg_copysign(simd_float3 x, simd_float3 y) static inline SIMD_CFUNC simd_float4 __tg_copysign(simd_float4 x, simd_float4 y) { return simd_bitselect(y, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float8 __tg_copysign(simd_float8 x, simd_float8 y) { return simd_bitselect(y, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float16 __tg_copysign(simd_float16 x, simd_float16 y) { return simd_bitselect(y, x, 0x7fffffff); } -static inline SIMD_CFUNC simd_double2 __tg_copysign(simd_double2 x, simd_double2 y) { return simd_bitselect(y, x, 0x7fffffffffffffffL); } -static inline SIMD_CFUNC simd_double3 __tg_copysign(simd_double3 x, simd_double3 y) { return simd_bitselect(y, x, 0x7fffffffffffffffL); } -static inline SIMD_CFUNC simd_double4 __tg_copysign(simd_double4 x, simd_double4 y) { return simd_bitselect(y, x, 0x7fffffffffffffffL); } -static inline SIMD_CFUNC simd_double8 __tg_copysign(simd_double8 x, simd_double8 y) { return simd_bitselect(y, x, 0x7fffffffffffffffL); } +static inline SIMD_CFUNC simd_double2 __tg_copysign(simd_double2 x, simd_double2 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); } +static inline SIMD_CFUNC simd_double3 __tg_copysign(simd_double3 x, simd_double3 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); } +static inline SIMD_CFUNC simd_double4 __tg_copysign(simd_double4 x, simd_double4 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); } +static inline SIMD_CFUNC simd_double8 __tg_copysign(simd_double8 x, simd_double8 y) { return simd_bitselect(y, x, 0x7fffffffffffffff); } #pragma mark - sqrt implementation static SIMD_CFUNC simd_float2 __tg_sqrt(simd_float2 x) { @@ -2142,7 +2568,7 @@ static SIMD_CFUNC simd_float8 __tg_sqrt(simd_float8 x) { } static SIMD_CFUNC simd_float16 __tg_sqrt(simd_float16 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_sqrt_ps(x); #else return simd_make_float16(__tg_sqrt(x.lo), __tg_sqrt(x.hi)); @@ -2172,7 +2598,7 @@ static SIMD_CFUNC simd_double4 __tg_sqrt(simd_double4 x) { } static SIMD_CFUNC simd_double8 __tg_sqrt(simd_double8 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_sqrt_pd(x); #else return simd_make_double8(__tg_sqrt(x.lo), __tg_sqrt(x.hi)); @@ -2219,7 +2645,7 @@ static SIMD_CFUNC simd_float8 __tg_ceil(simd_float8 x) { } static SIMD_CFUNC simd_float16 __tg_ceil(simd_float16 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_ps(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC); #else return simd_make_float16(__tg_ceil(x.lo), __tg_ceil(x.hi)); @@ -2257,7 +2683,7 @@ static SIMD_CFUNC simd_double4 __tg_ceil(simd_double4 x) { } static SIMD_CFUNC simd_double8 __tg_ceil(simd_double8 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_pd(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC); #else return simd_make_double8(__tg_ceil(x.lo), __tg_ceil(x.hi)); @@ -2303,7 +2729,7 @@ static SIMD_CFUNC simd_float8 __tg_floor(simd_float8 x) { } static SIMD_CFUNC simd_float16 __tg_floor(simd_float16 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_ps(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC); #else return simd_make_float16(__tg_floor(x.lo), __tg_floor(x.hi)); @@ -2341,7 +2767,7 @@ static SIMD_CFUNC simd_double4 __tg_floor(simd_double4 x) { } static SIMD_CFUNC simd_double8 __tg_floor(simd_double8 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_pd(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC); #else return simd_make_double8(__tg_floor(x.lo), __tg_floor(x.hi)); @@ -2387,7 +2813,7 @@ static SIMD_CFUNC simd_float8 __tg_rint(simd_float8 x) { } static SIMD_CFUNC simd_float16 __tg_rint(simd_float16 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_ps(x, _MM_FROUND_RINT); #else return simd_make_float16(__tg_rint(x.lo), __tg_rint(x.hi)); @@ -2425,7 +2851,7 @@ static SIMD_CFUNC simd_double4 __tg_rint(simd_double4 x) { } static SIMD_CFUNC simd_double8 __tg_rint(simd_double8 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_pd(x, _MM_FROUND_RINT); #else return simd_make_double8(__tg_rint(x.lo), __tg_rint(x.hi)); @@ -2472,7 +2898,7 @@ static SIMD_CFUNC simd_float8 __tg_trunc(simd_float8 x) { } static SIMD_CFUNC simd_float16 __tg_trunc(simd_float16 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_ps(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC); #else return simd_make_float16(__tg_trunc(x.lo), __tg_trunc(x.hi)); @@ -2511,7 +2937,7 @@ static SIMD_CFUNC simd_double4 __tg_trunc(simd_double4 x) { } static SIMD_CFUNC simd_double8 __tg_trunc(simd_double8 x) { -#if defined __AVX512F__ +#if defined __x86_64__ && defined __AVX512F__ return _mm512_roundscale_pd(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC); #else return simd_make_double8(__tg_trunc(x.lo), __tg_trunc(x.hi)); @@ -2543,7 +2969,7 @@ static inline SIMD_CFUNC simd_float4 __tg_sin(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_sin_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_sin(simd_float8 x) { return _simd_sin_f8(x); @@ -2554,7 +2980,7 @@ static inline SIMD_CFUNC simd_float8 __tg_sin(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_sin_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_sin(simd_float16 x) { return _simd_sin_f16(x); @@ -2585,7 +3011,7 @@ static inline SIMD_CFUNC simd_double3 __tg_sin(simd_double3 x) { return simd_make_double3(__tg_sin(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_sin_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_sin(simd_double4 x) { return _simd_sin_d4(x); @@ -2596,7 +3022,7 @@ static inline SIMD_CFUNC simd_double4 __tg_sin(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_sin_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_sin(simd_double8 x) { return _simd_sin_d8(x); @@ -2631,7 +3057,7 @@ static inline SIMD_CFUNC simd_float4 __tg_cos(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_cos_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_cos(simd_float8 x) { return _simd_cos_f8(x); @@ -2642,7 +3068,7 @@ static inline SIMD_CFUNC simd_float8 __tg_cos(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_cos_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_cos(simd_float16 x) { return _simd_cos_f16(x); @@ -2673,7 +3099,7 @@ static inline SIMD_CFUNC simd_double3 __tg_cos(simd_double3 x) { return simd_make_double3(__tg_cos(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_cos_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_cos(simd_double4 x) { return _simd_cos_d4(x); @@ -2684,7 +3110,7 @@ static inline SIMD_CFUNC simd_double4 __tg_cos(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_cos_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_cos(simd_double8 x) { return _simd_cos_d8(x); @@ -2716,7 +3142,7 @@ static inline SIMD_CFUNC simd_float4 __tg_acos(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_acos_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_acos(simd_float8 x) { return _simd_acos_f8(x); @@ -2727,7 +3153,7 @@ static inline SIMD_CFUNC simd_float8 __tg_acos(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_acos_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_acos(simd_float16 x) { return _simd_acos_f16(x); @@ -2753,7 +3179,7 @@ static inline SIMD_CFUNC simd_double3 __tg_acos(simd_double3 x) { return simd_make_double3(__tg_acos(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_acos_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_acos(simd_double4 x) { return _simd_acos_d4(x); @@ -2764,7 +3190,7 @@ static inline SIMD_CFUNC simd_double4 __tg_acos(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_acos_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_acos(simd_double8 x) { return _simd_acos_d8(x); @@ -2795,7 +3221,7 @@ static inline SIMD_CFUNC simd_float4 __tg_asin(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_asin_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_asin(simd_float8 x) { return _simd_asin_f8(x); @@ -2806,7 +3232,7 @@ static inline SIMD_CFUNC simd_float8 __tg_asin(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_asin_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_asin(simd_float16 x) { return _simd_asin_f16(x); @@ -2832,7 +3258,7 @@ static inline SIMD_CFUNC simd_double3 __tg_asin(simd_double3 x) { return simd_make_double3(__tg_asin(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_asin_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_asin(simd_double4 x) { return _simd_asin_d4(x); @@ -2843,7 +3269,7 @@ static inline SIMD_CFUNC simd_double4 __tg_asin(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_asin_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_asin(simd_double8 x) { return _simd_asin_d8(x); @@ -2874,7 +3300,7 @@ static inline SIMD_CFUNC simd_float4 __tg_atan(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_atan_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_atan(simd_float8 x) { return _simd_atan_f8(x); @@ -2885,7 +3311,7 @@ static inline SIMD_CFUNC simd_float8 __tg_atan(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_atan_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_atan(simd_float16 x) { return _simd_atan_f16(x); @@ -2911,7 +3337,7 @@ static inline SIMD_CFUNC simd_double3 __tg_atan(simd_double3 x) { return simd_make_double3(__tg_atan(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_atan_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_atan(simd_double4 x) { return _simd_atan_d4(x); @@ -2922,7 +3348,7 @@ static inline SIMD_CFUNC simd_double4 __tg_atan(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_atan_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_atan(simd_double8 x) { return _simd_atan_d8(x); @@ -2953,7 +3379,7 @@ static inline SIMD_CFUNC simd_float4 __tg_tan(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_tan_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_tan(simd_float8 x) { return _simd_tan_f8(x); @@ -2964,7 +3390,7 @@ static inline SIMD_CFUNC simd_float8 __tg_tan(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_tan_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_tan(simd_float16 x) { return _simd_tan_f16(x); @@ -2990,7 +3416,7 @@ static inline SIMD_CFUNC simd_double3 __tg_tan(simd_double3 x) { return simd_make_double3(__tg_tan(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_tan_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_tan(simd_double4 x) { return _simd_tan_d4(x); @@ -3001,7 +3427,7 @@ static inline SIMD_CFUNC simd_double4 __tg_tan(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_tan_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_tan(simd_double8 x) { return _simd_tan_d8(x); @@ -3033,7 +3459,7 @@ static inline SIMD_CFUNC simd_float4 __tg_cospi(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_cospi_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_cospi(simd_float8 x) { return _simd_cospi_f8(x); @@ -3044,7 +3470,7 @@ static inline SIMD_CFUNC simd_float8 __tg_cospi(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_cospi_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_cospi(simd_float16 x) { return _simd_cospi_f16(x); @@ -3070,7 +3496,7 @@ static inline SIMD_CFUNC simd_double3 __tg_cospi(simd_double3 x) { return simd_make_double3(__tg_cospi(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_cospi_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_cospi(simd_double4 x) { return _simd_cospi_d4(x); @@ -3081,7 +3507,7 @@ static inline SIMD_CFUNC simd_double4 __tg_cospi(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_cospi_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_cospi(simd_double8 x) { return _simd_cospi_d8(x); @@ -3114,7 +3540,7 @@ static inline SIMD_CFUNC simd_float4 __tg_sinpi(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_sinpi_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_sinpi(simd_float8 x) { return _simd_sinpi_f8(x); @@ -3125,7 +3551,7 @@ static inline SIMD_CFUNC simd_float8 __tg_sinpi(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_sinpi_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_sinpi(simd_float16 x) { return _simd_sinpi_f16(x); @@ -3151,7 +3577,7 @@ static inline SIMD_CFUNC simd_double3 __tg_sinpi(simd_double3 x) { return simd_make_double3(__tg_sinpi(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_sinpi_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_sinpi(simd_double4 x) { return _simd_sinpi_d4(x); @@ -3162,7 +3588,7 @@ static inline SIMD_CFUNC simd_double4 __tg_sinpi(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_sinpi_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_sinpi(simd_double8 x) { return _simd_sinpi_d8(x); @@ -3195,7 +3621,7 @@ static inline SIMD_CFUNC simd_float4 __tg_tanpi(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_tanpi_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_tanpi(simd_float8 x) { return _simd_tanpi_f8(x); @@ -3206,7 +3632,7 @@ static inline SIMD_CFUNC simd_float8 __tg_tanpi(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_tanpi_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_tanpi(simd_float16 x) { return _simd_tanpi_f16(x); @@ -3232,7 +3658,7 @@ static inline SIMD_CFUNC simd_double3 __tg_tanpi(simd_double3 x) { return simd_make_double3(__tg_tanpi(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_tanpi_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_tanpi(simd_double4 x) { return _simd_tanpi_d4(x); @@ -3243,7 +3669,7 @@ static inline SIMD_CFUNC simd_double4 __tg_tanpi(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_tanpi_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_tanpi(simd_double8 x) { return _simd_tanpi_d8(x); @@ -3275,7 +3701,7 @@ static inline SIMD_CFUNC simd_float4 __tg_acosh(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_acosh_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_acosh(simd_float8 x) { return _simd_acosh_f8(x); @@ -3286,7 +3712,7 @@ static inline SIMD_CFUNC simd_float8 __tg_acosh(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_acosh_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_acosh(simd_float16 x) { return _simd_acosh_f16(x); @@ -3312,7 +3738,7 @@ static inline SIMD_CFUNC simd_double3 __tg_acosh(simd_double3 x) { return simd_make_double3(__tg_acosh(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_acosh_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_acosh(simd_double4 x) { return _simd_acosh_d4(x); @@ -3323,7 +3749,7 @@ static inline SIMD_CFUNC simd_double4 __tg_acosh(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_acosh_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_acosh(simd_double8 x) { return _simd_acosh_d8(x); @@ -3354,7 +3780,7 @@ static inline SIMD_CFUNC simd_float4 __tg_asinh(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_asinh_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_asinh(simd_float8 x) { return _simd_asinh_f8(x); @@ -3365,7 +3791,7 @@ static inline SIMD_CFUNC simd_float8 __tg_asinh(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_asinh_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_asinh(simd_float16 x) { return _simd_asinh_f16(x); @@ -3391,7 +3817,7 @@ static inline SIMD_CFUNC simd_double3 __tg_asinh(simd_double3 x) { return simd_make_double3(__tg_asinh(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_asinh_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_asinh(simd_double4 x) { return _simd_asinh_d4(x); @@ -3402,7 +3828,7 @@ static inline SIMD_CFUNC simd_double4 __tg_asinh(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_asinh_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_asinh(simd_double8 x) { return _simd_asinh_d8(x); @@ -3433,7 +3859,7 @@ static inline SIMD_CFUNC simd_float4 __tg_atanh(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_atanh_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_atanh(simd_float8 x) { return _simd_atanh_f8(x); @@ -3444,7 +3870,7 @@ static inline SIMD_CFUNC simd_float8 __tg_atanh(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_atanh_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_atanh(simd_float16 x) { return _simd_atanh_f16(x); @@ -3470,7 +3896,7 @@ static inline SIMD_CFUNC simd_double3 __tg_atanh(simd_double3 x) { return simd_make_double3(__tg_atanh(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_atanh_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_atanh(simd_double4 x) { return _simd_atanh_d4(x); @@ -3481,7 +3907,7 @@ static inline SIMD_CFUNC simd_double4 __tg_atanh(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_atanh_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_atanh(simd_double8 x) { return _simd_atanh_d8(x); @@ -3512,7 +3938,7 @@ static inline SIMD_CFUNC simd_float4 __tg_cosh(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_cosh_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_cosh(simd_float8 x) { return _simd_cosh_f8(x); @@ -3523,7 +3949,7 @@ static inline SIMD_CFUNC simd_float8 __tg_cosh(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_cosh_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_cosh(simd_float16 x) { return _simd_cosh_f16(x); @@ -3549,7 +3975,7 @@ static inline SIMD_CFUNC simd_double3 __tg_cosh(simd_double3 x) { return simd_make_double3(__tg_cosh(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_cosh_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_cosh(simd_double4 x) { return _simd_cosh_d4(x); @@ -3560,7 +3986,7 @@ static inline SIMD_CFUNC simd_double4 __tg_cosh(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_cosh_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_cosh(simd_double8 x) { return _simd_cosh_d8(x); @@ -3591,7 +4017,7 @@ static inline SIMD_CFUNC simd_float4 __tg_sinh(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_sinh_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_sinh(simd_float8 x) { return _simd_sinh_f8(x); @@ -3602,7 +4028,7 @@ static inline SIMD_CFUNC simd_float8 __tg_sinh(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_sinh_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_sinh(simd_float16 x) { return _simd_sinh_f16(x); @@ -3628,7 +4054,7 @@ static inline SIMD_CFUNC simd_double3 __tg_sinh(simd_double3 x) { return simd_make_double3(__tg_sinh(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_sinh_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_sinh(simd_double4 x) { return _simd_sinh_d4(x); @@ -3639,7 +4065,7 @@ static inline SIMD_CFUNC simd_double4 __tg_sinh(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_sinh_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_sinh(simd_double8 x) { return _simd_sinh_d8(x); @@ -3670,7 +4096,7 @@ static inline SIMD_CFUNC simd_float4 __tg_tanh(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_tanh_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_tanh(simd_float8 x) { return _simd_tanh_f8(x); @@ -3681,7 +4107,7 @@ static inline SIMD_CFUNC simd_float8 __tg_tanh(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_tanh_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_tanh(simd_float16 x) { return _simd_tanh_f16(x); @@ -3707,7 +4133,7 @@ static inline SIMD_CFUNC simd_double3 __tg_tanh(simd_double3 x) { return simd_make_double3(__tg_tanh(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_tanh_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_tanh(simd_double4 x) { return _simd_tanh_d4(x); @@ -3718,7 +4144,7 @@ static inline SIMD_CFUNC simd_double4 __tg_tanh(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_tanh_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_tanh(simd_double8 x) { return _simd_tanh_d8(x); @@ -3749,7 +4175,7 @@ static inline SIMD_CFUNC simd_float4 __tg_exp(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_exp_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_exp(simd_float8 x) { return _simd_exp_f8(x); @@ -3760,7 +4186,7 @@ static inline SIMD_CFUNC simd_float8 __tg_exp(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_exp_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_exp(simd_float16 x) { return _simd_exp_f16(x); @@ -3786,7 +4212,7 @@ static inline SIMD_CFUNC simd_double3 __tg_exp(simd_double3 x) { return simd_make_double3(__tg_exp(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_exp_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_exp(simd_double4 x) { return _simd_exp_d4(x); @@ -3797,7 +4223,7 @@ static inline SIMD_CFUNC simd_double4 __tg_exp(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_exp_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_exp(simd_double8 x) { return _simd_exp_d8(x); @@ -3828,7 +4254,7 @@ static inline SIMD_CFUNC simd_float4 __tg_exp2(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_exp2_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_exp2(simd_float8 x) { return _simd_exp2_f8(x); @@ -3839,7 +4265,7 @@ static inline SIMD_CFUNC simd_float8 __tg_exp2(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_exp2_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_exp2(simd_float16 x) { return _simd_exp2_f16(x); @@ -3865,7 +4291,7 @@ static inline SIMD_CFUNC simd_double3 __tg_exp2(simd_double3 x) { return simd_make_double3(__tg_exp2(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_exp2_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_exp2(simd_double4 x) { return _simd_exp2_d4(x); @@ -3876,7 +4302,7 @@ static inline SIMD_CFUNC simd_double4 __tg_exp2(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_exp2_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_exp2(simd_double8 x) { return _simd_exp2_d8(x); @@ -3908,7 +4334,7 @@ static inline SIMD_CFUNC simd_float4 __tg_exp10(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_exp10_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_exp10(simd_float8 x) { return _simd_exp10_f8(x); @@ -3919,7 +4345,7 @@ static inline SIMD_CFUNC simd_float8 __tg_exp10(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_exp10_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_exp10(simd_float16 x) { return _simd_exp10_f16(x); @@ -3945,7 +4371,7 @@ static inline SIMD_CFUNC simd_double3 __tg_exp10(simd_double3 x) { return simd_make_double3(__tg_exp10(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_exp10_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_exp10(simd_double4 x) { return _simd_exp10_d4(x); @@ -3956,7 +4382,7 @@ static inline SIMD_CFUNC simd_double4 __tg_exp10(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_exp10_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_exp10(simd_double8 x) { return _simd_exp10_d8(x); @@ -3988,7 +4414,7 @@ static inline SIMD_CFUNC simd_float4 __tg_expm1(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_expm1_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_expm1(simd_float8 x) { return _simd_expm1_f8(x); @@ -3999,7 +4425,7 @@ static inline SIMD_CFUNC simd_float8 __tg_expm1(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_expm1_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_expm1(simd_float16 x) { return _simd_expm1_f16(x); @@ -4025,7 +4451,7 @@ static inline SIMD_CFUNC simd_double3 __tg_expm1(simd_double3 x) { return simd_make_double3(__tg_expm1(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_expm1_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_expm1(simd_double4 x) { return _simd_expm1_d4(x); @@ -4036,7 +4462,7 @@ static inline SIMD_CFUNC simd_double4 __tg_expm1(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_expm1_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_expm1(simd_double8 x) { return _simd_expm1_d8(x); @@ -4067,7 +4493,7 @@ static inline SIMD_CFUNC simd_float4 __tg_log(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_log_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_log(simd_float8 x) { return _simd_log_f8(x); @@ -4078,7 +4504,7 @@ static inline SIMD_CFUNC simd_float8 __tg_log(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_log_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_log(simd_float16 x) { return _simd_log_f16(x); @@ -4104,7 +4530,7 @@ static inline SIMD_CFUNC simd_double3 __tg_log(simd_double3 x) { return simd_make_double3(__tg_log(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_log_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_log(simd_double4 x) { return _simd_log_d4(x); @@ -4115,7 +4541,7 @@ static inline SIMD_CFUNC simd_double4 __tg_log(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_log_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_log(simd_double8 x) { return _simd_log_d8(x); @@ -4146,7 +4572,7 @@ static inline SIMD_CFUNC simd_float4 __tg_log2(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_log2_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_log2(simd_float8 x) { return _simd_log2_f8(x); @@ -4157,7 +4583,7 @@ static inline SIMD_CFUNC simd_float8 __tg_log2(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_log2_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_log2(simd_float16 x) { return _simd_log2_f16(x); @@ -4183,7 +4609,7 @@ static inline SIMD_CFUNC simd_double3 __tg_log2(simd_double3 x) { return simd_make_double3(__tg_log2(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_log2_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_log2(simd_double4 x) { return _simd_log2_d4(x); @@ -4194,7 +4620,7 @@ static inline SIMD_CFUNC simd_double4 __tg_log2(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_log2_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_log2(simd_double8 x) { return _simd_log2_d8(x); @@ -4225,7 +4651,7 @@ static inline SIMD_CFUNC simd_float4 __tg_log10(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_log10_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_log10(simd_float8 x) { return _simd_log10_f8(x); @@ -4236,7 +4662,7 @@ static inline SIMD_CFUNC simd_float8 __tg_log10(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_log10_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_log10(simd_float16 x) { return _simd_log10_f16(x); @@ -4262,7 +4688,7 @@ static inline SIMD_CFUNC simd_double3 __tg_log10(simd_double3 x) { return simd_make_double3(__tg_log10(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_log10_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_log10(simd_double4 x) { return _simd_log10_d4(x); @@ -4273,7 +4699,7 @@ static inline SIMD_CFUNC simd_double4 __tg_log10(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_log10_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_log10(simd_double8 x) { return _simd_log10_d8(x); @@ -4304,7 +4730,7 @@ static inline SIMD_CFUNC simd_float4 __tg_log1p(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_log1p_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_log1p(simd_float8 x) { return _simd_log1p_f8(x); @@ -4315,7 +4741,7 @@ static inline SIMD_CFUNC simd_float8 __tg_log1p(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_log1p_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_log1p(simd_float16 x) { return _simd_log1p_f16(x); @@ -4341,7 +4767,7 @@ static inline SIMD_CFUNC simd_double3 __tg_log1p(simd_double3 x) { return simd_make_double3(__tg_log1p(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_log1p_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_log1p(simd_double4 x) { return _simd_log1p_d4(x); @@ -4352,7 +4778,7 @@ static inline SIMD_CFUNC simd_double4 __tg_log1p(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_log1p_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_log1p(simd_double8 x) { return _simd_log1p_d8(x); @@ -4383,7 +4809,7 @@ static inline SIMD_CFUNC simd_float4 __tg_cbrt(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_cbrt_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_cbrt(simd_float8 x) { return _simd_cbrt_f8(x); @@ -4394,7 +4820,7 @@ static inline SIMD_CFUNC simd_float8 __tg_cbrt(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_cbrt_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_cbrt(simd_float16 x) { return _simd_cbrt_f16(x); @@ -4420,7 +4846,7 @@ static inline SIMD_CFUNC simd_double3 __tg_cbrt(simd_double3 x) { return simd_make_double3(__tg_cbrt(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_cbrt_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_cbrt(simd_double4 x) { return _simd_cbrt_d4(x); @@ -4431,7 +4857,7 @@ static inline SIMD_CFUNC simd_double4 __tg_cbrt(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_cbrt_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_cbrt(simd_double8 x) { return _simd_cbrt_d8(x); @@ -4462,7 +4888,7 @@ static inline SIMD_CFUNC simd_float4 __tg_erf(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_erf_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_erf(simd_float8 x) { return _simd_erf_f8(x); @@ -4473,7 +4899,7 @@ static inline SIMD_CFUNC simd_float8 __tg_erf(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_erf_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_erf(simd_float16 x) { return _simd_erf_f16(x); @@ -4499,7 +4925,7 @@ static inline SIMD_CFUNC simd_double3 __tg_erf(simd_double3 x) { return simd_make_double3(__tg_erf(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_erf_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_erf(simd_double4 x) { return _simd_erf_d4(x); @@ -4510,7 +4936,7 @@ static inline SIMD_CFUNC simd_double4 __tg_erf(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_erf_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_erf(simd_double8 x) { return _simd_erf_d8(x); @@ -4541,7 +4967,7 @@ static inline SIMD_CFUNC simd_float4 __tg_erfc(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_erfc_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_erfc(simd_float8 x) { return _simd_erfc_f8(x); @@ -4552,7 +4978,7 @@ static inline SIMD_CFUNC simd_float8 __tg_erfc(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_erfc_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_erfc(simd_float16 x) { return _simd_erfc_f16(x); @@ -4578,7 +5004,7 @@ static inline SIMD_CFUNC simd_double3 __tg_erfc(simd_double3 x) { return simd_make_double3(__tg_erfc(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_erfc_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_erfc(simd_double4 x) { return _simd_erfc_d4(x); @@ -4589,7 +5015,7 @@ static inline SIMD_CFUNC simd_double4 __tg_erfc(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_erfc_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_erfc(simd_double8 x) { return _simd_erfc_d8(x); @@ -4620,7 +5046,7 @@ static inline SIMD_CFUNC simd_float4 __tg_tgamma(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_tgamma_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_tgamma(simd_float8 x) { return _simd_tgamma_f8(x); @@ -4631,7 +5057,7 @@ static inline SIMD_CFUNC simd_float8 __tg_tgamma(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_tgamma_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_tgamma(simd_float16 x) { return _simd_tgamma_f16(x); @@ -4657,7 +5083,7 @@ static inline SIMD_CFUNC simd_double3 __tg_tgamma(simd_double3 x) { return simd_make_double3(__tg_tgamma(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_tgamma_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_tgamma(simd_double4 x) { return _simd_tgamma_d4(x); @@ -4668,7 +5094,7 @@ static inline SIMD_CFUNC simd_double4 __tg_tgamma(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_tgamma_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_tgamma(simd_double8 x) { return _simd_tgamma_d8(x); @@ -4703,7 +5129,7 @@ static inline SIMD_CFUNC simd_float4 __tg_round(simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_round_f8(simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_round(simd_float8 x) { return _simd_round_f8(x); @@ -4714,7 +5140,7 @@ static inline SIMD_CFUNC simd_float8 __tg_round(simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_round_f16(simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_round(simd_float16 x) { return _simd_round_f16(x); @@ -4744,7 +5170,7 @@ static inline SIMD_CFUNC simd_double3 __tg_round(simd_double3 x) { return simd_make_double3(__tg_round(simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_round_d4(simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_round(simd_double4 x) { return _simd_round_d4(x); @@ -4755,7 +5181,7 @@ static inline SIMD_CFUNC simd_double4 __tg_round(simd_double4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_round_d8(simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_round(simd_double8 x) { return _simd_round_d8(x); @@ -4786,7 +5212,7 @@ static inline SIMD_CFUNC simd_float4 __tg_atan2(simd_float4 y, simd_float4 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_atan2_f8(simd_float8 y, simd_float8 x); static inline SIMD_CFUNC simd_float8 __tg_atan2(simd_float8 y, simd_float8 x) { return _simd_atan2_f8(y, x); @@ -4797,7 +5223,7 @@ static inline SIMD_CFUNC simd_float8 __tg_atan2(simd_float8 y, simd_float8 x) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_atan2_f16(simd_float16 y, simd_float16 x); static inline SIMD_CFUNC simd_float16 __tg_atan2(simd_float16 y, simd_float16 x) { return _simd_atan2_f16(y, x); @@ -4823,7 +5249,7 @@ static inline SIMD_CFUNC simd_double3 __tg_atan2(simd_double3 y, simd_double3 x) return simd_make_double3(__tg_atan2(simd_make_double4(y), simd_make_double4(x))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_atan2_d4(simd_double4 y, simd_double4 x); static inline SIMD_CFUNC simd_double4 __tg_atan2(simd_double4 y, simd_double4 x) { return _simd_atan2_d4(y, x); @@ -4834,7 +5260,7 @@ static inline SIMD_CFUNC simd_double4 __tg_atan2(simd_double4 y, simd_double4 x) } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_atan2_d8(simd_double8 y, simd_double8 x); static inline SIMD_CFUNC simd_double8 __tg_atan2(simd_double8 y, simd_double8 x) { return _simd_atan2_d8(y, x); @@ -4865,7 +5291,7 @@ static inline SIMD_CFUNC simd_float4 __tg_hypot(simd_float4 x, simd_float4 y) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_hypot_f8(simd_float8 x, simd_float8 y); static inline SIMD_CFUNC simd_float8 __tg_hypot(simd_float8 x, simd_float8 y) { return _simd_hypot_f8(x, y); @@ -4876,7 +5302,7 @@ static inline SIMD_CFUNC simd_float8 __tg_hypot(simd_float8 x, simd_float8 y) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_hypot_f16(simd_float16 x, simd_float16 y); static inline SIMD_CFUNC simd_float16 __tg_hypot(simd_float16 x, simd_float16 y) { return _simd_hypot_f16(x, y); @@ -4902,7 +5328,7 @@ static inline SIMD_CFUNC simd_double3 __tg_hypot(simd_double3 x, simd_double3 y) return simd_make_double3(__tg_hypot(simd_make_double4(x), simd_make_double4(y))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_hypot_d4(simd_double4 x, simd_double4 y); static inline SIMD_CFUNC simd_double4 __tg_hypot(simd_double4 x, simd_double4 y) { return _simd_hypot_d4(x, y); @@ -4913,7 +5339,7 @@ static inline SIMD_CFUNC simd_double4 __tg_hypot(simd_double4 x, simd_double4 y) } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_hypot_d8(simd_double8 x, simd_double8 y); static inline SIMD_CFUNC simd_double8 __tg_hypot(simd_double8 x, simd_double8 y) { return _simd_hypot_d8(x, y); @@ -4944,7 +5370,7 @@ static inline SIMD_CFUNC simd_float4 __tg_pow(simd_float4 x, simd_float4 y) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_pow_f8(simd_float8 x, simd_float8 y); static inline SIMD_CFUNC simd_float8 __tg_pow(simd_float8 x, simd_float8 y) { return _simd_pow_f8(x, y); @@ -4955,7 +5381,7 @@ static inline SIMD_CFUNC simd_float8 __tg_pow(simd_float8 x, simd_float8 y) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_pow_f16(simd_float16 x, simd_float16 y); static inline SIMD_CFUNC simd_float16 __tg_pow(simd_float16 x, simd_float16 y) { return _simd_pow_f16(x, y); @@ -4981,7 +5407,7 @@ static inline SIMD_CFUNC simd_double3 __tg_pow(simd_double3 x, simd_double3 y) { return simd_make_double3(__tg_pow(simd_make_double4(x), simd_make_double4(y))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_pow_d4(simd_double4 x, simd_double4 y); static inline SIMD_CFUNC simd_double4 __tg_pow(simd_double4 x, simd_double4 y) { return _simd_pow_d4(x, y); @@ -4992,7 +5418,7 @@ static inline SIMD_CFUNC simd_double4 __tg_pow(simd_double4 x, simd_double4 y) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_pow_d8(simd_double8 x, simd_double8 y); static inline SIMD_CFUNC simd_double8 __tg_pow(simd_double8 x, simd_double8 y) { return _simd_pow_d8(x, y); @@ -5023,7 +5449,7 @@ static inline SIMD_CFUNC simd_float4 __tg_fmod(simd_float4 x, simd_float4 y) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_fmod_f8(simd_float8 x, simd_float8 y); static inline SIMD_CFUNC simd_float8 __tg_fmod(simd_float8 x, simd_float8 y) { return _simd_fmod_f8(x, y); @@ -5034,7 +5460,7 @@ static inline SIMD_CFUNC simd_float8 __tg_fmod(simd_float8 x, simd_float8 y) { } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_fmod_f16(simd_float16 x, simd_float16 y); static inline SIMD_CFUNC simd_float16 __tg_fmod(simd_float16 x, simd_float16 y) { return _simd_fmod_f16(x, y); @@ -5060,7 +5486,7 @@ static inline SIMD_CFUNC simd_double3 __tg_fmod(simd_double3 x, simd_double3 y) return simd_make_double3(__tg_fmod(simd_make_double4(x), simd_make_double4(y))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_fmod_d4(simd_double4 x, simd_double4 y); static inline SIMD_CFUNC simd_double4 __tg_fmod(simd_double4 x, simd_double4 y) { return _simd_fmod_d4(x, y); @@ -5071,7 +5497,7 @@ static inline SIMD_CFUNC simd_double4 __tg_fmod(simd_double4 x, simd_double4 y) } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_fmod_d8(simd_double8 x, simd_double8 y); static inline SIMD_CFUNC simd_double8 __tg_fmod(simd_double8 x, simd_double8 y) { return _simd_fmod_d8(x, y); @@ -5102,7 +5528,7 @@ static inline SIMD_CFUNC simd_float4 __tg_remainder(simd_float4 x, simd_float4 y } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_remainder_f8(simd_float8 x, simd_float8 y); static inline SIMD_CFUNC simd_float8 __tg_remainder(simd_float8 x, simd_float8 y) { return _simd_remainder_f8(x, y); @@ -5113,7 +5539,7 @@ static inline SIMD_CFUNC simd_float8 __tg_remainder(simd_float8 x, simd_float8 y } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_remainder_f16(simd_float16 x, simd_float16 y); static inline SIMD_CFUNC simd_float16 __tg_remainder(simd_float16 x, simd_float16 y) { return _simd_remainder_f16(x, y); @@ -5139,7 +5565,7 @@ static inline SIMD_CFUNC simd_double3 __tg_remainder(simd_double3 x, simd_double return simd_make_double3(__tg_remainder(simd_make_double4(x), simd_make_double4(y))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_remainder_d4(simd_double4 x, simd_double4 y); static inline SIMD_CFUNC simd_double4 __tg_remainder(simd_double4 x, simd_double4 y) { return _simd_remainder_d4(x, y); @@ -5150,7 +5576,7 @@ static inline SIMD_CFUNC simd_double4 __tg_remainder(simd_double4 x, simd_double } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_remainder_d8(simd_double8 x, simd_double8 y); static inline SIMD_CFUNC simd_double8 __tg_remainder(simd_double8 x, simd_double8 y) { return _simd_remainder_d8(x, y); @@ -5181,7 +5607,7 @@ static inline SIMD_CFUNC simd_float4 __tg_nextafter(simd_float4 x, simd_float4 y } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_float8 _simd_nextafter_f8(simd_float8 x, simd_float8 y); static inline SIMD_CFUNC simd_float8 __tg_nextafter(simd_float8 x, simd_float8 y) { return _simd_nextafter_f8(x, y); @@ -5192,7 +5618,7 @@ static inline SIMD_CFUNC simd_float8 __tg_nextafter(simd_float8 x, simd_float8 y } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_float16 _simd_nextafter_f16(simd_float16 x, simd_float16 y); static inline SIMD_CFUNC simd_float16 __tg_nextafter(simd_float16 x, simd_float16 y) { return _simd_nextafter_f16(x, y); @@ -5218,7 +5644,7 @@ static inline SIMD_CFUNC simd_double3 __tg_nextafter(simd_double3 x, simd_double return simd_make_double3(__tg_nextafter(simd_make_double4(x), simd_make_double4(y))); } -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX2__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX2__ extern simd_double4 _simd_nextafter_d4(simd_double4 x, simd_double4 y); static inline SIMD_CFUNC simd_double4 __tg_nextafter(simd_double4 x, simd_double4 y) { return _simd_nextafter_d4(x, y); @@ -5229,7 +5655,7 @@ static inline SIMD_CFUNC simd_double4 __tg_nextafter(simd_double4 x, simd_double } #endif -#if SIMD_LIBRARY_VERSION >= 3 && defined __AVX512F__ +#if SIMD_LIBRARY_VERSION >= 3 && defined __x86_64__ && defined __AVX512F__ extern simd_double8 _simd_nextafter_d8(simd_double8 x, simd_double8 y); static inline SIMD_CFUNC simd_double8 __tg_nextafter(simd_double8 x, simd_double8 y) { return _simd_nextafter_d8(x, y); @@ -5240,6 +5666,197 @@ static inline SIMD_CFUNC simd_double8 __tg_nextafter(simd_double8 x, simd_double } #endif +#if SIMD_LIBRARY_VERSION >= 5 +#pragma mark - sincos implementation +static inline SIMD_NONCONST void __tg_sincos(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp) { + simd_float4 sin_val; + simd_float4 cos_val; + __tg_sincos(simd_make_float4(x), &sin_val, &cos_val); + *sinp = simd_make_float2(sin_val); + *cosp = simd_make_float2(cos_val); +} + +static inline SIMD_NONCONST void __tg_sincos(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp) { + simd_float4 sin_val; + simd_float4 cos_val; + __tg_sincos(simd_make_float4(x), &sin_val, &cos_val); + *sinp = simd_make_float3(sin_val); + *cosp = simd_make_float3(cos_val); +} + +extern void _simd_sincos_f4(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp); +static inline SIMD_NONCONST void __tg_sincos(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp) { + return _simd_sincos_f4(x, sinp, cosp); +} + +static inline SIMD_NONCONST void __tg_sincos(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp) { + __tg_sincos(x.lo, (simd_float4 *)sinp+0, (simd_float4 *)cosp+0); + __tg_sincos(x.hi, (simd_float4 *)sinp+1, (simd_float4 *)cosp+1); +} + +static inline SIMD_NONCONST void __tg_sincos(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp) { + __tg_sincos(x.lo, (simd_float8 *)sinp+0, (simd_float8 *)cosp+0); + __tg_sincos(x.hi, (simd_float8 *)sinp+1, (simd_float8 *)cosp+1); +} + +extern void _simd_sincos_d2(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp); +static inline SIMD_NONCONST void __tg_sincos(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp) { + return _simd_sincos_d2(x, sinp, cosp); +} + +static inline SIMD_NONCONST void __tg_sincos(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp) { + simd_double4 sin_val; + simd_double4 cos_val; + __tg_sincos(simd_make_double4(x), &sin_val, &cos_val); + *sinp = simd_make_double3(sin_val); + *cosp = simd_make_double3(cos_val); +} + +static inline SIMD_NONCONST void __tg_sincos(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp) { + __tg_sincos(x.lo, (simd_double2 *)sinp+0, (simd_double2 *)cosp+0); + __tg_sincos(x.hi, (simd_double2 *)sinp+1, (simd_double2 *)cosp+1); +} + +static inline SIMD_NONCONST void __tg_sincos(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp) { + __tg_sincos(x.lo, (simd_double4 *)sinp+0, (simd_double4 *)cosp+0); + __tg_sincos(x.hi, (simd_double4 *)sinp+1, (simd_double4 *)cosp+1); +} + +#pragma mark - sincospi implementation +static inline SIMD_NONCONST void __tg_sincospi(simd_float2 x, simd_float2 *sinp, simd_float2 *cosp) { + simd_float4 sin_val; + simd_float4 cos_val; + __tg_sincospi(simd_make_float4(x), &sin_val, &cos_val); + *sinp = simd_make_float2(sin_val); + *cosp = simd_make_float2(cos_val); +} + +static inline SIMD_NONCONST void __tg_sincospi(simd_float3 x, simd_float3 *sinp, simd_float3 *cosp) { + simd_float4 sin_val; + simd_float4 cos_val; + __tg_sincospi(simd_make_float4(x), &sin_val, &cos_val); + *sinp = simd_make_float3(sin_val); + *cosp = simd_make_float3(cos_val); +} + +extern void _simd_sincospi_f4(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp); +static inline SIMD_NONCONST void __tg_sincospi(simd_float4 x, simd_float4 *sinp, simd_float4 *cosp) { + return _simd_sincospi_f4(x, sinp, cosp); +} + +static inline SIMD_NONCONST void __tg_sincospi(simd_float8 x, simd_float8 *sinp, simd_float8 *cosp) { + __tg_sincospi(x.lo, (simd_float4 *)sinp+0, (simd_float4 *)cosp+0); + __tg_sincospi(x.hi, (simd_float4 *)sinp+1, (simd_float4 *)cosp+1); +} + +static inline SIMD_NONCONST void __tg_sincospi(simd_float16 x, simd_float16 *sinp, simd_float16 *cosp) { + __tg_sincospi(x.lo, (simd_float8 *)sinp+0, (simd_float8 *)cosp+0); + __tg_sincospi(x.hi, (simd_float8 *)sinp+1, (simd_float8 *)cosp+1); +} + +extern void _simd_sincospi_d2(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp); +static inline SIMD_NONCONST void __tg_sincospi(simd_double2 x, simd_double2 *sinp, simd_double2 *cosp) { + return _simd_sincospi_d2(x, sinp, cosp); +} + +static inline SIMD_NONCONST void __tg_sincospi(simd_double3 x, simd_double3 *sinp, simd_double3 *cosp) { + simd_double4 sin_val; + simd_double4 cos_val; + __tg_sincospi(simd_make_double4(x), &sin_val, &cos_val); + *sinp = simd_make_double3(sin_val); + *cosp = simd_make_double3(cos_val); +} + +static inline SIMD_NONCONST void __tg_sincospi(simd_double4 x, simd_double4 *sinp, simd_double4 *cosp) { + __tg_sincospi(x.lo, (simd_double2 *)sinp+0, (simd_double2 *)cosp+0); + __tg_sincospi(x.hi, (simd_double2 *)sinp+1, (simd_double2 *)cosp+1); +} + +static inline SIMD_NONCONST void __tg_sincospi(simd_double8 x, simd_double8 *sinp, simd_double8 *cosp) { + __tg_sincospi(x.lo, (simd_double4 *)sinp+0, (simd_double4 *)cosp+0); + __tg_sincospi(x.hi, (simd_double4 *)sinp+1, (simd_double4 *)cosp+1); +} + +#endif // SIMD_LIBRARY_VERSION >= 5 +#pragma mark - lgamma implementation +static inline SIMD_CFUNC simd_float2 __tg_lgamma(simd_float2 x) { + return simd_make_float2(__tg_lgamma(simd_make_float4(x))); +} + +static inline SIMD_CFUNC simd_float3 __tg_lgamma(simd_float3 x) { + return simd_make_float3(__tg_lgamma(simd_make_float4(x))); +} + +#if SIMD_LIBRARY_VERSION >= 4 +extern simd_float4 _simd_lgamma_f4(simd_float4 x); +static inline SIMD_CFUNC simd_float4 __tg_lgamma(simd_float4 x) { + return _simd_lgamma_f4(x); +} +#else +static inline SIMD_CFUNC simd_float4 __tg_lgamma(simd_float4 x) { + return simd_make_float4(lgamma(x.x), lgamma(x.y), lgamma(x.z), lgamma(x.w)); +} +#endif + +#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX2__ +extern simd_float8 _simd_lgamma_f8(simd_float8 x); +static inline SIMD_CFUNC simd_float8 __tg_lgamma(simd_float8 x) { + return _simd_lgamma_f8(x); +} +#else +static inline SIMD_CFUNC simd_float8 __tg_lgamma(simd_float8 x) { + return simd_make_float8(__tg_lgamma(x.lo), __tg_lgamma(x.hi)); +} +#endif + +#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX512F__ +extern simd_float16 _simd_lgamma_f16(simd_float16 x); +static inline SIMD_CFUNC simd_float16 __tg_lgamma(simd_float16 x) { + return _simd_lgamma_f16(x); +} +#else +static inline SIMD_CFUNC simd_float16 __tg_lgamma(simd_float16 x) { + return simd_make_float16(__tg_lgamma(x.lo), __tg_lgamma(x.hi)); +} +#endif + +#if SIMD_LIBRARY_VERSION >= 4 +extern simd_double2 _simd_lgamma_d2(simd_double2 x); +static inline SIMD_CFUNC simd_double2 __tg_lgamma(simd_double2 x) { + return _simd_lgamma_d2(x); +} +#else +static inline SIMD_CFUNC simd_double2 __tg_lgamma(simd_double2 x) { + return simd_make_double2(lgamma(x.x), lgamma(x.y)); +} +#endif + +static inline SIMD_CFUNC simd_double3 __tg_lgamma(simd_double3 x) { + return simd_make_double3(__tg_lgamma(simd_make_double4(x))); +} + +#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX2__ +extern simd_double4 _simd_lgamma_d4(simd_double4 x); +static inline SIMD_CFUNC simd_double4 __tg_lgamma(simd_double4 x) { + return _simd_lgamma_d4(x); +} +#else +static inline SIMD_CFUNC simd_double4 __tg_lgamma(simd_double4 x) { + return simd_make_double4(__tg_lgamma(x.lo), __tg_lgamma(x.hi)); +} +#endif + +#if SIMD_LIBRARY_VERSION >= 4 && defined __x86_64__ && defined __AVX512F__ +extern simd_double8 _simd_lgamma_d8(simd_double8 x); +static inline SIMD_CFUNC simd_double8 __tg_lgamma(simd_double8 x) { + return _simd_lgamma_d8(x); +} +#else +static inline SIMD_CFUNC simd_double8 __tg_lgamma(simd_double8 x) { + return simd_make_double8(__tg_lgamma(x.lo), __tg_lgamma(x.hi)); +} +#endif + static inline SIMD_CFUNC simd_float2 __tg_fdim(simd_float2 x, simd_float2 y) { return simd_bitselect(x-y, 0, x= 199209L __BEGIN_DECLS -int pclose(FILE *) __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable."); +int pclose(FILE *) __swift_unavailable("Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)"); #if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE) -FILE *popen(const char *, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(popen)) __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable."); +FILE *popen(const char *, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(popen)) __swift_unavailable("Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)"); #else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */ -FILE *popen(const char *, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(popen)) __swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable."); +FILE *popen(const char *, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(popen)) __swift_unavailable("Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)"); #endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */ __END_DECLS #endif /* __DARWIN_C_LEVEL >= 199209L */ -#undef __swift_unavailable_on - /* Additional functionality provided by: * POSIX.1c-1995, * POSIX.1i-1995, @@ -370,12 +380,11 @@ extern __const char *__const sys_errlist[]; int asprintf(char ** __restrict, const char * __restrict, ...) __printflike(2, 3); char *ctermid_r(char *); char *fgetln(FILE *, size_t *); -__const char *fmtcheck(const char *, const char *); +__const char *fmtcheck(const char *, const char *) __attribute__((format_arg(2))); int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char ** __restrict, const char * __restrict, va_list) __printflike(2, 0); -FILE *zopen(const char *, const char *, int); /* diff --git a/lib/libc/include/x86_64-macos.10-none/stdlib.h b/lib/libc/include/any-macos.13-any/stdlib.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/stdlib.h rename to lib/libc/include/any-macos.13-any/stdlib.h index a5b61930fd..24eab305a4 100644 --- a/lib/libc/include/x86_64-macos.10-none/stdlib.h +++ b/lib/libc/include/any-macos.13-any/stdlib.h @@ -178,18 +178,11 @@ unsigned long long strtoull(const char *__str, char **__endptr, int __base); #endif /* !__DARWIN_NO_LONG_LONG */ -#if TARGET_OS_EMBEDDED -#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg) -#else -#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg) -#endif - -__swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable") +__swift_unavailable("Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)") __API_AVAILABLE(macos(10.0)) __IOS_PROHIBITED __WATCHOS_PROHIBITED __TVOS_PROHIBITED int system(const char *) __DARWIN_ALIAS_C(system); -#undef __swift_unavailable_on size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); int wctomb(char *, wchar_t); @@ -213,6 +206,9 @@ long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void) __swift_unavailable("Use arc4random instead."); +#if !defined(_POSIX_C_SOURCE) +__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of mktemp(3), it is highly recommended that you use mkstemp(3) instead.") +#endif char *mktemp(char *); int mkstemp(char *); long mrand48(void) __swift_unavailable("Use arc4random instead."); @@ -273,8 +269,17 @@ uint32_t arc4random_uniform(uint32_t __upper_bound) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); #ifdef __BLOCKS__ int atexit_b(void (^ _Nonnull)(void)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); + +#ifdef __BLOCKS__ +#if __has_attribute(noescape) +#define __bsearch_noescape __attribute__((__noescape__)) +#else +#define __bsearch_noescape +#endif +#endif /* __BLOCKS__ */ void *bsearch_b(const void *__key, const void *__base, size_t __nel, - size_t __width, int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); + size_t __width, int (^ _Nonnull __compar)(const void *, const void *) __bsearch_noescape) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); #endif /* __BLOCKS__ */ /* getcap(3) functions */ @@ -347,6 +352,9 @@ int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__ void sranddev(void); void srandomdev(void); void *reallocf(void *__ptr, size_t __size) __alloc_size(2); +long long + strtonum(const char *__numstr, long long __minval, long long __maxval, const char **__errstrp) + __API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)); #if !__DARWIN_NO_LONG_LONG long long strtoq(const char *__str, char **__endptr, int __base); diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_symbol_aliasing.h b/lib/libc/include/any-macos.13-any/sys/_symbol_aliasing.h similarity index 78% rename from lib/libc/include/x86_64-macos.10-none/sys/_symbol_aliasing.h rename to lib/libc/include/any-macos.13-any/sys/_symbol_aliasing.h index 17b4d6fe37..6d0429add1 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/_symbol_aliasing.h +++ b/lib/libc/include/any-macos.13-any/sys/_symbol_aliasing.h @@ -305,6 +305,84 @@ #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_6(x) #endif +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130700 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_7(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_13_7(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140000 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_0(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140100 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_1(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140200 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_2(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_2(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140300 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_3(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 140500 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_5(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_14_5(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150000 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_0(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150100 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_1(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150200 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_2(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_2(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150300 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_3(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_3(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150400 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_4(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_4(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160000 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_0(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160100 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_1(x) +#endif + #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1000 #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) x #else @@ -495,4 +573,64 @@ #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15_1(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15_1(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101504 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15_4(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_15_4(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101600 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_16(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_16(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110000 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_0(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110100 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_1(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 110300 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_3(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_11_3(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120000 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_0(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120100 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_1(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120200 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_2(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_2(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120300 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_3(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_3(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130000 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_0(x) #endif \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/sys/_types/_graftdmg_un.h b/lib/libc/include/any-macos.13-any/sys/_types/_graftdmg_un.h new file mode 100644 index 0000000000..12282c994b --- /dev/null +++ b/lib/libc/include/any-macos.13-any/sys/_types/_graftdmg_un.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2021-22 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +#ifndef _GRAFTDMG_UN_ +#define _GRAFTDMG_UN_ + +#include +#include +#include + +#define GRAFTDMG_SECURE_BOOT_CRYPTEX_ARGS_VERSION 1 +#define MAX_GRAFT_ARGS_SIZE 512 + +/* Flag values for secure_boot_cryptex_args.sbc_flags */ +#define SBC_PRESERVE_MOUNT 0x0001 /* Preserve underlying mount until shutdown */ +#define SBC_ALTERNATE_SHARED_REGION 0x0002 /* Binaries within should use alternate shared region */ +#define SBC_SYSTEM_CONTENT 0x0004 /* Cryptex contains system content */ +#define SBC_PANIC_ON_AUTHFAIL 0x0008 /* On failure to authenticate, panic */ +#define SBC_STRICT_AUTH 0x0010 /* Strict authentication mode */ +#define SBC_PRESERVE_GRAFT 0x0020 /* Preserve graft itself until unmount */ + +typedef struct secure_boot_cryptex_args { + u_int32_t sbc_version; + u_int32_t sbc_4cc; + int sbc_authentic_manifest_fd; + int sbc_user_manifest_fd; + int sbc_payload_fd; + u_int64_t sbc_flags; +} __attribute__((aligned(4), packed)) secure_boot_cryptex_args_t; + +typedef union graft_args { + u_int8_t max_size[MAX_GRAFT_ARGS_SIZE]; + secure_boot_cryptex_args_t sbc_args; +} graftdmg_args_un; + +#endif /* _GRAFTDMG_UN_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/cdefs.h b/lib/libc/include/any-macos.13-any/sys/cdefs.h similarity index 86% rename from lib/libc/include/x86_64-macos.10-none/sys/cdefs.h rename to lib/libc/include/any-macos.13-any/sys/cdefs.h index b2b091e28e..40afbe5424 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/cdefs.h +++ b/lib/libc/include/any-macos.13-any/sys/cdefs.h @@ -152,8 +152,16 @@ #endif /* !NO_ANSI_KEYWORDS */ #endif /* !(__STDC__ || __cplusplus) */ +/* + * __pure2 can be used for functions that are only a function of their scalar + * arguments (meaning they can't dereference pointers). + * + * __stateful_pure can be used for functions that have no side effects, + * but depend on the state of the memory. + */ #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) +#define __stateful_pure __attribute__((__pure__)) /* __unused denotes variables and functions that may not be used, preventing * the compiler from warning about it if not used. @@ -174,6 +182,22 @@ #define __cold #endif +/* __returns_nonnull marks functions that return a non-null pointer. */ +#if __has_attribute(returns_nonnull) +#define __returns_nonnull __attribute((returns_nonnull)) +#else +#define __returns_nonnull +#endif + +/* __exported denotes symbols that should be exported even when symbols + * are hidden by default. + * __exported_push/_exported_pop are pragmas used to delimit a range of + * symbols that should be exported even when symbols are hidden by default. + */ +#define __exported __attribute__((__visibility__("default"))) +#define __exported_push _Pragma("GCC visibility push(default)") +#define __exported_pop _Pragma("GCC visibility pop") + /* __deprecated causes the compiler to produce a warning when encountering * code using the deprecated functionality. * __deprecated_msg() does the same, and compilers that support it will print @@ -202,9 +226,17 @@ #define __kpi_deprecated(_msg) /* __unavailable causes the compiler to error out when encountering - * code using the tagged function of variable. + * code using the tagged function */ -#define __unavailable __attribute__((__unavailable__)) +#if __has_attribute(unavailable) +#define __unavailable __attribute__((__unavailable__)) +#else +#define __unavailable +#endif + +#define __kpi_unavailable + +#define __kpi_deprecated_arm64_macos_unavailable /* Delete pseudo-keywords wherever they are not available or needed. */ #ifndef __dead @@ -370,11 +402,13 @@ * types. */ #define __printflike(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf__, fmtarg, firstvararg))) + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #define __printf0like(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) + __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #define __scanflike(fmtarg, firstvararg) \ - __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) + __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) +#define __osloglike(fmtarg, firstvararg) \ + __attribute__((__format__ (__os_log__, fmtarg, firstvararg))) #define __IDSTRING(name, string) static const char name[] __used = string @@ -471,9 +505,19 @@ /* These settings are particular to each product. */ /* Platform: MacOSX */ +#if defined(__i386__) #define __DARWIN_ONLY_64_BIT_INO_T 0 -/* #undef __DARWIN_ONLY_UNIX_CONFORMANCE (automatically set for 64-bit) */ +#define __DARWIN_ONLY_UNIX_CONFORMANCE 0 #define __DARWIN_ONLY_VERS_1050 0 +#elif defined(__x86_64__) +#define __DARWIN_ONLY_64_BIT_INO_T 0 +#define __DARWIN_ONLY_UNIX_CONFORMANCE 1 +#define __DARWIN_ONLY_VERS_1050 0 +#else +#define __DARWIN_ONLY_64_BIT_INO_T 1 +#define __DARWIN_ONLY_UNIX_CONFORMANCE 1 +#define __DARWIN_ONLY_VERS_1050 1 +#endif /* * The __DARWIN_ALIAS macros are used to do symbol renaming; they allow @@ -493,14 +537,6 @@ * pre-10.5, and it is the default compilation environment, revert the * compilation environment to pre-__DARWIN_UNIX03. */ -#if !defined(__DARWIN_ONLY_UNIX_CONFORMANCE) -# if defined(__LP64__) -# define __DARWIN_ONLY_UNIX_CONFORMANCE 1 -# else /* !__LP64__ */ -# define __DARWIN_ONLY_UNIX_CONFORMANCE 0 -# endif /* __LP64__ */ -#endif /* !__DARWIN_ONLY_UNIX_CONFORMANCE */ - #if !defined(__DARWIN_UNIX03) # if __DARWIN_ONLY_UNIX_CONFORMANCE # if defined(_NONSTD_SOURCE) @@ -787,7 +823,19 @@ * catastrophic run-time failures. */ #ifndef __CAST_AWAY_QUALIFIER -#define __CAST_AWAY_QUALIFIER(variable, qualifier, type) (type) (long)(variable) +/* + * XXX: this shouldn't ignore anything more than -Wcast-qual, + * but the old implementation made it an almighty cast that + * ignored everything, so things break left and right if you + * make it only ignore -Wcast-qual. + */ +#define __CAST_AWAY_QUALIFIER(variable, qualifier, type) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") \ + _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \ + _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"") \ + ((type)(variable)) \ + _Pragma("GCC diagnostic pop") #endif /* @@ -798,11 +846,69 @@ #define __XNU_PRIVATE_EXTERN __attribute__((visibility("hidden"))) #endif +#if __has_include() +#include +#else +/* + * We intentionally define to nothing pointer attributes which do not have an + * impact on the ABI. __indexable and __bidi_indexable are not defined because + * of the ABI incompatibility that makes the diagnostic preferable. + */ +#define __has_ptrcheck 0 +#define __single +#define __unsafe_indexable +#define __counted_by(N) +#define __sized_by(N) +#define __ended_by(E) +#define __terminated_by(T) +#define __null_terminated + +/* + * Similarly, we intentionally define to nothing the + * __ptrcheck_abi_assume_single and __ptrcheck_abi_assume_unsafe_indexable + * macros because they do not lead to an ABI incompatibility. However, we do not + * define the indexable and unsafe_indexable ones because the diagnostic is + * better than the silent ABI break. + */ +#define __ptrcheck_abi_assume_single() +#define __ptrcheck_abi_assume_unsafe_indexable() + +/* __unsafe_forge intrinsics are defined as regular C casts. */ +#define __unsafe_forge_bidi_indexable(T, P, S) ((T)(P)) +#define __unsafe_forge_single(T, P) ((T)(P)) +#define __terminated_by_to_indexable(P) (P) +#define __unsafe_terminated_by_to_indexable(P) (P) +#define __null_terminated_to_indexable(P) (P) +#define __unsafe_null_terminated_to_indexable(P) (P) +#define __unsafe_terminated_by_from_indexable(T, P, ...) (P) +#define __unsafe_null_terminated_from_indexable(P, ...) (P) + +/* decay operates normally; attribute is meaningless without pointer checks. */ +#define __array_decay_dicards_count_in_parameters + +/* this is a write-once variable; not useful without pointer checks. */ +#define __unsafe_late_const +#endif /* !__has_include() */ + + +#define __ASSUME_PTR_ABI_SINGLE_BEGIN __ptrcheck_abi_assume_single() +#define __ASSUME_PTR_ABI_SINGLE_END __ptrcheck_abi_assume_unsafe_indexable() + +#if __has_ptrcheck +#define __header_indexable __indexable +#define __header_bidi_indexable __bidi_indexable +#else +#define __header_indexable +#define __header_bidi_indexable +#endif + /* * Architecture validation for current SDK */ #if !defined(__sys_cdefs_arch_unknown__) && defined(__i386__) #elif !defined(__sys_cdefs_arch_unknown__) && defined(__x86_64__) +#elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm__) +#elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm64__) #else #error Unsupported architecture #endif @@ -852,4 +958,12 @@ typedef _type _name; enum __VA_ARGS__ __enum_closed __enum_options #endif + + +#define __kernel_ptr_semantics +#define __kernel_data_semantics +#define __kernel_dual_semantics + + + #endif /* !_CDEFS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/random.h b/lib/libc/include/any-macos.13-any/sys/clonefile.h similarity index 57% rename from lib/libc/include/x86_64-macos.10-none/sys/random.h rename to lib/libc/include/any-macos.13-any/sys/clonefile.h index 4599da090b..faaf3a0802 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/random.h +++ b/lib/libc/include/any-macos.13-any/sys/clonefile.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2015-2017 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -26,15 +26,29 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ -#ifndef __SYS_RANDOM_H__ -#define __SYS_RANDOM_H__ +#ifndef _SYS_CLONEFILE_H_ +#define _SYS_CLONEFILE_H_ + +/* Options for clonefile calls */ +#define CLONE_NOFOLLOW 0x0001 /* Don't follow symbolic links */ +#define CLONE_NOOWNERCOPY 0x0002 /* Don't copy ownership information from source */ +#define CLONE_ACL 0x0004 /* Copy access control lists from source */ + -#include #include +#include +#include <_types/_uint32_t.h> +#include __BEGIN_DECLS - __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) -int getentropy(void* buffer, size_t size); + +int clonefileat(int, const char *, int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); + +int fclonefileat(int, int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); + +int clonefile(const char *, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); + __END_DECLS -#endif /* __SYS_RANDOM_H__ */ \ No newline at end of file + +#endif /* _SYS_CLONEFILE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/sys/constrained_ctypes.h b/lib/libc/include/any-macos.13-any/sys/constrained_ctypes.h new file mode 100644 index 0000000000..da3aaff482 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/sys/constrained_ctypes.h @@ -0,0 +1,591 @@ +/* + * Copyright (c) 2000-2022 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +#ifndef __CONSTRAINED_CTYPES__ +#define __CONSTRAINED_CTYPES__ + +#include + +/* This file introduces macros for constraining pointer + * types to specific contracts: + * + * + * 1. List of supported constrained pointers. + * + * 1.1. `Reference' pointers. + * + * The `reference' pointers point to a single entity. The pointer + * arithmetics are not supported for the `reference' pointers. + * + * The `reference' pointers are fully ABI compatible with + * the unconstrained C pointers. + * + * The naming convention for the `reference' pointers uses + * the `ref' constraint tag. See `Naming conventions' below for furhter + * discussion. + * + * Examples: + * + * (1) `socket_ref_t' is `reference' pointer to `struct socket'. + * (2) `uint32_ref_t' is `reference' pointer to `uint32_t'. + * + * + * 1.2. `Checked' pointers. + * + * The `checked' pointers represent contigous data arrays, which + * can be traversed only in the direction of increasing memory addresses. + * The pointer arithmetics are partially supported: decrements (p--, --p) + * are disallowed. + * + * The `checked' pointers are not ABI-compatible with plain C pointers, + * due to the boundary checks instrumentation. See `ABI + * Compatibility Considerations' below for further discussion. + * + * The naming convention for the `checked' pointers uses the `ptr' + * constraint tag. See `Naming conventions' below for furhter discussion. + * + * Examples: + * + * (1) `socket_ptr_t' is `checked' pointer to `struct socket'. + * (2) `uint32_ptr_t' is `checked' pointer to `uint32_t'. + * + * + * 1.3. `Bidirectional' pointers. + * + * The `bidirectional' pointers represent contigous data arrays, + * which can be traversed in both directions. The pointer arithmetics are + * fully supported for the `array' pointers. + * + * The `bidirectional' pointers are not ABI-compatible with plain C + * pointers, due to the boundary checks instrumentation. Additionally, + * passing `bidirectional' pointers to functions require the use of stack. + * See `ABI Compatibility Considerations' below for further discussion. + * + * The naming convention for the `bidirectional' pointers uses + * the `bptr' constraint tag. See `Naming conventions' below for furhter + * discussion. + * + * Examples: + * + * (1) `socket_bptr_t' is `bidirectional' pointer to `struct socket'. + * (2) `uint32_bptr_t' is `bidirectional' pointer to `uint32_t'. + * + * + * 1.4. Multidimensional constrained pointers. + * + * Constraining multidimensional pointers is achieved by iteratively + * applying the constraints from the innermost type to the outermost type. + * + * Pointer arithmetics are supported for the dimensions that + * are not constrained to a `reference' or `const reference'. + * + * If any of the dimension constraints isn't ABI-compatible with its + * unconstrained counterpart, then the entire constrained multidimensional + * pointer is not ABI-compatible with the corresponding unconstrained + * multidimensional pointer. Otherwise, the two are ABI-compatible. See + * `ABI compatibility' below for further discussion. + * + * The naming convention for the multidimensional constrained pointers + * combines the naming tags that correspond to the individual constraints. + * See `Naming conventions' below for furhter discussion. + * + * Examples: + * + * (1) `socket_ref_bptr_t' is a `bidirectional' pointer to a `reference' + * pointer to `struct socket'. + * (2) `socket_ptr_ref_t' is a `reference' pointer to a `checked' + * pointer to `struct socket'. + * + * + * 1.5. Using `const', `volatile', and `restrict' type qualifiers with + * constrained types. + * + * The use of the `const', `volatile', and `restrict' type qualifiers + * (a.k.a. "CRV qualifiers") follows the syntax of the C language. + * + * As a special case, if a `const' qualifier is applied to inner + * dimensions of a multidimensional constrained pointer type, the + * constraint tag is prepended with letter `c'; thus `cref' can be used + * for const-qualified `reference' pointer. This abbreviation is only + * supported for the `const' qualifier, as use of `volatile' or `restrict' + * for inner constrained types is quite uncommon. See `Multidimensional + * constrained pointers' above and `Naming conventions' below for further + * discussion. + * + * Examples: + * + * (1) `socket_ref_t const' is the const-qualified `reference' pointer + * to `struct socket'. + * (2) `socket_ptr_t volatile' is the volatile-qualified `checked' pointer + * to `struct socket'. + * (3) `socket_ptr_ref_t const' is a const-qualified `reference' pointer + * to a `checked' pointer to `struct socket'. + * (4) `socket_cref_ptr_t const' is a `checked' pointer to a + * const-qualified `reference' pointer to `struct socket'. + * + * + * 1.6. Combining constrained pointers and unconstrained pointers. + * + * Unconstrained pointers to constrained pointers follow + * the standard C syntax. Defining constrained pointers to + * unconstrained pointers is possible via defining a constrained pointer + * to a typedef. + * + * Examples: + * + * (1) `socket_ref_t *' is an unconstrained pointer to `socket_ref_t', i.e. + * unconstrained pointer to a `reference' pointer to `struct socket'. + * (2) `socket_ref_t const *' is an unconstrained pointer to `socket_ref_t const', + * i.e. an unconstrained pointer to a const-qualified `reference' + * pointer to `struct socket'. + * (3) `socket_ref_t * const' is a const-qualified unconstrained pointer to + * `socket_ref_t', i.e. a const-qualified unconstrained pointer to a + * `reference' pointer to `struct socket'. + * (4) `intptr_ref_t' is a `reference' pointer to `intptr_t', i.e. + * a `reference' pointer to an unconstrained pointer to `int'. Note + * the use of `intptr_t' typedef, which is necessary at the moment. + * + * + * 2. Defining constrained pointer types. + * + * 2.1. Declaring multiple constrained types simultaneously. + * + * `__CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag)` + * is the suggested way to declare constrained pointer types. + * + * Parameters: + * + * `basetype`: the pointee type, including `struct' or `enum' keywords. + * `basetag`: the prefix of the constrained type. + * + * This macro acts differently in the user-space and the kernel-space + * code. When used in the former, it will only declare types which are + * ABI-safe. See `ABI Compatibility Considerations' below for more details. + * + * Examples: + * + * (1) When used from the user space, + * `__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct socket, socket);' + * will declare types: + * + * (a) `socket_ref_t': the `reference' to `struct socket' + * (b) `socket_ref_ref_t': the `reference to reference' + * to `struct socket'. + * + * (2) When used from the kernel space, + * `__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct socket, socket);' + * will declare the above types, plus: + * + * (c) `socket_ptr_t': `checked' pointer to `struct socket'. + * (d) `socket_bptr_t': `bidirectional' pointer to `struct socket'. + * (e) `socket_ref_ptr_t': `checked' pointer to a `reference' + * to `struct socket'. + * (f) `socket_ptr_ref_t': `reference' to a `checked' pointer + * to `struct socket'. + * + * These additional types are not ABI-safe, and therefore are not exposed + * to the user space. See `ABI Compatibility Considerations' below. + * + * + * 2.2. Declaring individual constrained types. + * + * The above macro attempts to do many things at once, and under some + * circumstances can be not appropriate. For these circumstances, a + * finer-graned declarator can be used: + * + * `__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, ...)' + * + * Parameters: + * + * `basetype`: the pointee type. + * `basetag`: the prefix of the constrained type. + * `...`: list of `REF', `CREF', `BPTR' or `PTR', which represent + * the desired constraints. + * + * Examples: + * + * (1) `__CCT_DECLARE_CONSTRAINED_PTR_TYPE(struct socket, socket, REF)' + * will declare the type `socket_ref_t`: + * + * (2) `__CCT_DECLARE_CONSTRAINED_PTR_TYPE(struct socket, socket, REF, PTR, REF)' + * will declare the type `socket_ref_ptr_ref_t`: + * + * + * 3. Using constrained pointer types. + * + * 3.1. Using constrained pointers for local variables. + * + * Constraining the pointers on the stack reduces the risk of stack + * overflow. Therefore, it is highly suggested to use the constrained + * versions of the pointers for stack parameters. For local array + * variables, opt for the `bidirectional' pointers. If only a single value + * needs to be pointed, opt for the `reference' pointers. + * + * There are two alternative approaches for using the `reference' pointers. + * One approach is to explicitly use `thing_ref_t ptr` instead of `thing *ptr`. + * The other approach is to surround the code with the directives + * `__ASSUME_PTR_ABI_SINGLE_BEGIN' and `__ASSUME_PTR_ABI_SINGLE_END', which + * will have the effect of turning every unconstrained pointer to its + * `reference' counterpart. + * + * + * 3.2. Using constrained pointers for function parameters + * + * 3.2.1. Use `reference' pointers for scalar parameters. + * + * Scalar parameters are safe to use across ABI boundaries. + * + * Examples: + * + * (1) Using `reference' pointers for scalar input: + * + * errno_t thing_is_valid(const thing_ref_t t) + * { + * return t == NULL ? EINVAL : 0; + * } + * + * + * (2) Using `reference' pointers for scalar output, which is + * allocated by the caller: + * + * errno_t thing_copy(const thing_ref_t src, thing_ref_t dst) + * { + * if (src == NULL || dst == NULL) { + * return EINVAL; + * } + * bcopy(src, dst); + * return 0; + * } + * + * (3) Using `reference to reference' for scalar output that is + * allocated by the callee: + * + * errno_t thing_dup(const thing_ref_t src, thing_ref_ref_t dst) + * { + * *dst = malloc(sizeof(*dst)); + * bcopy(src, *dst, sizeof(*src)); + * return 0; + * } + * + * + * 3.2.2. Use `checked' pointers for vector parameters. + * + * When the ABI isn't a concern, use of `checked' pointers + * increases the code readability. + * + * See `ABI Compatibility Considerations' below for vector parameters when + * ABI is a concern. + * + * Examples: + * + * (1) Using `checked' pointers for vector input: + * + * errno_t thing_find_best(const thing_ref_ptr_t things, + * thing_ref_ref_t best, size_t count) + * { + * for (int i = 0; i < count; i++) { + * if (thing_is_the_best(things[i])) { + * *best = things[i]; + * return 0; + * } + * } + * return ENOENT; // no best thing + * } + * + * (2) Using `checked' pointers for vector output parameters that + * are allocated by caller: + * + * errno_t thing_copy_things(thing_ref_ptr_t src, thing_ref_ptr_t dst, + * size_t count) + * { + * for (int i = 0; i < count; i++) { + * dst[i] = malloc(sizeof(*dst[i])); + * bcopy(src[i], dst[i], sizeof(*src[i])); + * } + * return 0; + * } + * + * (3) Using `reference to checked' pointers for vector output + * parameters that are allocated by callee: + * + * errno_t thing_dup_things(thing_ref_ptr_t src, thing_ref_ptr_ref_t dst, + * size_t count) + * { + * *dst = malloc(sizeof(**src) * count); + * return thing_copy_things(src, *dst, count); + * } + * + * + * 3.3. Using constrained pointers in struct definitions + * + * Examples: + * + * (1) Using a structure that points to array of things: + * + * struct things_crate { + * size_t tc_count; + * thing_bptr_t tc_things; + * }; + * + * + * 3.4. Variable-size structures + * + * Constrained pointer instrumentation depends on knowing the size of the + * structures. If the structure contains a variable array, the array needs + * to be annotated by `__sized_by' or `__counted_by' attribute: + * + * Example: + * + * struct sockaddr { + * __uint8_t sa_len; + * sa_family_t sa_family; + * char sa_data[__counted_by(sa_len - 2)]; + * }; + * + * + * 4. ABI Compatibility Considerations + * + * The pointer instrumentation process has ABI implications. + * + * When the pointer insrumentation is enabled, the size of `bidirectional' + * and `checked' pointers exceeds the size of the machine word. + * + * Thus, if there is a concern that the instrumentation is enabled only in + * some compilation units that use the function, these constrained + * pointers can not be used for function parameters. + * + * Instead, one should rely on `__counted_by(count)' or `__sized_by(size)' + * attributes. These attributes accept as a parameter the name of a + * variable that contains the cont of items, or the byte size, of the + * pointed-to array. Use of these attributes does not change the size of + * the pointer. + * + * The tradeoff is between maintaining code readabilty and ABI compatibility. + * + * A common pattern is to split the function into the implementation, + * which is statically linked and therefore is ABI-safe, and the interface + * wrapper, which uses `__counted_by' or `__sized_by' to preserve ABI + * compatibility. + * + * + * 4.1. When ABI is a concern, replace `bidirectional' and `checked' + * with `__counted_by(count)` and `__sized_by(size)` for vector + * parameters. + * + * + * Examples: + * + * (1) Using `const thing_ref_t __counted_by(count)' instead of `const + * thing_ref_ptr_t' for vector input in a wrapper: + * + * errno_t thing_find_best_compat(const thing_ref_t __counted_by(count)things, + * thing_ref_ref_t best, size_t count) + * { + * // __counted_by implicitly upgraded to `checked' + * return thing_find_best(things, best, count); + * } + * + * (2) Using `thing_ref_t __counted_by(count)' instead of `thing_ref_ptr_t' + * for vector output in a wrapper. + * + * errno_t thing_copy_things_compat(thing_ref_t __counted_by(count)src, + * things_ref_t __counted_by(count)dst, + * size_t count) + * { + * // __counted_by implicitly upgraded to `checked' + * return thing_copy_things(src, dst, count); + * } + * + * + * 4.2. When ABI is a concern, use `__counted_by(count)' and + * `__sized_by(size)' for struct members that point to arrays. + * + * Examples: + * + * (1) Using a structure that points to array of things: + * + * struct things_crate { + * size_t tc_count; + * struct thing * __counted_by(tc_count)tc_things; + * }; + * + * 5. Naming conventions + * + * If `typename' is the name of a C type, and `tag' is a constraint tag + * (one of `ref', `ptr', or `bptr'), then the name of a pointer to + * `typename' constrained by `tag' is `basetag_tag_t', where `basename' + * is defined by: + * + * (a) If `typename' is a name of an integral type, then `basetag' is same + * as `typename'. + * (b) If `typename' is a name of a function type, then `basetag' is same + * as `typename'. + * (c) If `typename' is a name of a structure, then `basetag' is formed by + * stripping the `struct' keyword from `typename'. + * (d) If `typename' is a name of an enumeration, then `basetag' is formed + * by stripping the `enum' keyword from `typename'. + * (e) If `typename' is a name of a typedef to a struct or an enum that ends + * with `_t', then `basetag' is formed by stripping the `_t' suffix + * from `typename'. See (h) below for when `typename' is a pointer typedef. + * (f) If `typename' is a name of constrained pointer type ending with `_t', + * then `basetag' is formed by stripping the `_t' suffix from `typename'. + * + * Additionally, constrained pointers to constrained const pointers are a + * special case: + * + * (g) If `typename' is a name of a constrained pointer type, ending with + * `_{innertag}_t', and `typename' has `const' qualifier, then `basetag' + * is formed by replacing `_{innertag}_t' with `_c{innertag}' + * + * Finally, sometimes `name_t' represents not `struct name' but `struct name *'. + * This creates additional special case: + * + * (h) If `typename' is a pointer typedef named `{struct}_t`, such as + * `mbuf_t', then creating a constrained pointer to a `typename' would + * require creating a constrained pointer to an unconstrained pointer, + * which is not supported at the moment. Instead, a constrained pointer to + * `typeof(*typename)` must be created first, and constrained again. Using + * the `mbuf_t` example, first one should create a constrained pointer to + * `struct mbuf`, e.g, `mbuf_bptr_t`, and then constrain it again with + * `tag`, leading to `mbuf_bptr_ref_t'. + * + * Examples: + * + * (1) `int_ref_t' is a `reference pointer' to `int', following the rule (a) above. + * (2) `so_pru_ref_t' is a `reference pointer' to function `so_pru', + * following the rule (b) above. + * (3) `socket_ref_t' is a `reference pointer' to `struct socket', + * following the rule (c) above. + * (4) `classq_pkt_type_ref_t' is a `reference pointer' to `enum classq_pkt_type' + * following the rule (d) above. + * (5) `classq_pkt_type_ref_t' is a also `reference pointer' to `classq_pkt_type_t' + * following the rule (e) above. + * (6) `socket_ref_ref_t' is a `reference pointer' to `socket_ref_t`, + * following the rule (f) above. + * (7) `socket_cref_ref_t' is a `reference pointer' to `socket_ref_t const`, + * following the rule (g) above. + * (8) `mbuf_ref_ref_t', is a `reference pointer' to `mbuf_ref_t`, and is one + * possible result of creating a `reference pointer' to `mbuf_t', + * following the rule (h) above. + * (9) `mbuf_bptr_ref_t', is a `reference pointer' to `mbuf_bptr_t`, and + * is another possible result of creating a `reference pointer' to + * `mbuf_t', following the rule (h) above. + * + */ + +/* + * Constraint contract constants. + * + * At the moment only clang (when compiled with `ptrcheck' feature) supports + * pointer tagging via `__single', `__indexable' and `__bidi_indexable' attributes. + * + * During the transitional period, the `__indexable__' and `__bidi_indexable' + * constraints will decay to raw pointers if the `ptrcheck' feature is not enabled. + * Once the transitional period is over, the `__CCT_CONTRACT_ATTR_{B}PTR' constraints + * will stop decaying to raw pointers when built by sufficiently recent version + * of clang. + * + * Support for other compilers will be added after the introduction of support + * for pointer tagging on those compilers. + */ +#if defined(__clang__) +#define __CCT_CONTRACT_ATTR_REF __single +#define __CCT_CONTRACT_ATTR_CREF const __single +#if __has_ptrcheck +#define __CCT_CONTRACT_ATTR_BPTR __bidi_indexable +#define __CCT_CONTRACT_ATTR_PTR __indexable +#else /* __clang__ + __has_ptrcheck */ +#define __CCT_CONTRACT_ATTR_BPTR +#define __CCT_CONTRACT_ATTR_PTR +#endif /* __clang__ + !__has_ptrcheck */ +#else /* !__clang__ */ +#define __CCT_CONTRACT_ATTR_REF +#define __CCT_CONTRACT_ATTR_CREF const +#define __CCT_CONTRACT_ATTR_BPTR +#define __CCT_CONTRACT_ATTR_PTR +#endif /* __clang__ */ + +#define __CCT_CONTRACT_TAG_REF _ref +#define __CCT_CONTRACT_TAG_CREF _cref +#define __CCT_CONTRACT_TAG_BPTR _bptr +#define __CCT_CONTRACT_TAG_PTR _ptr + +/* Helper macros */ +#define __CCT_DEFER(F, ...) F(__VA_ARGS__) +#define __CCT_CONTRACT_TO_ATTR(kind) __CONCAT(__CCT_CONTRACT_ATTR_, kind) +#define __CCT_CONTRACT_TO_TAG(kind) __CCT_DEFER(__CONCAT, __CCT_CONTRACT_TAG_, kind) + +#define __CCT_COUNT_ARGS1(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, N, ...) N +#define __CCT_COUNT_ARGS(...) \ + __CCT_COUNT_ARGS1(, __VA_ARGS__, _9, _8, _7, _6, _5, _4, _3, _2, _1, _0) +#define __CCT_DISPATCH1(base, N, ...) __CONCAT(base, N)(__VA_ARGS__) +#define __CCT_DISPATCH(base, ...) \ + __CCT_DISPATCH1(base, __CCT_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__) + +/* Covert a contract list to a type suffix */ +#define __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_1(kind) \ + __CCT_DEFER(__CONCAT, __CCT_CONTRACT_TO_TAG(kind), _t) +#define __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_2(kind1, kind2) \ + __CCT_DEFER(__CONCAT, __CCT_CONTRACT_TO_TAG(kind1), \ + __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_1(kind2)) +#define __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_3(kind1, kind2, kind3) \ + __CCT_DEFER(__CONCAT, __CCT_CONTRACT_TO_TAG(kind1), \ + __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_2(kind2, kind3)) + +/* Create typedefs for the constrained pointer type */ +#define __CCT_DECLARE_CONSTRAINED_PTR_TYPE_3(basetype, basetag, kind) \ +typedef basetype * __CCT_CONTRACT_TO_ATTR(kind) \ + __CCT_DEFER(__CONCAT, basetag, __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_1(kind)) + +#define __CCT_DECLARE_CONSTRAINED_PTR_TYPE_4(basetype, basetag, kind1, kind2) \ +typedef basetype * __CCT_CONTRACT_TO_ATTR(kind1) \ + * __CCT_CONTRACT_TO_ATTR(kind2) \ + __CCT_DEFER(__CONCAT, basetag, __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_2(kind1, kind2)) + +#define __CCT_DECLARE_CONSTRAINED_PTR_TYPE_5(basetype, basetag, kind1, kind2, kind3) \ +typedef basetype * __CCT_CONTRACT_TO_ATTR(kind1) \ + * __CCT_CONTRACT_TO_ATTR(kind2) \ + * __CCT_CONTRACT_TO_ATTR(kind3) \ + __CCT_DEFER(__CONCAT, basetag, __CCT_CONTRACT_LIST_TO_TAGGED_SUFFIX_3(kind1, kind2, kind3)) + +/* + * Lower level type constructor. + */ +#define __CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, ...) \ + __CCT_DISPATCH(__CCT_DECLARE_CONSTRAINED_PTR_TYPE, basetype, basetag, __VA_ARGS__) + +/* + * Higher level type constructors. + * The constrained types that can potentially break the ABI are not exposed + * into the user-space. + */ +#define __CCT_DECLARE_CONSTRAINED_PTR_TYPES(basetype, basetag) \ +__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF); \ +__CCT_DECLARE_CONSTRAINED_PTR_TYPE(basetype, basetag, REF, REF) + +#endif /* __CONSTRAINED_CTYPES__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/event.h b/lib/libc/include/any-macos.13-any/sys/event.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/sys/event.h rename to lib/libc/include/any-macos.13-any/sys/event.h index 1fbce9a75c..d56e6dfaf0 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/event.h +++ b/lib/libc/include/any-macos.13-any/sys/event.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2019 Apple Inc. All rights reserved. + * Copyright (c) 2003-2021 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -58,7 +58,9 @@ #include #include +#include #include +#include /* * Filter types @@ -242,6 +244,8 @@ struct kevent64_s { #define NOTE_REVOKE 0x00000040 /* vnode access was revoked */ #define NOTE_NONE 0x00000080 /* No specific vnode event: to test for EVFILT_READ activation*/ #define NOTE_FUNLOCK 0x00000100 /* vnode was unlocked by flock(2) */ +#define NOTE_LEASE_DOWNGRADE 0x00000200 /* lease downgrade requested */ +#define NOTE_LEASE_RELEASE 0x00000400 /* lease release requested */ /* * data/hint fflags for EVFILT_PROC, shared with userspace @@ -262,7 +266,7 @@ enum { #define NOTE_EXEC 0x20000000 /* process exec'd */ #define NOTE_REAP ((unsigned int)eNoteReapDeprecated /* 0x10000000 */ ) /* process reaped */ #define NOTE_SIGNAL 0x08000000 /* shared with EVFILT_SIGNAL */ -#define NOTE_EXITSTATUS 0x04000000 /* exit status to be returned, valid for child process only */ +#define NOTE_EXITSTATUS 0x04000000 /* exit status to be returned, valid for child process or when allowed to signal target pid */ #define NOTE_EXIT_DETAIL 0x02000000 /* provide details on reasons for exit */ #define NOTE_PDATAMASK 0x000fffff /* mask for signal & exit status */ @@ -366,13 +370,10 @@ enum { /* Temporay solution for BootX to use inode.h till kqueue moves to vfs layer */ -#include struct knote; SLIST_HEAD(klist, knote); -#include - struct timespec; __BEGIN_DECLS diff --git a/lib/libc/include/x86_64-macos.10-none/sys/fcntl.h b/lib/libc/include/any-macos.13-any/sys/fcntl.h similarity index 81% rename from lib/libc/include/x86_64-macos.10-none/sys/fcntl.h rename to lib/libc/include/any-macos.13-any/sys/fcntl.h index 9326ed0dab..5f7d0d6524 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/fcntl.h +++ b/lib/libc/include/any-macos.13-any/sys/fcntl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 Apple Inc. All rights reserved. + * Copyright (c) 2000-2022 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -107,24 +107,60 @@ * which was documented to use FREAD/FWRITE, continues to work. */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define FREAD 0x0001 -#define FWRITE 0x0002 +#define FREAD 0x00000001 +#define FWRITE 0x00000002 #endif -#define O_NONBLOCK 0x0004 /* no delay */ -#define O_APPEND 0x0008 /* set append mode */ +#define O_NONBLOCK 0x00000004 /* no delay */ +#define O_APPEND 0x00000008 /* set append mode */ #include #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define O_SHLOCK 0x0010 /* open with shared file lock */ -#define O_EXLOCK 0x0020 /* open with exclusive file lock */ -#define O_ASYNC 0x0040 /* signal pgrp when data ready */ +#define O_SHLOCK 0x00000010 /* open with shared file lock */ +#define O_EXLOCK 0x00000020 /* open with exclusive file lock */ +#define O_ASYNC 0x00000040 /* signal pgrp when data ready */ #define O_FSYNC O_SYNC /* source compatibility: do not use */ -#define O_NOFOLLOW 0x0100 /* don't follow symlinks */ +#define O_NOFOLLOW 0x00000100 /* don't follow symlinks */ #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ -#define O_CREAT 0x0200 /* create if nonexistant */ -#define O_TRUNC 0x0400 /* truncate to zero length */ -#define O_EXCL 0x0800 /* error if already exists */ +#define O_CREAT 0x00000200 /* create if nonexistant */ +#define O_TRUNC 0x00000400 /* truncate to zero length */ +#define O_EXCL 0x00000800 /* error if already exists */ + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#define O_EVTONLY 0x00008000 /* descriptor requested for event notifications only */ +#endif + + +#define O_NOCTTY 0x00020000 /* don't assign controlling terminal */ + + +#if __DARWIN_C_LEVEL >= 200809L +#define O_DIRECTORY 0x00100000 +#endif + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#define O_SYMLINK 0x00200000 /* allow open of a symlink */ +#endif + +// O_DSYNC 0x00400000 /* synch I/O data integrity */ +#include + + +#if __DARWIN_C_LEVEL >= 200809L +#define O_CLOEXEC 0x01000000 /* implicitly set FD_CLOEXEC */ +#endif + + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define O_NOFOLLOW_ANY 0x20000000 /* no symlinks allowed in path */ +#endif + +#if __DARWIN_C_LEVEL >= 200809L +#define O_EXEC 0x40000000 /* open file for execute only */ +#define O_SEARCH (O_EXEC | O_DIRECTORY) /* open directory for search only */ +#endif + + #if __DARWIN_C_LEVEL >= 200809L /* @@ -142,37 +178,18 @@ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define AT_REALDEV 0x0200 /* Return real device inodes resides on for fstatat(2) */ #define AT_FDONLY 0x0400 /* Use only the fd and Ignore the path for fstatat(2) */ +#define AT_SYMLINK_NOFOLLOW_ANY 0x0800 /* Path should not contain any symlinks */ #endif #endif #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define O_EVTONLY 0x8000 /* descriptor requested for event notifications only */ -#endif - - -#define O_NOCTTY 0x20000 /* don't assign controlling terminal */ - - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define O_DIRECTORY 0x100000 -#define O_SYMLINK 0x200000 /* allow open of a symlink */ -#endif - -#include - - -#if __DARWIN_C_LEVEL >= 200809L -#define O_CLOEXEC 0x1000000 /* implicitly set FD_CLOEXEC */ -#endif - - - - - /* Data Protection Flags */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define O_DP_GETRAWENCRYPTED 0x0001 #define O_DP_GETRAWUNENCRYPTED 0x0002 +#define O_DP_AUTHENTICATE 0x0004 + +/* Descriptor value for openat_authenticated_np() to skip authentication with another fd */ +#define AUTH_OPEN_NOAUTHFD -1 #endif @@ -224,7 +241,7 @@ #define F_FLUSH_DATA 40 #define F_CHKCLEAN 41 /* Used for regression test */ #define F_PREALLOCATE 42 /* Preallocate storage */ -#define F_SETSIZE 43 /* Truncate a file without zeroing space */ +#define F_SETSIZE 43 /* Truncate a file. Equivalent to calling truncate(2) */ #define F_RDADVISE 44 /* Issue an advisory read async with no copy to user */ #define F_RDAHEAD 45 /* turn read ahead off/on for this fd */ /* @@ -253,7 +270,13 @@ #define F_LOG2PHYS_EXT 65 /* file offset to device offset, extended */ -#define F_GETLKPID 66 /* get record locking information, per-process */ +#define F_GETLKPID 66 /* See man fcntl(2) F_GETLK + * Similar to F_GETLK but in addition l_pid is treated as an input parameter + * which is used as a matching value when searching locks on the file + * so that only locks owned by the process with pid l_pid are returned. + * However, any flock(2) type lock will also be found with the returned value + * of l_pid set to -1 (as with F_GETLK). + */ /* See F_DUPFD_CLOEXEC below for 67 */ @@ -293,6 +316,18 @@ #define F_GETPATH_NOFIRMLINK 102 /* return the full path without firmlinks of the fd */ +#define F_ADDFILESIGS_INFO 103 /* Add signature from same file, return information */ +#define F_ADDFILESUPPL 104 /* Add supplemental signature from same file with fd reference to original */ +#define F_GETSIGSINFO 105 /* Look up code signature information attached to a file or slice */ + +#define F_SETLEASE 106 /* Acquire or release lease */ +#define F_GETLEASE 107 /* Retrieve lease information */ + +#define F_SETLEASE_ARG(t, oc) ((t) | ((oc) << 2)) + + +#define F_TRANSFEREXTENTS 110 /* Transfer allocated extents beyond leof to a different file */ + // FS-specific fcntl()'s numbers begin at 0x00010000 and go up #define FCNTL_FS_SPECIFIC_BASE 0x00010000 @@ -328,6 +363,7 @@ #define F_ALLOCATECONTIG 0x00000002 /* allocate contigious space */ #define F_ALLOCATEALL 0x00000004 /* allocate all requested space or no space at all */ +#define F_ALLOCATEPERSIST 0x00000008 /* do not free space upon close(2) */ /* Position Modes (fst_posmode) for F_PREALLOCATE */ @@ -374,30 +410,34 @@ struct radvisory { }; -/** Information the user passes in to get the codeblobs out of the kernel */ -typedef struct fcodeblobs { - void *f_cd_hash; - size_t f_hash_size; - void *f_cd_buffer; - size_t f_cd_size; - unsigned int *f_out_size; - int f_arch; - int __padding; -} fcodeblobs_t; - - /* * detached code signatures data type - * information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. * F_ADDFILESIGS is a shortcut for files that contain their own signature and * doesn't require mapping of the file in order to load the signature. */ +#define USER_FSIGNATURES_CDHASH_LEN 20 typedef struct fsignatures { off_t fs_file_start; void *fs_blob_start; size_t fs_blob_size; + + /* The following fields are only applicable to F_ADDFILESIGS_INFO (64bit only). */ + /* Prior to F_ADDFILESIGS_INFO, this struct ended after fs_blob_size. */ + size_t fs_fsignatures_size;// input: size of this struct (for compatibility) + char fs_cdhash[USER_FSIGNATURES_CDHASH_LEN]; // output: cdhash + int fs_hash_type;// output: hash algorithm type for cdhash } fsignatures_t; +typedef struct fsupplement { + off_t fs_file_start; /* offset of Mach-O image in FAT file */ + off_t fs_blob_start; /* offset of signature in Mach-O image */ + size_t fs_blob_size; /* signature blob size */ + int fs_orig_fd; /* address of original image */ +} fsupplement_t; + + + /* * DYLD needs to check if the object is allowed to be combined * into the main binary. This is done between the code signature @@ -415,6 +455,19 @@ typedef struct fchecklv { } fchecklv_t; +/* At this time F_GETSIGSINFO can only indicate platformness. + * As additional requestable information is defined, new keys will be added and the + * fgetsigsinfo_t structure will be lengthened to add space for the additional information + */ +#define GETSIGSINFO_PLATFORM_BINARY 1 + +/* fgetsigsinfo_t used by F_GETSIGSINFO command */ +typedef struct fgetsigsinfo { + off_t fg_file_start; /* IN: Offset in the file to look for a signature, -1 for any signature */ + int fg_info_request; /* IN: Key indicating the info requested */ + int fg_sig_is_platform; /* OUT: 1 if the signature is a plat form binary, 0 if not */ +} fgetsigsinfo_t; + /* lock operations for flock(2) */ #define LOCK_SH 0x01 /* shared file lock */ @@ -454,14 +507,6 @@ typedef struct fspecread { off_t fsr_length; /* IN: size of the region */ } fspecread_t; -/* fbootstraptransfer_t used by F_READBOOTSTRAP and F_WRITEBOOTSTRAP commands */ - -typedef struct fbootstraptransfer { - off_t fbt_offset; /* IN: offset to start read/write */ - size_t fbt_length; /* IN: number of bytes to transfer */ - void *fbt_buffer; /* IN: buffer to be read/written */ -} fbootstraptransfer_t; - /* * For F_LOG2PHYS this information is passed back to user @@ -541,6 +586,8 @@ int openx_np(const char *, int, filesec_t); * int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) */ int open_dprotected_np( const char *, int, int, int, ...); +int openat_dprotected_np( int, const char *, int, int, int, ...); +int openat_authenticated_np(int, const char *, int, int); int flock(int, int); filesec_t filesec_init(void); filesec_t filesec_dup(filesec_t); diff --git a/lib/libc/include/x86_64-macos.10-none/sys/ioctl.h b/lib/libc/include/any-macos.13-any/sys/filio.h similarity index 78% rename from lib/libc/include/x86_64-macos.10-none/sys/ioctl.h rename to lib/libc/include/any-macos.13-any/sys/filio.h index bb84842dd2..5744524f5b 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/ioctl.h +++ b/lib/libc/include/any-macos.13-any/sys/filio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2022 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -63,48 +63,23 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 + * @(#)filio.h 8.1 (Berkeley) 3/28/94 */ -#ifndef _SYS_IOCTL_H_ -#define _SYS_IOCTL_H_ - -#include - -/* - * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ - * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented - * nonwithstanding). - */ -struct ttysize { - unsigned short ts_lines; - unsigned short ts_cols; - unsigned short ts_xxx; - unsigned short ts_yyy; -}; -#define TIOCGSIZE TIOCGWINSZ -#define TIOCSSIZE TIOCSWINSZ +#ifndef _SYS_FILIO_H_ +#define _SYS_FILIO_H_ #include -#include -#include +/* Generic file-descriptor ioctl's. */ +#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ +#define FIONCLEX _IO('f', 2) /* remove close on exec */ +#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ +#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ +#define FIOSETOWN _IOW('f', 124, int) /* set owner */ +#define FIOGETOWN _IOR('f', 123, int) /* get owner */ +#define FIODTYPE _IOR('f', 122, int) /* get d_type */ -#include - -__BEGIN_DECLS -int ioctl(int, unsigned long, ...); -__END_DECLS -#endif /* !_SYS_IOCTL_H_ */ - -/* - * Keep outside _SYS_IOCTL_H_ - * Compatability with old terminal driver - * - * Source level -> #define USE_OLD_TTY - * Kernel level -> always on - */ -#if defined(USE_OLD_TTY) || defined(BSD_KERNEL_PRIVATE) -#include -#endif /* !_SYS_IOCTL_H_ */ \ No newline at end of file +#endif /* !_SYS_FILIO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/mount.h b/lib/libc/include/any-macos.13-any/sys/mount.h similarity index 95% rename from lib/libc/include/x86_64-macos.10-none/sys/mount.h rename to lib/libc/include/any-macos.13-any/sys/mount.h index 0a77b455a6..21b9bf3c12 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/mount.h +++ b/lib/libc/include/any-macos.13-any/sys/mount.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2018 Apple Inc. All rights reserved. + * Copyright (c) 2000-2021 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -82,6 +82,7 @@ #include #include /* file system id type */ +#include /* * file system statistics @@ -228,6 +229,7 @@ struct vfsstatfs { #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */ #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */ #define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */ +#define MNT_NOFOLLOW 0x08000000 /* don't follow symlink when resolving mount point */ #define MNT_NOATIME 0x10000000 /* disable update of file access time */ #define MNT_SNAPSHOT 0x40000000 /* The mount is a snapshot */ #define MNT_STRICTATIME 0x80000000 /* enable strict update of file access time */ @@ -247,7 +249,8 @@ struct vfsstatfs { MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \ MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \ MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | \ - MNT_NOATIME | MNT_STRICTATIME | MNT_SNAPSHOT | MNT_CPROTECT) + MNT_NOFOLLOW | MNT_NOATIME | MNT_STRICTATIME | \ + MNT_SNAPSHOT | MNT_CPROTECT) /* * External filesystem command modifier flags. * Unmount can use the MNT_FORCE flag. @@ -324,7 +327,7 @@ struct vfsidctl { * New style VFS sysctls, do not reuse/conflict with the namespace for * private sysctls. */ -#define VFS_CTL_STATFS 0x00010001 /* statfs */ +#define VFS_CTL_OSTATFS 0x00010001 /* old legacy statfs */ #define VFS_CTL_UMOUNT 0x00010002 /* unmount */ #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */ #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */ @@ -334,6 +337,17 @@ struct vfsidctl { #define VFS_CTL_DISC 0x00010008 /* server disconnected */ #define VFS_CTL_SERVERINFO 0x00010009 /* information about fs server */ #define VFS_CTL_NSTATUS 0x0001000A /* netfs mount status */ +#define VFS_CTL_STATFS64 0x0001000B /* statfs64 */ + +/* + * Automatically select the correct VFS_CTL_*STATFS* flavor based + * on what "struct statfs" layout the client will use. + */ +#if __DARWIN_64_BIT_INO_T +#define VFS_CTL_STATFS VFS_CTL_STATFS64 +#else +#define VFS_CTL_STATFS VFS_CTL_OSTATFS +#endif struct vfsquery { u_int32_t vq_flags; @@ -377,7 +391,6 @@ struct netfs_status { - /* * Generic file handle */ @@ -391,6 +404,13 @@ struct fhandle { }; typedef struct fhandle fhandle_t; +OS_ENUM(graftdmg_type, uint32_t, + GRAFTDMG_CRYPTEX_BOOT = 1, + GRAFTDMG_CRYPTEX_PREBOOT = 2, + GRAFTDMG_CRYPTEX_DOWNLEVEL = 3); + + + __BEGIN_DECLS int fhopen(const struct fhandle *, int); diff --git a/lib/libc/include/x86_64-macos.10-none/sys/proc_info.h b/lib/libc/include/any-macos.13-any/sys/proc_info.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/sys/proc_info.h rename to lib/libc/include/any-macos.13-any/sys/proc_info.h index 90850710b9..e59e5256b7 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/proc_info.h +++ b/lib/libc/include/any-macos.13-any/sys/proc_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2005-2021 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -100,8 +100,6 @@ struct proc_bsdshortinfo { }; - - /* pbi_flags values */ #define PROC_FLAG_SYSTEM 1 /* System process */ #define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */ @@ -472,6 +470,17 @@ struct kern_ctl_info { char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */ }; +/* + * VSock Sockets + */ + +struct vsock_sockinfo { + uint32_t local_cid; + uint32_t local_port; + uint32_t remote_cid; + uint32_t remote_port; +}; + /* soi_state */ #define SOI_S_NOFDREF 0x0001 /* no file table ref any more */ @@ -506,7 +515,8 @@ enum { SOCKINFO_UN = 3, SOCKINFO_NDRV = 4, SOCKINFO_KERN_EVENT = 5, - SOCKINFO_KERN_CTL = 6 + SOCKINFO_KERN_CTL = 6, + SOCKINFO_VSOCK = 7, }; struct socket_info { @@ -536,6 +546,7 @@ struct socket_info { struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */ struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */ struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */ + struct vsock_sockinfo pri_vsock; /* SOCKINFO_VSOCK */ } soi_proto; }; @@ -607,12 +618,11 @@ struct kqueue_dyninfo { }; /* keep in sync with KQ_* in sys/eventvar.h */ -#define PROC_KQUEUE_SELECT 0x01 -#define PROC_KQUEUE_SLEEP 0x02 -#define PROC_KQUEUE_32 0x08 -#define PROC_KQUEUE_64 0x10 -#define PROC_KQUEUE_QOS 0x20 - +#define PROC_KQUEUE_SELECT 0x0001 +#define PROC_KQUEUE_SLEEP 0x0002 +#define PROC_KQUEUE_32 0x0008 +#define PROC_KQUEUE_64 0x0010 +#define PROC_KQUEUE_QOS 0x0020 struct kqueue_fdinfo { struct proc_fileinfo pfi; @@ -640,6 +650,8 @@ typedef uint64_t proc_info_udata_t; #define PROX_FDTYPE_PIPE 6 #define PROX_FDTYPE_FSEVENTS 7 #define PROX_FDTYPE_NETPOLICY 9 +#define PROX_FDTYPE_CHANNEL 10 +#define PROX_FDTYPE_NEXUS 11 struct proc_fdinfo { int32_t proc_fd; @@ -651,6 +663,39 @@ struct proc_fileportinfo { uint32_t proc_fdtype; }; +/* + * Channel + */ + +/* type */ +#define PROC_CHANNEL_TYPE_USER_PIPE 0 +#define PROC_CHANNEL_TYPE_KERNEL_PIPE 1 +#define PROC_CHANNEL_TYPE_NET_IF 2 +#define PROC_CHANNEL_TYPE_FLOW_SWITCH 3 + +/* flags */ +#define PROC_CHANNEL_FLAGS_MONITOR_TX 0x1 +#define PROC_CHANNEL_FLAGS_MONITOR_RX 0x2 +#define PROC_CHANNEL_FLAGS_MONITOR_NO_COPY 0x4 +#define PROC_CHANNEL_FLAGS_EXCLUSIVE 0x10 +#define PROC_CHANNEL_FLAGS_USER_PACKET_POOL 0x20 +#define PROC_CHANNEL_FLAGS_DEFUNCT_OK 0x40 +#define PROC_CHANNEL_FLAGS_LOW_LATENCY 0x80 +#define PROC_CHANNEL_FLAGS_MONITOR \ + (PROC_CHANNEL_FLAGS_MONITOR_TX | PROC_CHANNEL_FLAGS_MONITOR_RX) + +struct proc_channel_info { + uuid_t chi_instance; + uint32_t chi_port; + uint32_t chi_type; + uint32_t chi_flags; + uint32_t rfu_1;/* reserved */ +}; + +struct channel_fdinfo { + struct proc_fileinfo pfi; + struct proc_channel_info channelinfo; +}; /* Flavors for proc_pidinfo() */ #define PROC_PIDLISTFDS 1 @@ -729,6 +774,8 @@ struct proc_fileportinfo { #define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo)) +#define PROC_PIDFDCHANNELINFO 10 +#define PROC_PIDFDCHANNELINFO_SIZE (sizeof(struct channel_fdinfo)) /* Flavors for proc_pidfileportinfo */ @@ -780,6 +827,7 @@ struct proc_fileportinfo { + __END_DECLS #endif /*_SYS_PROC_INFO_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/resource.h b/lib/libc/include/any-macos.13-any/sys/resource.h similarity index 81% rename from lib/libc/include/x86_64-macos.10-none/sys/resource.h rename to lib/libc/include/any-macos.13-any/sys/resource.h index b6bf678d37..4e1c86636c 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/resource.h +++ b/lib/libc/include/any-macos.13-any/sys/resource.h @@ -188,7 +188,14 @@ struct rusage { #define RUSAGE_INFO_V2 2 #define RUSAGE_INFO_V3 3 #define RUSAGE_INFO_V4 4 -#define RUSAGE_INFO_CURRENT RUSAGE_INFO_V4 +#define RUSAGE_INFO_V5 5 +#define RUSAGE_INFO_V6 6 +#define RUSAGE_INFO_CURRENT RUSAGE_INFO_V6 + +/* + * Flags for RUSAGE_INFO_V5 + */ +#define RU_PROC_RUNS_RESLIDE 0x00000001 /* proc has reslid shared cache */ typedef void *rusage_info_t; @@ -318,7 +325,94 @@ struct rusage_info_v4 { uint64_t ri_runnable_time; }; -typedef struct rusage_info_v4 rusage_info_current; +struct rusage_info_v5 { + uint8_t ri_uuid[16]; + uint64_t ri_user_time; + uint64_t ri_system_time; + uint64_t ri_pkg_idle_wkups; + uint64_t ri_interrupt_wkups; + uint64_t ri_pageins; + uint64_t ri_wired_size; + uint64_t ri_resident_size; + uint64_t ri_phys_footprint; + uint64_t ri_proc_start_abstime; + uint64_t ri_proc_exit_abstime; + uint64_t ri_child_user_time; + uint64_t ri_child_system_time; + uint64_t ri_child_pkg_idle_wkups; + uint64_t ri_child_interrupt_wkups; + uint64_t ri_child_pageins; + uint64_t ri_child_elapsed_abstime; + uint64_t ri_diskio_bytesread; + uint64_t ri_diskio_byteswritten; + uint64_t ri_cpu_time_qos_default; + uint64_t ri_cpu_time_qos_maintenance; + uint64_t ri_cpu_time_qos_background; + uint64_t ri_cpu_time_qos_utility; + uint64_t ri_cpu_time_qos_legacy; + uint64_t ri_cpu_time_qos_user_initiated; + uint64_t ri_cpu_time_qos_user_interactive; + uint64_t ri_billed_system_time; + uint64_t ri_serviced_system_time; + uint64_t ri_logical_writes; + uint64_t ri_lifetime_max_phys_footprint; + uint64_t ri_instructions; + uint64_t ri_cycles; + uint64_t ri_billed_energy; + uint64_t ri_serviced_energy; + uint64_t ri_interval_max_phys_footprint; + uint64_t ri_runnable_time; + uint64_t ri_flags; +}; + +struct rusage_info_v6 { + uint8_t ri_uuid[16]; + uint64_t ri_user_time; + uint64_t ri_system_time; + uint64_t ri_pkg_idle_wkups; + uint64_t ri_interrupt_wkups; + uint64_t ri_pageins; + uint64_t ri_wired_size; + uint64_t ri_resident_size; + uint64_t ri_phys_footprint; + uint64_t ri_proc_start_abstime; + uint64_t ri_proc_exit_abstime; + uint64_t ri_child_user_time; + uint64_t ri_child_system_time; + uint64_t ri_child_pkg_idle_wkups; + uint64_t ri_child_interrupt_wkups; + uint64_t ri_child_pageins; + uint64_t ri_child_elapsed_abstime; + uint64_t ri_diskio_bytesread; + uint64_t ri_diskio_byteswritten; + uint64_t ri_cpu_time_qos_default; + uint64_t ri_cpu_time_qos_maintenance; + uint64_t ri_cpu_time_qos_background; + uint64_t ri_cpu_time_qos_utility; + uint64_t ri_cpu_time_qos_legacy; + uint64_t ri_cpu_time_qos_user_initiated; + uint64_t ri_cpu_time_qos_user_interactive; + uint64_t ri_billed_system_time; + uint64_t ri_serviced_system_time; + uint64_t ri_logical_writes; + uint64_t ri_lifetime_max_phys_footprint; + uint64_t ri_instructions; + uint64_t ri_cycles; + uint64_t ri_billed_energy; + uint64_t ri_serviced_energy; + uint64_t ri_interval_max_phys_footprint; + uint64_t ri_runnable_time; + uint64_t ri_flags; + uint64_t ri_user_ptime; + uint64_t ri_system_ptime; + uint64_t ri_pinstructions; + uint64_t ri_pcycles; + uint64_t ri_energy_nj; + uint64_t ri_penergy_nj; + uint64_t ri_reserved[14]; +}; + +typedef struct rusage_info_v6 rusage_info_current; #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ @@ -409,6 +503,12 @@ struct proc_rlimit_control_wakeupmon { #define IOPOL_TYPE_VFS_ATIME_UPDATES 2 #define IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES 3 #define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4 +#define IOPOL_TYPE_VFS_TRIGGER_RESOLVE 5 +#define IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION 6 +#define IOPOL_TYPE_VFS_IGNORE_PERMISSIONS 7 +#define IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE 8 +#define IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES 9 +#define IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY 10 /* scope */ #define IOPOL_SCOPE_PROCESS 0 @@ -438,6 +538,24 @@ struct proc_rlimit_control_wakeupmon { #define IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT 0 #define IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME 1 +#define IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT 0 +#define IOPOL_VFS_TRIGGER_RESOLVE_OFF 1 + +#define IOPOL_VFS_CONTENT_PROTECTION_DEFAULT 0 +#define IOPOL_VFS_CONTENT_PROTECTION_IGNORE 1 + +#define IOPOL_VFS_IGNORE_PERMISSIONS_OFF 0 +#define IOPOL_VFS_IGNORE_PERMISSIONS_ON 1 + +#define IOPOL_VFS_SKIP_MTIME_UPDATE_OFF 0 +#define IOPOL_VFS_SKIP_MTIME_UPDATE_ON 1 + +#define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF 0 +#define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON 1 + +#define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT 0 +#define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON 1 + #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ diff --git a/lib/libc/include/x86_64-macos.10-none/sys/socket.h b/lib/libc/include/any-macos.13-any/sys/socket.h similarity index 95% rename from lib/libc/include/x86_64-macos.10-none/sys/socket.h rename to lib/libc/include/any-macos.13-any/sys/socket.h index c8a0d27615..4c5a523336 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/socket.h +++ b/lib/libc/include/any-macos.13-any/sys/socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2019 Apple Inc. All rights reserved. + * Copyright (c) 2000-2022 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -74,10 +74,12 @@ #include #include +#include #include #include + #include /* @@ -128,6 +130,7 @@ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ #define SO_LINGER 0x0080 /* linger on close if data present (in ticks) */ +#define SO_LINGER_SEC 0x1080 /* linger on close if data present (in seconds) */ #else #define SO_LINGER 0x1080 /* linger on close if data present (in seconds) */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ @@ -160,8 +163,8 @@ #define SO_ERROR 0x1007 /* get error status and clear */ #define SO_TYPE 0x1008 /* get socket type */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define SO_LABEL 0x1010 /* socket's MAC label */ -#define SO_PEERLABEL 0x1011 /* socket's peer MAC label */ +#define SO_LABEL 0x1010 /* deprecated */ +#define SO_PEERLABEL 0x1011 /* deprecated */ #ifdef __APPLE__ #define SO_NREAD 0x1020 /* APPLE: get 1st-packet byte count */ #define SO_NKE 0x1021 /* APPLE: Install socket-level NKE */ @@ -173,7 +176,6 @@ #define SO_NOTIFYCONFLICT 0x1026 /* APPLE: send notification if there is a bind on a port which is already in use */ #define SO_UPCALLCLOSEWAIT 0x1027 /* APPLE: block on close until an upcall returns */ #endif -#define SO_LINGER_SEC 0x1080 /* linger on close if data present (in seconds) */ #define SO_RANDOMPORT 0x1082 /* APPLE: request local port randomization */ #define SO_NP_EXTENSIONS 0x1083 /* To turn off some POSIX behavior */ #endif @@ -182,7 +184,13 @@ #define SO_NET_SERVICE_TYPE 0x1116 /* Network service type */ -#define SO_NETSVC_MARKING_LEVEL 0x1119 /* Get QoS marking in effect for socket */ +#define SO_NETSVC_MARKING_LEVEL 0x1119 /* Get QoS marking in effect for socket */ + + +#define SO_RESOLVER_SIGNATURE 0x1131 /* A signed data blob from the system resolver */ + + +/* When adding new socket-options, you need to make sure MPTCP supports these as well! */ /* * Network Service Type for option SO_NET_SERVICE_TYPE @@ -398,7 +406,8 @@ struct so_np_extensions { #define AF_RESERVED_36 36 /* Reserved for internal usage */ #define AF_IEEE80211 37 /* IEEE 802.11 protocol */ #define AF_UTUN 38 -#define AF_MAX 40 +#define AF_VSOCK 40 /* VM Sockets */ +#define AF_MAX 41 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* @@ -407,7 +416,22 @@ struct so_np_extensions { struct sockaddr { __uint8_t sa_len; /* total length */ sa_family_t sa_family; /* [XSI] address family */ - char sa_data[14]; /* [XSI] addr value (actually larger) */ +#if __has_ptrcheck + char sa_data[__counted_by(sa_len - 2)]; +#else + char sa_data[14]; /* [XSI] addr value (actually smaller or larger) */ +#endif +}; +__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr); + +/* + * Least amount of information that a sockaddr requires. + * Sockaddr_header is a compatible prefix structure of + * all sockaddr objects. + */ +struct __sockaddr_header { + __uint8_t sa_len; + sa_family_t sa_family; }; #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) @@ -444,6 +468,7 @@ struct sockaddr_storage { __int64_t __ss_align; /* force structure storage alignment */ char __ss_pad2[_SS_PAD2SIZE]; }; +__CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage); /* * Protocol families, same as address families for now. @@ -486,6 +511,7 @@ struct sockaddr_storage { #define PF_PPP AF_PPP #define PF_RESERVED_36 AF_RESERVED_36 #define PF_UTUN AF_UTUN +#define PF_VSOCK AF_VSOCK #define PF_MAX AF_MAX /* @@ -578,6 +604,13 @@ struct msghdr { #define MSG_NEEDSA 0x10000 /* Fail receive if socket address cannot be allocated */ #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#if __DARWIN_C_LEVEL >= 200809L +#define MSG_NOSIGNAL 0x80000 /* do not generate SIGPIPE on EOF */ +#endif /* __DARWIN_C_LEVEL */ + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + /* * Header for ancillary data objects in msg_control buffer. * Used for additional information with/about a datagram @@ -671,7 +704,7 @@ struct cmsgcred { #define SHUT_WR 1 /* shut down the writing side */ #define SHUT_RDWR 2 /* shut down both sides */ -#if !defined(_POSIX_C_SOURCE) +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * sendfile(2) header/trailer struct */ @@ -683,7 +716,7 @@ struct sf_hdtr { }; -#endif /* !_POSIX_C_SOURCE */ +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ __BEGIN_DECLS diff --git a/lib/libc/include/x86_64-macos.10-none/sys/spawn.h b/lib/libc/include/any-macos.13-any/sys/spawn.h similarity index 91% rename from lib/libc/include/x86_64-macos.10-none/sys/spawn.h rename to lib/libc/include/any-macos.13-any/sys/spawn.h index 483f017b69..727b4f5009 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/spawn.h +++ b/lib/libc/include/any-macos.13-any/sys/spawn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2006-2020 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -61,6 +61,8 @@ #define POSIX_SPAWN_SETSID 0x0400 #define POSIX_SPAWN_CLOEXEC_DEFAULT 0x4000 +#define _POSIX_SPAWN_RESLIDE 0x0800 + /* * Possible values to be set for the process control actions on resource starvation. * POSIX_SPAWN_PCONTROL_THROTTLE indicates that the process is to be throttled on starvation. @@ -72,6 +74,11 @@ #define POSIX_SPAWN_PCONTROL_SUSPEND 0x0002 #define POSIX_SPAWN_PCONTROL_KILL 0x0003 +#define POSIX_SPAWN_PANIC_ON_CRASH 0x1 +#define POSIX_SPAWN_PANIC_ON_NON_ZERO_EXIT 0x2 +#define POSIX_SPAWN_PANIC_ON_EXIT 0x4 +#define POSIX_SPAWN_PANIC_ON_SPAWN_FAIL 0x8 + #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #endif /* _SYS_SPAWN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/stat.h b/lib/libc/include/any-macos.13-any/sys/stat.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/sys/stat.h rename to lib/libc/include/any-macos.13-any/sys/stat.h index 7f2a490ee1..a153272600 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/stat.h +++ b/lib/libc/include/any-macos.13-any/sys/stat.h @@ -361,6 +361,7 @@ struct stat64 __DARWIN_STRUCT_STAT64; #endif +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL /* * Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk */ @@ -369,7 +370,8 @@ struct stat64 __DARWIN_STRUCT_STAT64; #define EF_IS_SYNC_ROOT 0x00000004 /* file is a sync root for iCloud */ #define EF_IS_PURGEABLE 0x00000008 /* file is purgeable */ #define EF_IS_SPARSE 0x00000010 /* file has at least one sparse region */ - +#define EF_IS_SYNTHETIC 0x00000020 /* a synthetic directory/symlink */ +#endif @@ -389,6 +391,8 @@ mode_t umask(mode_t); int fchmodat(int, const char *, mode_t, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int fstatat(int, const char *, struct stat *, int) __DARWIN_INODE64(fstatat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); int mkdirat(int, const char *, mode_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +int mkfifoat(int, const char *, mode_t) __API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)); +int mknodat(int, const char *, mode_t, dev_t) __API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)); #define UTIME_NOW -1 #define UTIME_OMIT -2 diff --git a/lib/libc/include/x86_64-macos.10-none/sys/sysctl.h b/lib/libc/include/any-macos.13-any/sys/sysctl.h similarity index 89% rename from lib/libc/include/x86_64-macos.10-none/sys/sysctl.h rename to lib/libc/include/any-macos.13-any/sys/sysctl.h index 9e3d84e04c..eebee35881 100644 --- a/lib/libc/include/x86_64-macos.10-none/sys/sysctl.h +++ b/lib/libc/include/any-macos.13-any/sys/sysctl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2019 Apple Inc. All rights reserved. + * Copyright (c) 2000-2021 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -81,10 +81,10 @@ #include #include #include + #include #include - /* * Definitions for sysctl call. The sysctl call uses a hierarchical name * for objects that can be examined or modified. The name is expressed as @@ -135,25 +135,26 @@ struct ctlname { int ctl_type; /* type of name */ }; -#define CTLTYPE 0xf /* Mask for the type */ -#define CTLTYPE_NODE 1 /* name is a node */ -#define CTLTYPE_INT 2 /* name describes an integer */ -#define CTLTYPE_STRING 3 /* name describes a string */ -#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ -#define CTLTYPE_OPAQUE 5 /* name describes a structure */ -#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ +#define CTLTYPE 0xf /* Mask for the type */ +#define CTLTYPE_NODE 1 /* name is a node */ +#define CTLTYPE_INT 2 /* name describes an integer */ +#define CTLTYPE_STRING 3 /* name describes a string */ +#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ +#define CTLTYPE_OPAQUE 5 /* name describes a structure */ +#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ -#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ -#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ -#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) -#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ -#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ -#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ -#define CTLFLAG_MASKED 0x04000000 /* deprecated variable, do not display */ -#define CTLFLAG_NOAUTO 0x02000000 /* do not auto-register */ -#define CTLFLAG_KERN 0x01000000 /* valid inside the kernel */ -#define CTLFLAG_LOCKED 0x00800000 /* node will handle locking itself */ -#define CTLFLAG_OID2 0x00400000 /* struct sysctl_oid has version info */ +#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ +#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ +#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) +#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ +#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ +#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ +#define CTLFLAG_MASKED 0x04000000 /* deprecated variable, do not display */ +#define CTLFLAG_NOAUTO 0x02000000 /* do not auto-register */ +#define CTLFLAG_KERN 0x01000000 /* valid inside the kernel */ +#define CTLFLAG_LOCKED 0x00800000 /* node will handle locking itself */ +#define CTLFLAG_OID2 0x00400000 /* struct sysctl_oid has version info */ +#define CTLFLAG_EXPERIMENT 0x00100000 /* Allows writing w/ the trial experiment entitlement. */ /* * USE THIS instead of a hardwired number from the categories below @@ -168,8 +169,8 @@ struct ctlname { * in I/O-Kit. In this case, you have to call sysctl_register_oid() * manually - just like in a KEXT. */ -#define OID_AUTO (-1) -#define OID_AUTO_START 100 /* conventional */ +#define OID_AUTO (-1) +#define OID_AUTO_START 100 /* conventional */ #define SYSCTL_DEF_ENABLED @@ -228,7 +229,7 @@ struct ctlname { #define KERN_NISDOMAINNAME 22 /* string: YP domain name */ #define KERN_DOMAINNAME KERN_NISDOMAINNAME #define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */ -#define KERN_KDEBUG 24 /* int: kernel trace points */ +#define KERN_KDEBUG 24 /* int: kernel trace points */ #define KERN_UPDATEINTERVAL 25 /* int: update process sleep time */ #define KERN_OSRELDATE 26 /* int: OS release date */ #define KERN_NTP_PLL 27 /* node: NTP PLL control */ @@ -337,8 +338,9 @@ struct ctlname { #define KERN_KDSET_TYPEFILTER 22 #define KERN_KDBUFWAIT 23 #define KERN_KDCPUMAP 24 -/* 25 - 26 unused */ -#define KERN_KDWRITEMAP_V3 27 +#define KERN_KDCPUMAP_EXT 25 +#define KERN_KDSET_EDM 26 +#define KERN_KDGET_EDM 27 #define KERN_KDWRITETR_V3 28 #define CTL_KERN_NAMES { \ @@ -553,8 +555,8 @@ extern struct loadavg averunnable; /* * CTL_HW identifiers */ -#define HW_MACHINE 1 /* string: machine class */ -#define HW_MODEL 2 /* string: specific machine model */ +#define HW_MACHINE 1 /* string: machine class (deprecated: use HW_PRODUCT) */ +#define HW_MODEL 2 /* string: specific machine model (deprecated: use HW_TARGET) */ #define HW_NCPU 3 /* int: number of cpus */ #define HW_BYTEORDER 4 /* int: machine byte order */ #define HW_PHYSMEM 5 /* int: total memory */ @@ -578,12 +580,14 @@ extern struct loadavg averunnable; #define HW_TB_FREQ 23 /* int: Bus Frequency */ #define HW_MEMSIZE 24 /* uint64_t: physical ram size */ #define HW_AVAILCPU 25 /* int: number of available CPUs */ -#define HW_MAXID 26 /* number of valid hw ids */ +#define HW_TARGET 26 /* string: model identifier */ +#define HW_PRODUCT 27 /* string: product identifier */ +#define HW_MAXID 28 /* number of valid hw ids */ #define CTL_HW_NAMES { \ { 0, 0 }, \ - { "machine", CTLTYPE_STRING }, \ - { "model", CTLTYPE_STRING }, \ + { "machine", CTLTYPE_STRING }, /* Deprecated: use hw.product */ \ + { "model", CTLTYPE_STRING }, /* Deprecated: use hw.target */ \ { "ncpu", CTLTYPE_INT }, \ { "byteorder", CTLTYPE_INT }, \ { "physmem", CTLTYPE_INT }, \ @@ -606,7 +610,9 @@ extern struct loadavg averunnable; { "l3cachesize", CTLTYPE_INT }, \ { "tbfrequency", CTLTYPE_INT }, \ { "memsize", CTLTYPE_QUAD }, \ - { "availcpu", CTLTYPE_INT } \ + { "availcpu", CTLTYPE_INT }, \ + { "target", CTLTYPE_STRING }, \ + { "product", CTLTYPE_STRING }, \ } /* @@ -663,6 +669,28 @@ extern struct loadavg averunnable; * hw.l2cachesize - * hw.l3cachesize - * + * hw.nperflevels - Number of core types in the system. See the parameters below, which can be used to get + * - information associated with a specific perf level. + * + * The following parameters apply to perflevel N, where N is a number between 0 and the number of core types in the system minus one. + * perflevel 0 always refers to the highest performance core type in the system. + * + * hw.perflevelN.physicalcpu - The number of physical processors available in the current power management mode. + * hw.perflevelN.physicalcpumax - The maximum number of physical processors that could be available this boot. + * hw.perflevelN.logicalcpu - The number of logical processors available in the current power management mode. + * hw.perflevelN.logicalcpumax - The maximum number of logical processors that could be available this boot. + * + * hw.perflevelN.l1dcachesize - These values provide the size in bytes of the L1, L2 and L3 caches. If a cache is not present + * hw.perflevelN.l1icachesize - then the selector will return and error. + * hw.perflevelN.l2cachesize - + * hw.perflevelN.l3cachesize - + * + * hw.perflevelN.cpusperl2 - These values provide the number of CPUs of the same type that share L2 and L3 caches. + * hw.perflevelN.cpusperl3 - If a cache is not present then the selector will return and error. + * + * hw.perflevelN.l2perflevels - These values provide a bitmap, where bit number of CPUs of the same type that share L2 and L3 caches. + * hw.perflevelN.l3perflevels - If a cache is not present then the selector will return and error. + * * hw.packages - Gives the number of processor packages. * * These are the selectors for optional processor features for specific processors. Selectors that return errors are not support @@ -755,7 +783,7 @@ extern struct loadavg averunnable; #define CTL_DEBUG_MAXID 20 -#if (CTL_MAXID != 9) || (KERN_MAXID != 72) || (VM_MAXID != 6) || (HW_MAXID != 26) || (USER_MAXID != 21) || (CTL_DEBUG_MAXID != 20) +#if (CTL_MAXID != 9) || (KERN_MAXID != 72) || (VM_MAXID != 6) || (HW_MAXID != 28) || (USER_MAXID != 21) || (CTL_DEBUG_MAXID != 20) #error Use the SYSCTL_*() macros and OID_AUTO instead! #endif diff --git a/lib/libc/include/any-macos.13-any/sys/time.h b/lib/libc/include/any-macos.13-any/sys/time.h new file mode 100644 index 0000000000..5e8da98d4b --- /dev/null +++ b/lib/libc/include/any-macos.13-any/sys/time.h @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)time.h 8.2 (Berkeley) 7/10/94 + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include +#include +#include + + +/* + * [XSI] The fd_set type shall be defined as described in . + * The timespec structure shall be defined as described in + */ +#include +#include +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include +#endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */ + + +#include +#include + +/* + * Structure used as a parameter by getitimer(2) and setitimer(2) system + * calls. + */ +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). The + * extra protection here is to permit application redefinition above + * the default size. + */ +#include +#include +#include +#include +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) + +#include + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ + +/* Operations on timevals. */ +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) +#define timeradd(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ + if ((vvp)->tv_usec >= 1000000) { \ + (vvp)->tv_sec++; \ + (vvp)->tv_usec -= 1000000; \ + } \ + } while (0) +#define timersub(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) + +#define timevalcmp(l, r, cmp) timercmp(l, r, cmp) /* freebsd */ + +/* + * Getkerninfo clock information structure + */ +struct clockinfo { + int hz; /* clock frequency */ + int tick; /* micro-seconds per hz tick */ + int tickadj; /* clock skew rate for adjtime() */ + int stathz; /* statistics clock frequency */ + int profhz; /* profiling clock frequency */ +}; +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + + + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + +__BEGIN_DECLS + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +int adjtime(const struct timeval *, struct timeval *); +int futimes(int, const struct timeval *); +int lutimes(const char *, const struct timeval *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); +int settimeofday(const struct timeval *, const struct timezone *); +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + +int getitimer(int, struct itimerval *); +int gettimeofday(struct timeval * __restrict, void * __restrict); + +#include /* select() prototype */ + +int setitimer(int, const struct itimerval * __restrict, + struct itimerval * __restrict); +int utimes(const char *, const struct timeval *); + +__END_DECLS + + + +#endif /* !_SYS_TIME_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/sys/types.h b/lib/libc/include/any-macos.13-any/sys/types.h new file mode 100644 index 0000000000..a6be64c82f --- /dev/null +++ b/lib/libc/include/any-macos.13-any/sys/types.h @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2000-2021 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ +/* + * Copyright (c) 1982, 1986, 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.4 (Berkeley) 1/21/94 + */ + +#ifndef _SYS_TYPES_H_ +#define _SYS_TYPES_H_ + +#include + +#ifndef __ASSEMBLER__ +#include + +/* Machine type dependent parameters. */ +#include +#include + +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include +#include +#include +#ifndef _U_LONG +typedef unsigned long u_long; +#define _U_LONG +#endif +typedef unsigned short ushort; /* Sys V compatibility */ +typedef unsigned int uint; /* Sys V compatibility */ +#endif + +typedef u_int64_t u_quad_t; /* quads */ +typedef int64_t quad_t; +typedef quad_t * qaddr_t; + +#include /* core address */ + +typedef int32_t daddr_t; /* disk address */ + +#include /* device number */ + +typedef u_int32_t fixpt_t; /* fixed point number */ + +#include +#include +#include +#include +#include +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include /* 64bit inode number */ +#endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */ + +#include +#include +#include +#include +#include +#include + +typedef int32_t segsz_t; /* segment size */ +typedef int32_t swblk_t; /* swap offset */ + +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +/* Major, minor numbers, dev_t's. */ +#if defined(__cplusplus) +/* + * These lowercase macros tend to match member functions in some C++ code, + * so for C++, we must use inline functions instead. + */ + +static inline __int32_t +major(__uint32_t _x) +{ + return (__int32_t)(((__uint32_t)_x >> 24) & 0xff); +} + +static inline __int32_t +minor(__uint32_t _x) +{ + return (__int32_t)((_x) & 0xffffff); +} + +static inline dev_t +makedev(__uint32_t _major, __uint32_t _minor) +{ + return (dev_t)(((_major) << 24) | (_minor)); +} + +#else /* !__cplusplus */ + +#define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff)) +#define minor(x) ((int32_t)((x) & 0xffffff)) +#define makedev(x, y) ((dev_t)(((x) << 24) | (y))) + +#endif /* !__cplusplus */ +#endif /* !_POSIX_C_SOURCE */ + +#include +#include +#include +#include + +#include +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include +#include +#endif + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +/* + * This code is present here in order to maintain historical backward + * compatability, and is intended to be removed at some point in the + * future; please include instead. + */ +#include + +#define NBBY __DARWIN_NBBY /* bits in a byte */ +#define NFDBITS __DARWIN_NFDBITS /* bits per mask */ +#define howmany(x, y) __DARWIN_howmany(x, y) /* # y's == x bits? */ +typedef __int32_t fd_mask; + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). The + * extra protection here is to permit application redefinition above + * the default size. + */ +#include +#include +#include +#include +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#include +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + + + +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#endif /* __ASSEMBLER__ */ + + +#ifndef __POSIX_LIB__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* __POSIX_LIB__ */ + +#include + + +/* statvfs and fstatvfs */ + +#include +#include + +#endif /* !_SYS_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/sys/unistd.h b/lib/libc/include/any-macos.13-any/sys/unistd.h new file mode 100644 index 0000000000..78c93998f7 --- /dev/null +++ b/lib/libc/include/any-macos.13-any/sys/unistd.h @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2000-2013 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)unistd.h 8.2 (Berkeley) 1/7/94 + */ + +#ifndef _SYS_UNISTD_H_ +#define _SYS_UNISTD_H_ + +#include + +/* + * Although we have saved user/group IDs, we do not use them in setuid + * as described in POSIX 1003.1, because the feature does not work for + * root. We use the saved IDs in seteuid/setegid, which are not currently + * part of the POSIX 1003.1 specification. + */ +#ifdef _NOT_AVAILABLE +#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ +#endif + +#define _POSIX_VERSION 200112L +#define _POSIX2_VERSION 200112L + +/* execution-time symbolic constants */ +/* may disable terminal special characters */ +#include + +#define _POSIX_THREAD_KEYS_MAX 128 + +/* access function */ +#define F_OK 0 /* test for existence of file */ +#define X_OK (1<<0) /* test for execute or search permission */ +#define W_OK (1<<1) /* test for write permission */ +#define R_OK (1<<2) /* test for read permission */ + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +/* + * Extended access functions. + * Note that we depend on these matching the definitions in sys/kauth.h, + * but with the bits shifted left by 8. + */ +#define _READ_OK (1<<9) /* read file data / read directory */ +#define _WRITE_OK (1<<10) /* write file data / add file to directory */ +#define _EXECUTE_OK (1<<11) /* execute file / search in directory*/ +#define _DELETE_OK (1<<12) /* delete file / delete directory */ +#define _APPEND_OK (1<<13) /* append to file / add subdirectory to directory */ +#define _RMFILE_OK (1<<14) /* - / remove file from directory */ +#define _RATTR_OK (1<<15) /* read basic attributes */ +#define _WATTR_OK (1<<16) /* write basic attributes */ +#define _REXT_OK (1<<17) /* read extended attributes */ +#define _WEXT_OK (1<<18) /* write extended attributes */ +#define _RPERM_OK (1<<19) /* read permissions */ +#define _WPERM_OK (1<<20) /* write permissions */ +#define _CHOWN_OK (1<<21) /* change ownership */ + +#define _ACCESS_EXTENDED_MASK (_READ_OK | _WRITE_OK | _EXECUTE_OK | \ + _DELETE_OK | _APPEND_OK | \ + _RMFILE_OK | _REXT_OK | \ + _WEXT_OK | _RATTR_OK | _WATTR_OK | _RPERM_OK | \ + _WPERM_OK | _CHOWN_OK) +#endif + +/* whence values for lseek(2) */ +#include + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +/* whence values for lseek(2); renamed by POSIX 1003.1 */ +#define L_SET SEEK_SET +#define L_INCR SEEK_CUR +#define L_XTND SEEK_END +#endif + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +struct accessx_descriptor { + unsigned int ad_name_offset; + int ad_flags; + int ad_pad[2]; +}; +#define ACCESSX_MAX_DESCRIPTORS 100 +#define ACCESSX_MAX_TABLESIZE (16 * 1024) +#endif + +/* configurable pathname variables */ +#define _PC_LINK_MAX 1 +#define _PC_MAX_CANON 2 +#define _PC_MAX_INPUT 3 +#define _PC_NAME_MAX 4 +#define _PC_PATH_MAX 5 +#define _PC_PIPE_BUF 6 +#define _PC_CHOWN_RESTRICTED 7 +#define _PC_NO_TRUNC 8 +#define _PC_VDISABLE 9 + +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) +#define _PC_NAME_CHARS_MAX 10 +#define _PC_CASE_SENSITIVE 11 +#define _PC_CASE_PRESERVING 12 +#define _PC_EXTENDED_SECURITY_NP 13 +#define _PC_AUTH_OPAQUE_NP 14 +#endif + +#define _PC_2_SYMLINKS 15 /* Symlink supported in directory */ +#define _PC_ALLOC_SIZE_MIN 16 /* Minimum storage actually allocated */ +#define _PC_ASYNC_IO 17 /* Async I/O [AIO] supported? */ +#define _PC_FILESIZEBITS 18 /* # of bits to represent file size */ +#define _PC_PRIO_IO 19 /* Priority I/O [PIO] supported? */ +#define _PC_REC_INCR_XFER_SIZE 20 /* Recommended increment for next two */ +#define _PC_REC_MAX_XFER_SIZE 21 /* Recommended max file transfer size */ +#define _PC_REC_MIN_XFER_SIZE 22 /* Recommended min file transfer size */ +#define _PC_REC_XFER_ALIGN 23 /* Recommended buffer alignment */ +#define _PC_SYMLINK_MAX 24 /* Max # of bytes in symlink name */ +#define _PC_SYNC_IO 25 /* Sync I/O [SIO] supported? */ +#define _PC_XATTR_SIZE_BITS 26 /* # of bits to represent maximum xattr size */ +#define _PC_MIN_HOLE_SIZE 27 /* Recommended minimum hole size for sparse files */ + +/* configurable system strings */ +#define _CS_PATH 1 + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL + +#include +#include +#include +#include <_types/_uint64_t.h> +#include <_types/_uint32_t.h> +#include + +__BEGIN_DECLS + +int getattrlistbulk(int, void *, void *, size_t, uint64_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +int getattrlistat(int, const char *, void *, void *, size_t, unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +int setattrlistat(int, const char *, void *, void *, size_t, uint32_t) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); +ssize_t freadlink(int, char * __restrict, size_t) __API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)); + +__END_DECLS + +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + +#if __DARWIN_C_LEVEL >= 200809L + +#include +#include +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +int faccessat(int, const char *, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +int fchownat(int, const char *, uid_t, gid_t, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +int linkat(int, const char *, int, const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +ssize_t readlinkat(int, const char *, char *, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +int symlinkat(const char *, int, const char *) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); +int unlinkat(int, const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); + +__END_DECLS + +#endif /* __DARWIN_C_LEVEL >= 200809L */ + +#endif /* !_SYS_UNISTD_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/xpc/base.h b/lib/libc/include/any-macos.13-any/xpc/base.h similarity index 83% rename from lib/libc/include/x86_64-macos.10-none/xpc/base.h rename to lib/libc/include/any-macos.13-any/xpc/base.h index 8fce33a1d4..34687cb583 100644 --- a/lib/libc/include/x86_64-macos.10-none/xpc/base.h +++ b/lib/libc/include/any-macos.13-any/xpc/base.h @@ -29,6 +29,8 @@ __BEGIN_DECLS #include #endif // __has_include() +#include + #ifndef __XPC_INDIRECT__ #error "Please #include instead of this file directly." #endif // __XPC_INDIRECT__ @@ -83,7 +85,10 @@ __BEGIN_DECLS #define XPC_DEPRECATED(m) __attribute__((deprecated(m))) #else // __clang__ #define XPC_DEPRECATED(m) __attribute__((deprecated)) -#endif // __clang +#endif // __clang +#ifndef XPC_TESTEXPORT +#define XPC_TESTEXPORT XPC_NOEXPORT +#endif // XPC_TESTEXPORT #if defined(__XPC_TEST__) && __XPC_TEST__ #define XPC_TESTSTATIC @@ -190,6 +195,28 @@ __BEGIN_DECLS #define XPC_NONNULL_ARRAY #endif +#if defined(__has_ptrcheck) && __has_ptrcheck +#define XPC_PTR_ASSUMES_SINGLE __ptrcheck_abi_assume_single() +#define XPC_SINGLE __single +#define XPC_UNSAFE_INDEXABLE __unsafe_indexable +#define XPC_CSTRING XPC_UNSAFE_INDEXABLE +#define XPC_SIZEDBY(N) __sized_by(N) +#define XPC_COUNTEDBY(N) __counted_by(N) +#define XPC_UNSAFE_FORGE_SIZED_BY(_type, _ptr, _size) \ + __unsafe_forge_bidi_indexable(_type, _ptr, _size) +#define XPC_UNSAFE_FORGE_SINGLE(_type, _ptr) \ + __unsafe_forge_single(_type, _ptr) +#else // defined(__has_ptrcheck) ** __has_ptrcheck +#define XPC_PTR_ASSUMES_SINGLE +#define XPC_SINGLE +#define XPC_UNSAFE_INDEXABLE +#define XPC_CSTRING +#define XPC_SIZEDBY(N) +#define XPC_COUNTEDBY(N) +#define XPC_UNSAFE_FORGE_SIZED_BY(_type, _ptr, _size) ((_type)(_ptr)) +#define XPC_UNSAFE_FORGE_SINGLE(_type, _ptr) ((_type)(_ptr)) +#endif // defined(__has_ptrcheck) ** __has_ptrcheck + #ifdef OS_CLOSED_OPTIONS #define XPC_FLAGS_ENUM(_name, _type, ...) \ OS_CLOSED_OPTIONS(_name, _type, __VA_ARGS__) @@ -206,6 +233,12 @@ __BEGIN_DECLS OS_ENUM(_name, _type, __VA_ARGS__) #endif // OS_CLOSED_ENUM +#if __has_attribute(swift_name) +# define XPC_SWIFT_NAME(_name) __attribute__((swift_name(_name))) +#else +# define XPC_SWIFT_NAME(_name) // __has_attribute(swift_name) +#endif + __END_DECLS #endif // __XPC_BASE_H__ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/xpc/connection.h b/lib/libc/include/any-macos.13-any/xpc/connection.h similarity index 92% rename from lib/libc/include/x86_64-macos.10-none/xpc/connection.h rename to lib/libc/include/any-macos.13-any/xpc/connection.h index 7a6ac1a2f9..ac89af4e45 100644 --- a/lib/libc/include/x86_64-macos.10-none/xpc/connection.h +++ b/lib/libc/include/any-macos.13-any/xpc/connection.h @@ -79,6 +79,20 @@ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT const struct _xpc_dictionary_s _xpc_error_termination_imminent; +/*! + * @constant XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT + * On macOS, this error will be delivered to a peer connection's event handler + * when the XPC runtime has detected that a peer connection does not + * satisfy the code signing requirement specified for the connection. + * + * See {@link xpc_connection_set_peer_code_signing_requirement} + */ +#define XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT \ + XPC_GLOBAL_OBJECT(_xpc_error_peer_code_signing_requirement) +__API_AVAILABLE(macos(12.0)) +XPC_EXPORT +const struct _xpc_dictionary_s _xpc_error_peer_code_signing_requirement; + /*! * @constant XPC_CONNECTION_MACH_SERVICE_LISTENER * Passed to xpc_connection_create_mach_service(). This flag indicates that the @@ -243,7 +257,7 @@ xpc_connection_create_from_endpoint(xpc_endpoint_t endpoint); * * Despite this seeming inconsistency, the XPC runtime guarantees that, when the * target queue is a serial queue, the event handler block will execute - * synchonously with respect to other blocks submitted to that same queue. When + * synchronously with respect to other blocks submitted to that same queue. When * the target queue is a concurrent queue, the event handler block may run * concurrently with other blocks submitted to that queue, but it will never run * concurrently with other invocations of itself for the same connection, as @@ -507,7 +521,7 @@ xpc_connection_send_barrier(xpc_connection_t connection, * @discussion * If the given GCD queue is a concurrent queue, XPC cannot guarantee that there * will not be multiple reply handlers being invoked concurrently. XPC does not - * guarantee any ordering for the invocation of reply handers. So if multiple + * guarantee any ordering for the invocation of reply handlers. So if multiple * messages are waiting for replies and the connection goes invalid, there is no * guarantee that the reply handlers will be invoked in FIFO order. Similarly, * XPC does not guarantee that reply handlers will not run concurrently with @@ -542,10 +556,11 @@ xpc_connection_send_message_with_reply(xpc_connection_t connection, * You are responsible for releasing the returned object. * * @discussion - * This API is primarily for transitional purposes. Its implementation is - * conceptually equivalent to calling xpc_connection_send_message_with_reply() - * and then immediately blocking the calling thread on a semaphore and - * signaling the semaphore from the reply block. + * This API supports priority inversion avoidance, and should be used instead of + * combining xpc_connection_send_message_with_reply() with a semaphore. + * + * Invoking this API from a queue that is a part of the target queue hierarchy + * results in deadlocks under certain conditions. * * Be judicious about your use of this API. It can block indefinitely, so if you * are using it to implement an API that can be called from the main thread, you @@ -741,6 +756,40 @@ void xpc_connection_set_finalizer_f(xpc_connection_t connection, xpc_finalizer_t _Nullable finalizer); +/*! + * @function xpc_connection_set_peer_code_signing_requirement + * Requires that the connection peer satisfies a code signing requirement. + * + * @param connection + * The connection object which is to be modified. + * + * @param requirement + * The code signing requirement to be satisfied by the peer + * It is safe to deallocate the requirement string after calling `xpc_connection_set_peer_code_signing_requirement` + * + * @result + * 0 on success, non-zero on error + * + * @discussion + * This function will return an error promptly if the code signing requirement string is invalid. + * + * It is a programming error to call `xpc_connection_set_peer_code_signing_requirement` more than once per connection. + * + * All messages received on this connection will be checked to ensure they come from a peer who satisfies + * the code signing requirement. For a listener connection, requests that do not satisfy the requirement + * are dropped. When a reply is expected on the connection and the peer does not satisfy the requirement + * XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT will be delivered instead of the reply. + * + * This API is not supported on embedded platforms and will return ENOTSUP. + * + * @see https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html + */ +__API_AVAILABLE(macos(12.0)) +XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT +int +xpc_connection_set_peer_code_signing_requirement(xpc_connection_t connection, const char *requirement); + + __END_DECLS XPC_ASSUME_NONNULL_END diff --git a/lib/libc/include/any-macos.13-any/xpc/rich_error.h b/lib/libc/include/any-macos.13-any/xpc/rich_error.h new file mode 100644 index 0000000000..bea5c9a19f --- /dev/null +++ b/lib/libc/include/any-macos.13-any/xpc/rich_error.h @@ -0,0 +1,52 @@ +#ifndef __XPC_RICH_ERROR_H__ +#define __XPC_RICH_ERROR_H__ + +#ifndef __XPC_INDIRECT__ +#error "Please #include instead of this file directly." +// For HeaderDoc. +#include +#endif // __XPC_INDIRECT__ + +#ifndef __BLOCKS__ +#error "XPC Rich Errors require Blocks support." +#endif // __BLOCKS__ + +XPC_ASSUME_NONNULL_BEGIN +__BEGIN_DECLS + +#pragma mark Properties +/*! + * @function xpc_rich_error_copy_description + * Copy the string description of an error. + * + * @param error + * The error to be examined. + * + * @result + * The underlying C string for the provided error. This string should be + * disposed of with free(3) when done. + * + * This will return NULL if a string description could not be generated. + */ +XPC_EXPORT XPC_WARN_RESULT +char * _Nullable +xpc_rich_error_copy_description(xpc_rich_error_t error); + +/*! + * @function xpc_rich_error_can_retry + * Whether the operation the error originated from can be retried. + * + * @param error + * The error to be inspected. + * + * @result + * Whether the operation the error originated from can be retried. + */ +XPC_EXPORT XPC_WARN_RESULT +bool +xpc_rich_error_can_retry(xpc_rich_error_t error); + +__END_DECLS +XPC_ASSUME_NONNULL_END + +#endif // __XPC_RICH_ERROR_H__ \ No newline at end of file diff --git a/lib/libc/include/any-macos.13-any/xpc/session.h b/lib/libc/include/any-macos.13-any/xpc/session.h new file mode 100644 index 0000000000..82885546ff --- /dev/null +++ b/lib/libc/include/any-macos.13-any/xpc/session.h @@ -0,0 +1,346 @@ +#ifndef __XPC_SESSION_H__ +#define __XPC_SESSION_H__ + +#ifndef __XPC_INDIRECT__ +#error "Please #include instead of this file directly." +// For HeaderDoc. +#include +#endif // __XPC_INDIRECT__ + +#ifndef __BLOCKS__ +#error "XPC Session require Blocks support." +#endif // __BLOCKS__ + +XPC_ASSUME_NONNULL_BEGIN +__BEGIN_DECLS + +#pragma mark Constants +/*! + * @typedef xpc_session_create_flags_t + * Constants representing different options available when creating an XPC + * Session. + * + * @const XPC_SESSION_CREATE_INACTIVE + * Indicates that the session should not be activated during its creation. The + * returned session must be manually activated using + * {@link xpc_session_activate} before it can be used. + * + * @const XPC_SESSION_CREATE_MACH_PRIVILEGED + * Passed to {@link xpc_session_create_mach_service} to indicate that the job + * advertising the service name in its launchd.plist(5) should be in the + * privileged Mach bootstrap. This is typically accomplished by placing your + * launchd.plist(5) in /Library/LaunchDaemons. + */ +XPC_FLAGS_ENUM(xpc_session_create_flags, uint64_t, + XPC_SESSION_CREATE_NONE XPC_SWIFT_NAME("none") = 0, + XPC_SESSION_CREATE_INACTIVE XPC_SWIFT_NAME("inactive") = (1 << 0), + XPC_SESSION_CREATE_MACH_PRIVILEGED XPC_SWIFT_NAME("privileged") = (1 << 1) +); + +#pragma mark Handlers +typedef void (^xpc_session_cancel_handler_t)(xpc_rich_error_t error); +typedef void (^xpc_session_incoming_message_handler_t)(xpc_object_t message); +typedef void (^xpc_session_reply_handler_t)(xpc_object_t _Nullable reply, + xpc_rich_error_t _Nullable error); + +#pragma mark Helpers +/*! + * @function xpc_session_copy_description + * Copy the string description of the session. + * + * @param session + * The session to be examined. + * + * @result + * The underlying C string description for the provided session. This string + * should be disposed of with free(3) when done. This will return NULL if a + * string description could not be generated. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT XPC_WARN_RESULT +char * _Nullable +xpc_session_copy_description(xpc_session_t session); + +#pragma mark Client Session Creation +/*! + * @function xpc_session_create_xpc_service + * Creates a new session object representing a connection to the named service. + * + * @param name + * The name of the service to create a session with. + * + * @param target_queue + * The GCD queue onto which session events will be submitted. This may be a + * concurrent queue. This parameter may be NULL, in which case the target queue + * will be libdispatch's default target queue, defined as + * DISPATCH_TARGET_QUEUE_DEFAULT. + * + * @param flags + * Additional attributes which which to create the session. + * + * @param error_out + * An out-parameter that, if set and in the event of an error, will point to an + * {@link xpc_rich_error_t} describing the details of any errors that occurred. + * + * @result + * On success this returns a new session object. The returned session is + * activated by default and can be used to send messages. The caller is + * responsible for disposing of the returned object with {@link xpc_release} + * when it is no longer needed. On failure this will return NULL and if set, + * error_out will be set to an error describing the failure. + * + * @discussion + * This will fail if the specified XPC service is either not found or is + * unavailable. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT +xpc_session_t _Nullable +xpc_session_create_xpc_service(const char *name, + dispatch_queue_t _Nullable target_queue, + xpc_session_create_flags_t flags, + xpc_rich_error_t _Nullable * _Nullable error_out); + +/*! + * @function xpc_session_create_mach_service + * Creates a session with the service defined by the provided Mach service name. + * + * @param mach_service + * The Mach service to create a session with. The service name must exist in the + * Mach bootstrap that is accessible to the process and be advertised in a + * launchd.plist. + * + * @param target_queue + * The GCD queue onto which session events will be submitted. This may be a + * concurrent queue. This parameter may be NULL, in which case the target queue + * will be libdispatch's default target queue, defined as + * DISPATCH_TARGET_QUEUE_DEFAULT. + * + * @param flags + * Additional attributes which which to create the session. + * + * @param error_out + * An out-parameter that, if set and in the event of an error, will point to an + * {@link xpc_rich_error_t} describing the details of any errors that occurred. + * + * @param cancel_handler + * The cancel handler block that will be executed when this session is canceled. + * + * @result + * On success this returns a new session object. The returned session is + * activated by default and can be used to send messages. The caller is + * responsible for disposing of the returned object with {@link xpc_release} + * when it is no longer needed. On failure this will return NULL and if set, + * error_out will be set to an error describing the failure. + * + * @discussion + * This will fail if the specified Mach service is either not found in the + * bootstrap or is otherwise unavailable. + * + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT +xpc_session_t _Nullable +xpc_session_create_mach_service(const char *mach_service, + dispatch_queue_t _Nullable target_queue, + xpc_session_create_flags_t flags, + xpc_rich_error_t _Nullable * _Nullable error_out); + +#pragma mark Session Configuration +/*! + * @function xpc_session_set_incoming_message_handler + * Set an incoming message handler for a session. + * + * @param session + * The session to set the handler for. + * + * @param handler + * The handler block to be called when a message originated by the peer is + * received through the provided session. + * + * @discussion + * This can only be called on an inactive session. Calling this on a session + * with an existing event handler will replace it. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT +void +xpc_session_set_incoming_message_handler(xpc_session_t session, + xpc_session_incoming_message_handler_t handler); + +/*! + * @function xpc_session_set_cancel_handler + * Set the cancel handler for a session. + * + * @param session + * The session to set the cancel handler for. + * + * @param cancel_handler + * The cancel handler block that will be executed when this session is canceled. + * + * @discussion + * This can only be called on an inactive session. Calling this on a session + * with an existing cancel handler will replace the existing cancel handler with + * the one provided. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT +void +xpc_session_set_cancel_handler(xpc_session_t session, + xpc_session_cancel_handler_t cancel_handler); + +#pragma mark Lifecycle +/*! + * @function xpc_session_activate + * Activates a session. + * + * @param session + * The session object to activate. + * + * @param error_out + * An out-parameter that, if set and in the event of an error, will point to an + * {@link xpc_rich_error_t} describing the details of any errors that occurred. + * + * @result + * Returns whether session activation succeeded. + * + * @discussion + * xpc_session_activate must not be called on a session that has been already + * activated. Releasing the last reference on an inactive session that was + * created with an xpc_session_create*() is undefined. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT +bool +xpc_session_activate(xpc_session_t session, + xpc_rich_error_t _Nullable * _Nullable error_out); + +/*! + * @function xpc_session_cancel + * Cancels the session. After this call, any messages that have not yet been + * sent will be discarded, and the connection will be unwound. If there are + * messages that are awaiting replies, they will have their reply handlers + * invoked with an appropriate {@link xpc_rich_error_t}. + * + * @param session + * The session object to cancel. + * + * @discussion + * Session must have been activated to be canceled. Cancellation is asynchronous + * and non-preemptive. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT +void +xpc_session_cancel(xpc_session_t session); + +#pragma mark Message Send +/*! + * @function xpc_session_send_message + * Sends a message over the session to the destination service. + * + * @param session + * The session to send the message over. + * + * @param message + * The message to send. This must be a dictionary object. + * + * @result + * In the event of an error this will return an {@link xpc_rich_error_t} + * detailing the reasons for the failure. On success this return value will be + * NULL. + * + * @discussion + * Messages are delivered in FIFO order. This API is safe to call from multiple + * GCD queues. There is no indication that a message was delivered successfully. + * This is because even once the message has been successfully enqueued on the + * remote end, there are no guarantees about when the runtime will dequeue the + * message and invoke the other session's event handler block. + * + * If this is invoked on an inactive session, one created using the + * XPC_SESSION_CREATE_INACTIVE flag and hasn't yet been activated, the process + * will crash. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT +xpc_rich_error_t _Nullable +xpc_session_send_message(xpc_session_t session, xpc_object_t message); + +/*! + * @function xpc_session_send_message_with_reply_sync + * Sends a message over the session to the destination service and blocks the + * caller until a reply is received. + * + * @param session + * The session over which the message will be sent. + * + * @param message + * The message to send. This must be a dictionary object. + * + * @param error_out + * If this parameter is provided, in the event of a failure it will point to an + * {@link xpc_rich_error_t} describing the details of the error. + * + * @result + * On success, this will return the reply message as an {@link xpc_object_t}. + * Otherwise NULL is returned. + * + * @discussion + * This API supports priority inversion avoidance and should be used instead of + * combining xpc_session_send_message_with_reply_async with a semaphore. + * + * If this is invoked on an inactive session, for example one created using the + * XPC_SESSION_CREATE_INACTIVE flag that hasn't yet been activated, the process + * will crash. + * + * Invoking this API while the target queue is blocked would lead to deadlocks + * in certain scenarios. For that reason, invoking it from the target queue + * results in a crash. + * + * Be judicious about your use of this API. It can block indefinitely, so if you + * are using it to implement an API that can be called from the main queue, you + * may wish to consider allowing the API to take a queue and callback block so + * that results may be delivered asynchronously if possible. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT +xpc_object_t _Nullable +xpc_session_send_message_with_reply_sync(xpc_session_t session, + xpc_object_t message, xpc_rich_error_t _Nullable * _Nullable error_out); + +/*! + * @function xpc_session_send_message_with_reply_async + * Sends a message over the session to the destination service and executes the + * provided callback when a reply is received. + * + * @param session + * The session over which the message will be sent. + * + * @param message + * The message to send. This must be a dictionary object. + * + * @param reply_handler + * The handler block to invoke when a reply to the message is received from the + * session. If the session is torn down before the reply was received, for + * example if the remote service exits prematurely, this handler will be + * executed and passed an appropriate {@link xpc_rich_error_t} object describing + * the failure. + * + * @discussion + * If this is invoked on an inactive session, for example one created using the + * XPC_SESSION_CREATE_INACTIVE flag that hasn't yet been activated, the process + * will crash. + * + * If this is invoked on a cancelled session, this will generate a simulated + * crash. + */ +API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +XPC_EXPORT +void +xpc_session_send_message_with_reply_async(xpc_session_t session, + xpc_object_t message, xpc_session_reply_handler_t reply_handler); + +__END_DECLS +XPC_ASSUME_NONNULL_END + +#endif // __XPC_SESSION_H__ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/xpc/xpc.h b/lib/libc/include/any-macos.13-any/xpc/xpc.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/xpc/xpc.h rename to lib/libc/include/any-macos.13-any/xpc/xpc.h index cb6cbb3997..af3f49853e 100644 --- a/lib/libc/include/x86_64-macos.10-none/xpc/xpc.h +++ b/lib/libc/include/any-macos.13-any/xpc/xpc.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2011 Apple Inc. All rights reserved. +// Copyright (c) 2009-2020 Apple Inc. All rights reserved. #ifndef __XPC_H__ #define __XPC_H__ @@ -37,7 +37,7 @@ __BEGIN_DECLS #define __OSX_AVAILABLE_STARTING(x, y) #endif // __OSX_AVAILABLE_STARTING -#define XPC_API_VERSION 20121012 +#define XPC_API_VERSION 20200610 /*! * @typedef xpc_type_t @@ -76,8 +76,7 @@ OS_OBJECT_DECL(xpc_object); XPC_INLINE XPC_NONNULL_ALL void _xpc_object_validate(xpc_object_t object) { - void *isa = *(void * volatile *)(OS_OBJECT_BRIDGE void *)object; - (void)isa; + (void)*(unsigned long volatile *)(OS_OBJECT_BRIDGE void *)object; } #else // OS_OBJECT_USE_OBJC typedef void * xpc_object_t; @@ -211,7 +210,7 @@ XPC_TYPE(_xpc_type_double); /*! * @define XPC_TYPE_DATE -* A type representing a date interval. The interval is with respect to the + * A type representing a date interval. The interval is with respect to the * Unix epoch. XPC dates are in Unix time and are thus unaware of local time * or leap seconds. */ @@ -326,13 +325,44 @@ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT const char * const _xpc_event_key_name; +/*! + * @define XPC_TYPE_SESSION + * + * @discussion + * Sessions represent a stateful connection between a client and a service. When either end of the connection + * disconnects, the entire session will be invalidated. In this case the system will make no attempt to + * reestablish the connection or relaunch the service. + * + * Clients can initiate a session with a service that accepts xpc_connection_t connections but session + * semantics will be maintained. + * + */ +#define XPC_TYPE_SESSION (&_xpc_type_session) +XPC_EXPORT +XPC_TYPE(_xpc_type_session); +XPC_DECL(xpc_session); + +/*! + * @define XPC_TYPE_RICH_ERROR + * + * @discussion + * Rich errors provide a simple dynamic error type that can indicate whether an + * error is retry-able or not. + */ +#define XPC_TYPE_RICH_ERROR (&_xpc_type_rich_error) +XPC_EXPORT +XPC_TYPE(_xpc_type_rich_error); +XPC_DECL(xpc_rich_error); + XPC_ASSUME_NONNULL_END #if !defined(__XPC_BUILDING_XPC__) || !__XPC_BUILDING_XPC__ #include #include #if __BLOCKS__ -#include #include +#include +#include +#include #endif // __BLOCKS__ #undef __XPC_INDIRECT__ #include @@ -758,7 +788,7 @@ xpc_date_get_value(xpc_object_t xdate); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t -xpc_data_create(const void * _Nullable bytes, size_t length); +xpc_data_create(const void * _Nullable XPC_SIZEDBY(length) bytes, size_t length); /*! * @function xpc_data_create_with_dispatch_data @@ -1167,7 +1197,26 @@ typedef bool (^xpc_array_applier_t)(size_t index, xpc_object_t _Nonnull value); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t -xpc_array_create(const xpc_object_t _Nonnull * _Nullable objects, size_t count); +xpc_array_create( + const xpc_object_t _Nonnull *XPC_COUNTEDBY(count) _Nullable objects, + size_t count); + +/*! + * @function xpc_array_create_empty + * + * @abstract + * Creates an XPC object representing an array of XPC objects. + * + * @result + * A new array object. + * + * @see + * xpc_array_create + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT +xpc_object_t +xpc_array_create_empty(void); /*! * @function xpc_array_set_value @@ -1441,8 +1490,8 @@ xpc_array_set_date(xpc_object_t xarray, size_t index, int64_t value); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL1 XPC_NONNULL3 void -xpc_array_set_data(xpc_object_t xarray, size_t index, const void *bytes, - size_t length); +xpc_array_set_data(xpc_object_t xarray, size_t index, + const void *XPC_SIZEDBY(length) bytes, size_t length); /*! * @function xpc_array_set_string @@ -1895,8 +1944,27 @@ typedef bool (^xpc_dictionary_applier_t)(const char * _Nonnull key, __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t -xpc_dictionary_create(const char * _Nonnull const * _Nullable keys, - const xpc_object_t _Nullable * _Nullable values, size_t count); +xpc_dictionary_create( + const char *XPC_CSTRING _Nonnull const *XPC_COUNTEDBY(count) _Nullable keys, + const xpc_object_t _Nullable *XPC_COUNTEDBY(count) _Nullable values, size_t count); + +/*! + * @function xpc_dictionary_create_empty + * + * @abstract + * Creates an XPC object representing a dictionary of XPC objects keyed to + * C-strings. + * + * @result + * The new dictionary object. + * + * @see + * xpc_dictionary_create + */ +API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) +XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT +xpc_object_t +xpc_dictionary_create_empty(void); /*! * @function xpc_dictionary_create_reply @@ -2176,8 +2244,8 @@ xpc_dictionary_set_date(xpc_object_t xdict, const char *key, int64_t value); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 XPC_NONNULL3 void -xpc_dictionary_set_data(xpc_object_t xdict, const char *key, const void *bytes, - size_t length); +xpc_dictionary_set_data(xpc_object_t xdict, const char *key, + const void *XPC_SIZEDBY(length) bytes, size_t length); /*! * @function xpc_dictionary_set_string @@ -2589,7 +2657,7 @@ xpc_main(xpc_connection_handler_t handler); * * The XPC runtime will automatically begin a transaction on behalf of a service * when a new message is received. If no reply message is expected, the - * transaction is automatically ended when the connection event handler returns. + * transaction is automatically ended when the last reference to the message is released. * If a reply message is created, the transaction will end when the reply * message is sent or released. An XPC service may use xpc_transaction_begin() * and xpc_transaction_end() to inform the XPC runtime about activity that @@ -2648,6 +2716,10 @@ xpc_transaction_end(void); * @discussion * Multiple calls to this function for the same event stream will result in * undefined behavior. + * + * There is no API to pause delivery of XPC events. If a process that + * has set an XPC event handler exits, events may be dropped due to races + * between the event handler running and the process exiting. */ #if __BLOCKS__ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) diff --git a/lib/libc/include/x86_64-macos.10-none/AssertMacros.h b/lib/libc/include/x86_64-macos.10-none/AssertMacros.h deleted file mode 100644 index 7dc2e589af..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/AssertMacros.h +++ /dev/null @@ -1,1441 +0,0 @@ -/* - * Copyright (c) 2002-2017 by Apple Inc.. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - -/* - File: AssertMacros.h - - Contains: This file defines structured error handling and assertion macros for - programming in C. Originally used in QuickDraw GX and later enhanced. - These macros are used throughout Apple's software. - - New code may not want to begin adopting these macros and instead use - existing language functionality. - - See "Living In an Exceptional World" by Sean Parent - (develop, The Apple Technical Journal, Issue 11, August/September 1992) - or - - for the methodology behind these error handling and assertion macros. - - Bugs?: For bug reports, consult the following page on - the World Wide Web: - - http://developer.apple.com/bugreporter/ -*/ -#ifndef __ASSERTMACROS__ -#define __ASSERTMACROS__ - -#ifdef DEBUG_ASSERT_CONFIG_INCLUDE - #include DEBUG_ASSERT_CONFIG_INCLUDE -#endif - -/* - * Macro overview: - * - * check(assertion) - * In production builds, pre-processed away - * In debug builds, if assertion evaluates to false, calls DEBUG_ASSERT_MESSAGE - * - * verify(assertion) - * In production builds, evaluates assertion and does nothing - * In debug builds, if assertion evaluates to false, calls DEBUG_ASSERT_MESSAGE - * - * require(assertion, exceptionLabel) - * In production builds, if the assertion expression evaluates to false, goto exceptionLabel - * In debug builds, if the assertion expression evaluates to false, calls DEBUG_ASSERT_MESSAGE - * and jumps to exceptionLabel - * - * In addition the following suffixes are available: - * - * _noerr Adds "!= 0" to assertion. Useful for asserting and OSStatus or OSErr is noErr (zero) - * _action Adds statement to be executued if assertion fails - * _quiet Suppress call to DEBUG_ASSERT_MESSAGE - * _string Allows you to add explanitory message to DEBUG_ASSERT_MESSAGE - * - * For instance, require_noerr_string(resultCode, label, msg) will do nothing if - * resultCode is zero, otherwise it will call DEBUG_ASSERT_MESSAGE with msg - * and jump to label. - * - * Configuration: - * - * By default all macros generate "production code" (i.e non-debug). If - * DEBUG_ASSERT_PRODUCTION_CODE is defined to zero or DEBUG is defined to non-zero - * while this header is included, the macros will generated debug code. - * - * If DEBUG_ASSERT_COMPONENT_NAME_STRING is defined, all debug messages will - * be prefixed with it. - * - * By default, all messages write to stderr. If you would like to write a custom - * error message formater, defined DEBUG_ASSERT_MESSAGE to your function name. - * - * Each individual macro will only be defined if it is not already defined, so - * you can redefine their behavior singly by providing your own definition before - * this file is included. - * - * If you define __ASSERTMACROS__ before this file is included, then nothing in - * this file will take effect. - * - * Prior to Mac OS X 10.6 the macro names used in this file conflicted with some - * user code, including libraries in boost and the proposed C++ standards efforts, - * and there was no way for a client of this header to resolve this conflict. Because - * of this, most of the macros have been changed so that they are prefixed with - * __ and contain at least one capital letter, which should alleviate the current - * and future conflicts. However, to allow current sources to continue to compile, - * compatibility macros are defined at the end with the old names. A tops script - * at the end of this file will convert all of the old macro names used in a directory - * to the new names. Clients are recommended to migrate over to these new macros as - * they update their sources because a future release of Mac OS X will remove the - * old macro definitions ( without the double-underscore prefix ). Clients who - * want to compile without the old macro definitions can define the macro - * __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES to 0 before this file is - * included. - */ - - -/* - * Before including this file, #define DEBUG_ASSERT_COMPONENT_NAME_STRING to - * a C-string containing the name of your client. This string will be passed to - * the DEBUG_ASSERT_MESSAGE macro for inclusion in any assertion messages. - * - * If you do not define DEBUG_ASSERT_COMPONENT_NAME_STRING, the default - * DEBUG_ASSERT_COMPONENT_NAME_STRING value, an empty string, will be used by - * the assertion macros. - */ -#ifndef DEBUG_ASSERT_COMPONENT_NAME_STRING - #define DEBUG_ASSERT_COMPONENT_NAME_STRING "" -#endif - - -/* - * To activate the additional assertion code and messages for non-production builds, - * #define DEBUG_ASSERT_PRODUCTION_CODE to zero before including this file. - * - * If you do not define DEBUG_ASSERT_PRODUCTION_CODE, the default value 1 will be used - * (production code = no assertion code and no messages). - */ -#ifndef DEBUG_ASSERT_PRODUCTION_CODE - #define DEBUG_ASSERT_PRODUCTION_CODE !DEBUG -#endif - - -/* - * DEBUG_ASSERT_MESSAGE(component, assertion, label, error, file, line, errorCode) - * - * Summary: - * All assertion messages are routed through this macro. If you wish to use your - * own routine to display assertion messages, you can override DEBUG_ASSERT_MESSAGE - * by #defining DEBUG_ASSERT_MESSAGE before including this file. - * - * Parameters: - * - * componentNameString: - * A pointer to a string constant containing the name of the - * component this code is part of. This must be a string constant - * (and not a string variable or NULL) because the preprocessor - * concatenates it with other string constants. - * - * assertionString: - * A pointer to a string constant containing the assertion. - * This must be a string constant (and not a string variable or - * NULL) because the Preprocessor concatenates it with other - * string constants. - * - * exceptionLabelString: - * A pointer to a string containing the exceptionLabel, or NULL. - * - * errorString: - * A pointer to the error string, or NULL. DEBUG_ASSERT_MESSAGE macros - * must not attempt to concatenate this string with constant - * character strings. - * - * fileName: - * A pointer to the fileName or pathname (generated by the - * preprocessor __FILE__ identifier), or NULL. - * - * lineNumber: - * The line number in the file (generated by the preprocessor - * __LINE__ identifier), or 0 (zero). - * - * errorCode: - * A value associated with the assertion, or 0. - * - * Here is an example of a DEBUG_ASSERT_MESSAGE macro and a routine which displays - * assertion messsages: - * - * #define DEBUG_ASSERT_COMPONENT_NAME_STRING "MyCoolProgram" - * - * #define DEBUG_ASSERT_MESSAGE(componentNameString, assertionString, \ - * exceptionLabelString, errorString, fileName, lineNumber, errorCode) \ - * MyProgramDebugAssert(componentNameString, assertionString, \ - * exceptionLabelString, errorString, fileName, lineNumber, errorCode) - * - * static void - * MyProgramDebugAssert(const char *componentNameString, const char *assertionString, - * const char *exceptionLabelString, const char *errorString, - * const char *fileName, long lineNumber, int errorCode) - * { - * if ( (assertionString != NULL) && (*assertionString != '\0') ) - * fprintf(stderr, "Assertion failed: %s: %s\n", componentNameString, assertionString); - * else - * fprintf(stderr, "Check failed: %s:\n", componentNameString); - * if ( exceptionLabelString != NULL ) - * fprintf(stderr, " %s\n", exceptionLabelString); - * if ( errorString != NULL ) - * fprintf(stderr, " %s\n", errorString); - * if ( fileName != NULL ) - * fprintf(stderr, " file: %s\n", fileName); - * if ( lineNumber != 0 ) - * fprintf(stderr, " line: %ld\n", lineNumber); - * if ( errorCode != 0 ) - * fprintf(stderr, " error: %d\n", errorCode); - * } - * - * If you do not define DEBUG_ASSERT_MESSAGE, a simple printf to stderr will be used. - */ -#ifndef DEBUG_ASSERT_MESSAGE - #ifdef KERNEL - #include - #define DEBUG_ASSERT_MESSAGE(name, assertion, label, message, file, line, value) \ - printf( "AssertMacros: %s, %s file: %s, line: %d, value: %ld\n", assertion, (message!=0) ? message : "", file, line, (long) (value)); - #else - #include - #define DEBUG_ASSERT_MESSAGE(name, assertion, label, message, file, line, value) \ - fprintf(stderr, "AssertMacros: %s, %s file: %s, line: %d, value: %ld\n", assertion, (message!=0) ? message : "", file, line, (long) (value)); - #endif -#endif - - - - - -/* - * __Debug_String(message) - * - * Summary: - * Production builds: does nothing and produces no code. - * - * Non-production builds: call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * message: - * The C string to display. - * - */ -#ifndef __Debug_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Debug_String(message) - #else - #define __Debug_String(message) \ - do \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - "", \ - 0, \ - message, \ - __FILE__, \ - __LINE__, \ - 0); \ - } while ( 0 ) - #endif -#endif - -/* - * __Check(assertion) - * - * Summary: - * Production builds: does nothing and produces no code. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * assertion: - * The assertion expression. - */ -#ifndef __Check - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Check(assertion) - #else - #define __Check(assertion) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, 0, 0, __FILE__, __LINE__, 0 ); \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nCheck - #define __nCheck(assertion) __Check(!(assertion)) -#endif - -/* - * __Check_String(assertion, message) - * - * Summary: - * Production builds: does nothing and produces no code. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * message: - * The C string to display. - */ -#ifndef __Check_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Check_String(assertion, message) - #else - #define __Check_String(assertion, message) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, 0, message, __FILE__, __LINE__, 0 ); \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nCheck_String - #define __nCheck_String(assertion, message) __Check_String(!(assertion), message) -#endif - -/* - * __Check_noErr(errorCode) - * - * Summary: - * Production builds: does nothing and produces no code. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * errorCode: - * The errorCode expression to compare with 0. - */ -#ifndef __Check_noErr - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Check_noErr(errorCode) - #else - #define __Check_noErr(errorCode) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", 0, 0, __FILE__, __LINE__, evalOnceErrorCode ); \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Check_noErr_String(errorCode, message) - * - * Summary: - * Production builds: check_noerr_string() does nothing and produces - * no code. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * errorCode: - * The errorCode expression to compare to 0. - * - * message: - * The C string to display. - */ -#ifndef __Check_noErr_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Check_noErr_String(errorCode, message) - #else - #define __Check_noErr_String(errorCode, message) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", 0, message, __FILE__, __LINE__, evalOnceErrorCode ); \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Verify(assertion) - * - * Summary: - * Production builds: evaluate the assertion expression, but ignore - * the result. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * assertion: - * The assertion expression. - */ -#ifndef __Verify - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Verify(assertion) \ - do \ - { \ - if ( !(assertion) ) \ - { \ - } \ - } while ( 0 ) - #else - #define __Verify(assertion) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, 0, 0, __FILE__, __LINE__, 0 ); \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nVerify - #define __nVerify(assertion) __Verify(!(assertion)) -#endif - -/* - * __Verify_String(assertion, message) - * - * Summary: - * Production builds: evaluate the assertion expression, but ignore - * the result. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * message: - * The C string to display. - */ -#ifndef __Verify_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Verify_String(assertion, message) \ - do \ - { \ - if ( !(assertion) ) \ - { \ - } \ - } while ( 0 ) - #else - #define __Verify_String(assertion, message) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, 0, message, __FILE__, __LINE__, 0 ); \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nVerify_String - #define __nVerify_String(assertion, message) __Verify_String(!(assertion), message) -#endif - -/* - * __Verify_noErr(errorCode) - * - * Summary: - * Production builds: evaluate the errorCode expression, but ignore - * the result. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - */ -#ifndef __Verify_noErr - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Verify_noErr(errorCode) \ - do \ - { \ - if ( 0 != (errorCode) ) \ - { \ - } \ - } while ( 0 ) - #else - #define __Verify_noErr(errorCode) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", 0, 0, __FILE__, __LINE__, evalOnceErrorCode ); \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Verify_noErr_String(errorCode, message) - * - * Summary: - * Production builds: evaluate the errorCode expression, but ignore - * the result. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * message: - * The C string to display. - */ -#ifndef __Verify_noErr_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Verify_noErr_String(errorCode, message) \ - do \ - { \ - if ( 0 != (errorCode) ) \ - { \ - } \ - } while ( 0 ) - #else - #define __Verify_noErr_String(errorCode, message) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", 0, message, __FILE__, __LINE__, evalOnceErrorCode ); \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Verify_noErr_Action(errorCode, action) - * - * Summary: - * Production builds: if the errorCode expression does not equal 0 (noErr), - * execute the action statement or compound statement (block). - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE and then execute the action statement or compound - * statement (block). - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * action: - * The statement or compound statement (block). - */ -#ifndef __Verify_noErr_Action - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Verify_noErr_Action(errorCode, action) \ - if ( 0 != (errorCode) ) { \ - action; \ - } \ - else do {} while (0) - #else - #define __Verify_noErr_Action(errorCode, action) \ - do { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", 0, 0, __FILE__, __LINE__, evalOnceErrorCode ); \ - action; \ - } \ - } while (0) - #endif -#endif - -/* - * __Verify_Action(assertion, action) - * - * Summary: - * Production builds: if the assertion expression evaluates to false, - * then execute the action statement or compound statement (block). - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE and then execute the action statement or compound - * statement (block). - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * action: - * The statement or compound statement (block). - */ -#ifndef __Verify_Action - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Verify_Action(assertion, action) \ - if ( __builtin_expect(!(assertion), 0) ) { \ - action; \ - } \ - else do {} while (0) - #else - #define __Verify_Action(assertion, action) \ - if ( __builtin_expect(!(assertion), 0) ) { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, 0, 0, __FILE__, __LINE__, 0 ); \ - action; \ - } \ - else do {} while (0) - #endif -#endif - -/* - * __Require(assertion, exceptionLabel) - * - * Summary: - * Production builds: if the assertion expression evaluates to false, - * goto exceptionLabel. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE and then goto exceptionLabel. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * exceptionLabel: - * The label. - */ -#ifndef __Require - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require(assertion, exceptionLabel) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require(assertion, exceptionLabel) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, #exceptionLabel, 0, __FILE__, __LINE__, 0); \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nRequire - #define __nRequire(assertion, exceptionLabel) __Require(!(assertion), exceptionLabel) -#endif - -/* - * __Require_Action(assertion, exceptionLabel, action) - * - * Summary: - * Production builds: if the assertion expression evaluates to false, - * execute the action statement or compound statement (block) and then - * goto exceptionLabel. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE, execute the action statement or compound - * statement (block), and then goto exceptionLabel. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * exceptionLabel: - * The label. - * - * action: - * The statement or compound statement (block). - */ -#ifndef __Require_Action - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require_Action(assertion, exceptionLabel, action) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require_Action(assertion, exceptionLabel, action) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, #exceptionLabel, 0, __FILE__, __LINE__, 0); \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nRequire_Action - #define __nRequire_Action(assertion, exceptionLabel, action) \ - __Require_Action(!(assertion), exceptionLabel, action) -#endif - -/* - * __Require_Quiet(assertion, exceptionLabel) - * - * Summary: - * If the assertion expression evaluates to false, goto exceptionLabel. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * exceptionLabel: - * The label. - */ -#ifndef __Require_Quiet - #define __Require_Quiet(assertion, exceptionLabel) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - goto exceptionLabel; \ - } \ - } while ( 0 ) -#endif - -#ifndef __nRequire_Quiet - #define __nRequire_Quiet(assertion, exceptionLabel) __Require_Quiet(!(assertion), exceptionLabel) -#endif - -/* - * __Require_Action_Quiet(assertion, exceptionLabel, action) - * - * Summary: - * If the assertion expression evaluates to false, execute the action - * statement or compound statement (block), and goto exceptionLabel. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * exceptionLabel: - * The label. - * - * action: - * The statement or compound statement (block). - */ -#ifndef __Require_Action_Quiet - #define __Require_Action_Quiet(assertion, exceptionLabel, action) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) -#endif - -#ifndef __nRequire_Action_Quiet - #define __nRequire_Action_Quiet(assertion, exceptionLabel, action) \ - __Require_Action_Quiet(!(assertion), exceptionLabel, action) -#endif - -/* - * __Require_String(assertion, exceptionLabel, message) - * - * Summary: - * Production builds: if the assertion expression evaluates to false, - * goto exceptionLabel. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE, and then goto exceptionLabel. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * exceptionLabel: - * The label. - * - * message: - * The C string to display. - */ -#ifndef __Require_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require_String(assertion, exceptionLabel, message) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require_String(assertion, exceptionLabel, message) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, #exceptionLabel, message, __FILE__, __LINE__, 0); \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nRequire_String - #define __nRequire_String(assertion, exceptionLabel, string) \ - __Require_String(!(assertion), exceptionLabel, string) -#endif - -/* - * __Require_Action_String(assertion, exceptionLabel, action, message) - * - * Summary: - * Production builds: if the assertion expression evaluates to false, - * execute the action statement or compound statement (block), and then - * goto exceptionLabel. - * - * Non-production builds: if the assertion expression evaluates to false, - * call DEBUG_ASSERT_MESSAGE, execute the action statement or compound - * statement (block), and then goto exceptionLabel. - * - * Parameters: - * - * assertion: - * The assertion expression. - * - * exceptionLabel: - * The label. - * - * action: - * The statement or compound statement (block). - * - * message: - * The C string to display. - */ -#ifndef __Require_Action_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require_Action_String(assertion, exceptionLabel, action, message) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require_Action_String(assertion, exceptionLabel, action, message) \ - do \ - { \ - if ( __builtin_expect(!(assertion), 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #assertion, #exceptionLabel, message, __FILE__, __LINE__, 0); \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -#ifndef __nRequire_Action_String - #define __nRequire_Action_String(assertion, exceptionLabel, action, message) \ - __Require_Action_String(!(assertion), exceptionLabel, action, message) -#endif - -/* - * __Require_noErr(errorCode, exceptionLabel) - * - * Summary: - * Production builds: if the errorCode expression does not equal 0 (noErr), - * goto exceptionLabel. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE and then goto exceptionLabel. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * exceptionLabel: - * The label. - */ -#ifndef __Require_noErr - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require_noErr(errorCode, exceptionLabel) \ - do \ - { \ - if ( __builtin_expect(0 != (errorCode), 0) ) \ - { \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require_noErr(errorCode, exceptionLabel) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", #exceptionLabel, 0, __FILE__, __LINE__, evalOnceErrorCode); \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Require_noErr_Action(errorCode, exceptionLabel, action) - * - * Summary: - * Production builds: if the errorCode expression does not equal 0 (noErr), - * execute the action statement or compound statement (block) and - * goto exceptionLabel. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE, execute the action statement or - * compound statement (block), and then goto exceptionLabel. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * exceptionLabel: - * The label. - * - * action: - * The statement or compound statement (block). - */ -#ifndef __Require_noErr_Action - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require_noErr_Action(errorCode, exceptionLabel, action) \ - do \ - { \ - if ( __builtin_expect(0 != (errorCode), 0) ) \ - { \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require_noErr_Action(errorCode, exceptionLabel, action) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", #exceptionLabel, 0, __FILE__, __LINE__, evalOnceErrorCode); \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Require_noErr_Quiet(errorCode, exceptionLabel) - * - * Summary: - * If the errorCode expression does not equal 0 (noErr), - * goto exceptionLabel. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * exceptionLabel: - * The label. - */ -#ifndef __Require_noErr_Quiet - #define __Require_noErr_Quiet(errorCode, exceptionLabel) \ - do \ - { \ - if ( __builtin_expect(0 != (errorCode), 0) ) \ - { \ - goto exceptionLabel; \ - } \ - } while ( 0 ) -#endif - -/* - * __Require_noErr_Action_Quiet(errorCode, exceptionLabel, action) - * - * Summary: - * If the errorCode expression does not equal 0 (noErr), - * execute the action statement or compound statement (block) and - * goto exceptionLabel. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * exceptionLabel: - * The label. - * - * action: - * The statement or compound statement (block). - */ -#ifndef __Require_noErr_Action_Quiet - #define __Require_noErr_Action_Quiet(errorCode, exceptionLabel, action) \ - do \ - { \ - if ( __builtin_expect(0 != (errorCode), 0) ) \ - { \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) -#endif - -/* - * __Require_noErr_String(errorCode, exceptionLabel, message) - * - * Summary: - * Production builds: if the errorCode expression does not equal 0 (noErr), - * goto exceptionLabel. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE, and then goto exceptionLabel. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * exceptionLabel: - * The label. - * - * message: - * The C string to display. - */ -#ifndef __Require_noErr_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require_noErr_String(errorCode, exceptionLabel, message) \ - do \ - { \ - if ( __builtin_expect(0 != (errorCode), 0) ) \ - { \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require_noErr_String(errorCode, exceptionLabel, message) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", #exceptionLabel, message, __FILE__, __LINE__, evalOnceErrorCode); \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Require_noErr_Action_String(errorCode, exceptionLabel, action, message) - * - * Summary: - * Production builds: if the errorCode expression does not equal 0 (noErr), - * execute the action statement or compound statement (block) and - * goto exceptionLabel. - * - * Non-production builds: if the errorCode expression does not equal 0 (noErr), - * call DEBUG_ASSERT_MESSAGE, execute the action statement or compound - * statement (block), and then goto exceptionLabel. - * - * Parameters: - * - * errorCode: - * The expression to compare to 0. - * - * exceptionLabel: - * The label. - * - * action: - * The statement or compound statement (block). - * - * message: - * The C string to display. - */ -#ifndef __Require_noErr_Action_String - #if DEBUG_ASSERT_PRODUCTION_CODE - #define __Require_noErr_Action_String(errorCode, exceptionLabel, action, message) \ - do \ - { \ - if ( __builtin_expect(0 != (errorCode), 0) ) \ - { \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #else - #define __Require_noErr_Action_String(errorCode, exceptionLabel, action, message) \ - do \ - { \ - long evalOnceErrorCode = (errorCode); \ - if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ - { \ - DEBUG_ASSERT_MESSAGE( \ - DEBUG_ASSERT_COMPONENT_NAME_STRING, \ - #errorCode " == 0 ", #exceptionLabel, message, __FILE__, __LINE__, evalOnceErrorCode); \ - { \ - action; \ - } \ - goto exceptionLabel; \ - } \ - } while ( 0 ) - #endif -#endif - -/* - * __Check_Compile_Time(expr) - * - * Summary: - * any build: if the expression is not true, generated a compile time error. - * - * Parameters: - * - * expr: - * The compile time expression that should evaluate to non-zero. - * - * Discussion: - * This declares an array with a size that is determined by a compile-time expression. - * If false, it declares a negatively sized array, which generates a compile-time error. - * - * Examples: - * __Check_Compile_Time( sizeof( int ) == 4 ); - * __Check_Compile_Time( offsetof( MyStruct, myField ) == 4 ); - * __Check_Compile_Time( ( kMyBufferSize % 512 ) == 0 ); - * - * Note: This only works with compile-time expressions. - * Note: This only works in places where extern declarations are allowed (e.g. global scope). - */ -#ifndef __Check_Compile_Time - #ifdef __GNUC__ - #if (__cplusplus >= 201103L) - #define __Check_Compile_Time( expr ) static_assert( expr , "__Check_Compile_Time") - #elif (__STDC_VERSION__ >= 201112L) - #define __Check_Compile_Time( expr ) _Static_assert( expr , "__Check_Compile_Time") - #else - #define __Check_Compile_Time( expr ) \ - extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ] __attribute__( ( unused ) ) - #endif - #else - #define __Check_Compile_Time( expr ) \ - extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ] - #endif -#endif - -/* - * For time immemorial, Mac OS X has defined version of most of these macros without the __ prefix, which - * could collide with similarly named functions or macros in user code, including new functionality in - * Boost and the C++ standard library. - * - * macOS High Sierra and iOS 11 will now require that clients move to the new macros as defined above. - * - * If you would like to enable the macros for use within your own project, you can define the - * __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES macro via an Xcode Build Configuration. - * See "Add a build configuration (xcconfig) file" in Xcode Help. - * - * To aid users of these macros in converting their sources, the following tops script will convert usages - * of the old macros into the new equivalents. To do so, in Terminal go into the directory containing the - * sources to be converted and run this command. - * - find -E . -regex '.*\.(c|cc|cp|cpp|m|mm|h)' -print0 | xargs -0 tops -verbose \ - replace "check()" with "__Check()" \ - replace "check_noerr()" with "__Check_noErr()" \ - replace "check_noerr_string()" with "__Check_noErr_String()" \ - replace "check_string()" with "__Check_String()" \ - replace "require()" with "__Require()" \ - replace "require_action()" with "__Require_Action()" \ - replace "require_action_string()" with "__Require_Action_String()" \ - replace "require_noerr()" with "__Require_noErr()" \ - replace "require_noerr_action()" with "__Require_noErr_Action()" \ - replace "require_noerr_action_string()" with "__Require_noErr_Action_String()" \ - replace "require_noerr_string()" with "__Require_noErr_String()" \ - replace "require_string()" with "__Require_String()" \ - replace "verify()" with "__Verify()" \ - replace "verify_action()" with "__Verify_Action()" \ - replace "verify_noerr()" with "__Verify_noErr()" \ - replace "verify_noerr_action()" with "__Verify_noErr_Action()" \ - replace "verify_noerr_string()" with "__Verify_noErr_String()" \ - replace "verify_string()" with "__Verify_String()" \ - replace "ncheck()" with "__nCheck()" \ - replace "ncheck_string()" with "__nCheck_String()" \ - replace "nrequire()" with "__nRequire()" \ - replace "nrequire_action()" with "__nRequire_Action()" \ - replace "nrequire_action_quiet()" with "__nRequire_Action_Quiet()" \ - replace "nrequire_action_string()" with "__nRequire_Action_String()" \ - replace "nrequire_quiet()" with "__nRequire_Quiet()" \ - replace "nrequire_string()" with "__nRequire_String()" \ - replace "nverify()" with "__nVerify()" \ - replace "nverify_string()" with "__nVerify_String()" \ - replace "require_action_quiet()" with "__Require_Action_Quiet()" \ - replace "require_noerr_action_quiet()" with "__Require_noErr_Action_Quiet()" \ - replace "require_noerr_quiet()" with "__Require_noErr_Quiet()" \ - replace "require_quiet()" with "__Require_Quiet()" \ - replace "check_compile_time()" with "__Check_Compile_Time()" \ - replace "debug_string()" with "__Debug_String()" - * - */ - -#ifndef __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES - #if __has_include() - #include - #else - /* In macOS High Sierra and iOS 11, if we haven't set this yet, it now defaults to off. */ - #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 - #endif -#endif - -#if __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES - - #ifndef check - #define check(assertion) __Check(assertion) - #endif - - #ifndef check_noerr - #define check_noerr(errorCode) __Check_noErr(errorCode) - #endif - - #ifndef check_noerr_string - #define check_noerr_string(errorCode, message) __Check_noErr_String(errorCode, message) - #endif - - #ifndef check_string - #define check_string(assertion, message) __Check_String(assertion, message) - #endif - - #ifndef require - #define require(assertion, exceptionLabel) __Require(assertion, exceptionLabel) - #endif - - #ifndef require_action - #define require_action(assertion, exceptionLabel, action) __Require_Action(assertion, exceptionLabel, action) - #endif - - #ifndef require_action_string - #define require_action_string(assertion, exceptionLabel, action, message) __Require_Action_String(assertion, exceptionLabel, action, message) - #endif - - #ifndef require_noerr - #define require_noerr(errorCode, exceptionLabel) __Require_noErr(errorCode, exceptionLabel) - #endif - - #ifndef require_noerr_action - #define require_noerr_action(errorCode, exceptionLabel, action) __Require_noErr_Action(errorCode, exceptionLabel, action) - #endif - - #ifndef require_noerr_action_string - #define require_noerr_action_string(errorCode, exceptionLabel, action, message) __Require_noErr_Action_String(errorCode, exceptionLabel, action, message) - #endif - - #ifndef require_noerr_string - #define require_noerr_string(errorCode, exceptionLabel, message) __Require_noErr_String(errorCode, exceptionLabel, message) - #endif - - #ifndef require_string - #define require_string(assertion, exceptionLabel, message) __Require_String(assertion, exceptionLabel, message) - #endif - - #ifndef verify - #define verify(assertion) __Verify(assertion) - #endif - - #ifndef verify_action - #define verify_action(assertion, action) __Verify_Action(assertion, action) - #endif - - #ifndef verify_noerr - #define verify_noerr(errorCode) __Verify_noErr(errorCode) - #endif - - #ifndef verify_noerr_action - #define verify_noerr_action(errorCode, action) __Verify_noErr_Action(errorCode, action) - #endif - - #ifndef verify_noerr_string - #define verify_noerr_string(errorCode, message) __Verify_noErr_String(errorCode, message) - #endif - - #ifndef verify_string - #define verify_string(assertion, message) __Verify_String(assertion, message) - #endif - - #ifndef ncheck - #define ncheck(assertion) __nCheck(assertion) - #endif - - #ifndef ncheck_string - #define ncheck_string(assertion, message) __nCheck_String(assertion, message) - #endif - - #ifndef nrequire - #define nrequire(assertion, exceptionLabel) __nRequire(assertion, exceptionLabel) - #endif - - #ifndef nrequire_action - #define nrequire_action(assertion, exceptionLabel, action) __nRequire_Action(assertion, exceptionLabel, action) - #endif - - #ifndef nrequire_action_quiet - #define nrequire_action_quiet(assertion, exceptionLabel, action) __nRequire_Action_Quiet(assertion, exceptionLabel, action) - #endif - - #ifndef nrequire_action_string - #define nrequire_action_string(assertion, exceptionLabel, action, message) __nRequire_Action_String(assertion, exceptionLabel, action, message) - #endif - - #ifndef nrequire_quiet - #define nrequire_quiet(assertion, exceptionLabel) __nRequire_Quiet(assertion, exceptionLabel) - #endif - - #ifndef nrequire_string - #define nrequire_string(assertion, exceptionLabel, string) __nRequire_String(assertion, exceptionLabel, string) - #endif - - #ifndef nverify - #define nverify(assertion) __nVerify(assertion) - #endif - - #ifndef nverify_string - #define nverify_string(assertion, message) __nVerify_String(assertion, message) - #endif - - #ifndef require_action_quiet - #define require_action_quiet(assertion, exceptionLabel, action) __Require_Action_Quiet(assertion, exceptionLabel, action) - #endif - - #ifndef require_noerr_action_quiet - #define require_noerr_action_quiet(errorCode, exceptionLabel, action) __Require_noErr_Action_Quiet(errorCode, exceptionLabel, action) - #endif - - #ifndef require_noerr_quiet - #define require_noerr_quiet(errorCode, exceptionLabel) __Require_noErr_Quiet(errorCode, exceptionLabel) - #endif - - #ifndef require_quiet - #define require_quiet(assertion, exceptionLabel) __Require_Quiet(assertion, exceptionLabel) - #endif - - #ifndef check_compile_time - #define check_compile_time( expr ) __Check_Compile_Time( expr ) - #endif - - #ifndef debug_string - #define debug_string(message) __Debug_String(message) - #endif - -#endif /* ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES */ - - -#endif /* __ASSERTMACROS__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/TargetConditionals.h b/lib/libc/include/x86_64-macos.10-none/TargetConditionals.h deleted file mode 100644 index 896956f33d..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/TargetConditionals.h +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 2000-2014 by Apple Inc.. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - File: TargetConditionals.h - - Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone - - Note: TargetConditionals.h in 3.4 Universal Interfaces works - with all compilers. This header only recognizes compilers - known to run on Mac OS X. - -*/ - -#ifndef __TARGETCONDITIONALS__ -#define __TARGETCONDITIONALS__ - -/**************************************************************************************************** - - TARGET_CPU_* - These conditionals specify which microprocessor instruction set is being - generated. At most one of these is true, the rest are false. - - TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode - TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode - TARGET_CPU_68K - Compiler is generating 680x0 instructions - TARGET_CPU_X86 - Compiler is generating x86 instructions for 32-bit mode - TARGET_CPU_X86_64 - Compiler is generating x86 instructions for 64-bit mode - TARGET_CPU_ARM - Compiler is generating ARM instructions for 32-bit mode - TARGET_CPU_ARM64 - Compiler is generating ARM instructions for 64-bit mode - TARGET_CPU_MIPS - Compiler is generating MIPS instructions - TARGET_CPU_SPARC - Compiler is generating Sparc instructions - TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions - - - TARGET_OS_* - These conditionals specify in which Operating System the generated code will - run. Indention is used to show which conditionals are evolutionary subclasses. - - The MAC/WIN32/UNIX conditionals are mutually exclusive. - The IOS/TV/WATCH conditionals are mutually exclusive. - - - TARGET_OS_WIN32 - Generated code will run under 32-bit Windows - TARGET_OS_UNIX - Generated code will run under some Unix (not OSX) - TARGET_OS_MAC - Generated code will run under Mac OS X variant - TARGET_OS_OSX - Generated code will run under OS X devices - TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator - TARGET_OS_IOS - Generated code will run under iOS - TARGET_OS_TV - Generated code will run under Apple TV OS - TARGET_OS_WATCH - Generated code will run under Apple Watch OS - TARGET_OS_BRIDGE - Generated code will run under Bridge devices - TARGET_OS_MACCATALYST - Generated code will run under macOS - TARGET_OS_SIMULATOR - Generated code will run under a simulator - - TARGET_OS_EMBEDDED - DEPRECATED: Use TARGET_OS_IPHONE and/or TARGET_OS_SIMULATOR instead - TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR - TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH - - +----------------------------------------------------------------+ - | TARGET_OS_MAC | - | +---+ +-----------------------------------------------------+ | - | | | | TARGET_OS_IPHONE | | - | |OSX| | +-----+ +----+ +-------+ +--------+ +-------------+ | | - | | | | | IOS | | TV | | WATCH | | BRIDGE | | MACCATALYST | | | - | | | | +-----+ +----+ +-------+ +--------+ +-------------+ | | - | +---+ +-----------------------------------------------------+ | - +----------------------------------------------------------------+ - - TARGET_RT_* - These conditionals specify in which runtime the generated code will - run. This is needed when the OS and CPU support more than one runtime - (e.g. Mac OS X supports CFM and mach-o). - - TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers - TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers - TARGET_RT_64_BIT - Generated code uses 64-bit pointers - TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used - TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used - - -****************************************************************************************************/ - - /* - * TARGET_OS conditionals can be enabled via clang preprocessor extensions: - * - * __is_target_arch - * __is_target_vendor - * __is_target_os - * __is_target_environment - * - * “-target=x86_64-apple-ios12-macabi” - * TARGET_OS_MAC=1 - * TARGET_OS_IPHONE=1 - * TARGET_OS_IOS=1 - * TARGET_OS_MACCATALYST=1 - * - * “-target=x86_64-apple-ios12-simulator” - * TARGET_OS_MAC=1 - * TARGET_OS_IPHONE=1 - * TARGET_OS_IOS=1 - * TARGET_OS_SIMULATOR=1 - * - * DYNAMIC_TARGETS_ENABLED indicates that the core TARGET_OS macros were enabled via clang preprocessor extensions. - * If this value is not set, the macro enablements will fall back to the static behavior. - * It is disabled by default. - */ - -#if defined(__has_builtin) - #if __has_builtin(__is_target_arch) - #if __has_builtin(__is_target_vendor) - #if __has_builtin(__is_target_os) - #if __has_builtin(__is_target_environment) - - /* “-target=x86_64-apple-ios12-macabi” */ - #if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi) - #define TARGET_OS_OSX 0 - #define TARGET_OS_IPHONE 1 - #define TARGET_OS_IOS 1 - #define TARGET_OS_WATCH 0 - - #define TARGET_OS_TV 0 - #define TARGET_OS_SIMULATOR 0 - #define TARGET_OS_EMBEDDED 0 - #define TARGET_OS_RTKIT 0 - #define TARGET_OS_MACCATALYST 1 - #define TARGET_OS_MACCATALYST 1 - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 1 - #endif - #define TARGET_OS_DRIVERKIT 0 - #define DYNAMIC_TARGETS_ENABLED 1 - #endif - - /* “-target=x86_64-apple-ios12-simulator” */ - #if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(simulator) - #define TARGET_OS_OSX 0 - #define TARGET_OS_IPHONE 1 - #define TARGET_OS_IOS 1 - #define TARGET_OS_WATCH 0 - - #define TARGET_OS_TV 0 - #define TARGET_OS_SIMULATOR 1 - #define TARGET_OS_EMBEDDED 0 - #define TARGET_OS_RTKIT 0 - #define TARGET_OS_MACCATALYST 0 - #define TARGET_OS_MACCATALYST 0 - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif - #define TARGET_OS_DRIVERKIT 0 - #define DYNAMIC_TARGETS_ENABLED 1 - #endif - - /* -target=x86_64-apple-driverkit19.0 */ - #if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(driverkit) - #define TARGET_OS_OSX 0 - #define TARGET_OS_IPHONE 0 - #define TARGET_OS_IOS 0 - #define TARGET_OS_WATCH 0 - - #define TARGET_OS_TV 0 - #define TARGET_OS_SIMULATOR 0 - #define TARGET_OS_EMBEDDED 0 - #define TARGET_OS_RTKIT 0 - #define TARGET_OS_MACCATALYST 0 - #define TARGET_OS_MACCATALYST 0 - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif - #define TARGET_OS_DRIVERKIT 1 - #define DYNAMIC_TARGETS_ENABLED 1 - #endif - - #endif /* #if __has_builtin(__is_target_environment) */ - #endif /* #if __has_builtin(__is_target_os) */ - #endif /* #if __has_builtin(__is_target_vendor) */ - #endif /* #if __has_builtin(__is_target_arch) */ -#endif /* #if defined(__has_builtin) */ - - -#ifndef DYNAMIC_TARGETS_ENABLED - #define DYNAMIC_TARGETS_ENABLED 0 -#endif /* DYNAMIC_TARGETS_ENABLED */ - -/* - * gcc based compiler used on Mac OS X - */ -#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) ) - #define TARGET_OS_MAC 1 - #define TARGET_OS_WIN32 0 - #define TARGET_OS_UNIX 0 - - #if !DYNAMIC_TARGETS_ENABLED - #define TARGET_OS_OSX 1 - #define TARGET_OS_IPHONE 0 - #define TARGET_OS_IOS 0 - #define TARGET_OS_WATCH 0 - - #define TARGET_OS_TV 0 - #define TARGET_OS_MACCATALYST 0 - #define TARGET_OS_MACCATALYST 0 - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif - #define TARGET_OS_SIMULATOR 0 - #define TARGET_OS_EMBEDDED 0 - #define TARGET_OS_RTKIT 0 - #define TARGET_OS_DRIVERKIT 0 - #endif - - #define TARGET_IPHONE_SIMULATOR TARGET_OS_SIMULATOR /* deprecated */ - #define TARGET_OS_NANO TARGET_OS_WATCH /* deprecated */ - #define TARGET_ABI_USES_IOS_VALUES (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST) - #if defined(__ppc__) - #define TARGET_CPU_PPC 1 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_LITTLE_ENDIAN 0 - #define TARGET_RT_BIG_ENDIAN 1 - #define TARGET_RT_64_BIT 0 - #ifdef __MACOS_CLASSIC__ - #define TARGET_RT_MAC_CFM 1 - #define TARGET_RT_MAC_MACHO 0 - #else - #define TARGET_RT_MAC_CFM 0 - #define TARGET_RT_MAC_MACHO 1 - #endif - #elif defined(__ppc64__) - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 1 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_LITTLE_ENDIAN 0 - #define TARGET_RT_BIG_ENDIAN 1 - #define TARGET_RT_64_BIT 1 - #define TARGET_RT_MAC_CFM 0 - #define TARGET_RT_MAC_MACHO 1 - #elif defined(__i386__) - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 1 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_MAC_CFM 0 - #define TARGET_RT_MAC_MACHO 1 - #define TARGET_RT_LITTLE_ENDIAN 1 - #define TARGET_RT_BIG_ENDIAN 0 - #define TARGET_RT_64_BIT 0 - #elif defined(__x86_64__) - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 1 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_MAC_CFM 0 - #define TARGET_RT_MAC_MACHO 1 - #define TARGET_RT_LITTLE_ENDIAN 1 - #define TARGET_RT_BIG_ENDIAN 0 - #define TARGET_RT_64_BIT 1 - #elif defined(__arm__) - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_ARM 1 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_MAC_CFM 0 - #define TARGET_RT_MAC_MACHO 1 - #define TARGET_RT_LITTLE_ENDIAN 1 - #define TARGET_RT_BIG_ENDIAN 0 - #define TARGET_RT_64_BIT 0 - #elif defined(__arm64__) - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 1 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_MAC_CFM 0 - #define TARGET_RT_MAC_MACHO 1 - #define TARGET_RT_LITTLE_ENDIAN 1 - #define TARGET_RT_BIG_ENDIAN 0 - #if __LP64__ - #define TARGET_RT_64_BIT 1 - #else - #define TARGET_RT_64_BIT 0 - #endif - #else - #error unrecognized GNU C compiler - #endif - - - -/* - * CodeWarrior compiler from Metrowerks/Motorola - */ -#elif defined(__MWERKS__) - #define TARGET_OS_MAC 1 - #define TARGET_OS_WIN32 0 - #define TARGET_OS_UNIX 0 - #define TARGET_OS_EMBEDDED 0 - #if defined(__POWERPC__) - #define TARGET_CPU_PPC 1 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_LITTLE_ENDIAN 0 - #define TARGET_RT_BIG_ENDIAN 1 - #elif defined(__INTEL__) - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 1 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #define TARGET_RT_LITTLE_ENDIAN 1 - #define TARGET_RT_BIG_ENDIAN 0 - #else - #error unknown Metrowerks CPU type - #endif - #define TARGET_RT_64_BIT 0 - #ifdef __MACH__ - #define TARGET_RT_MAC_CFM 0 - #define TARGET_RT_MAC_MACHO 1 - #else - #define TARGET_RT_MAC_CFM 1 - #define TARGET_RT_MAC_MACHO 0 - #endif - -/* - * unknown compiler - */ -#else - #if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #elif defined(TARGET_CPU_PPC64) && TARGET_CPU_PPC64 - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #elif defined(TARGET_CPU_X86) && TARGET_CPU_X86 - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #elif defined(TARGET_CPU_X86_64) && TARGET_CPU_X86_64 - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #elif defined(TARGET_CPU_ARM) && TARGET_CPU_ARM - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #elif defined(TARGET_CPU_ARM64) && TARGET_CPU_ARM64 - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_PPC64 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_X86_64 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #else - /* - NOTE: If your compiler errors out here then support for your compiler - has not yet been added to TargetConditionals.h. - - TargetConditionals.h is designed to be plug-and-play. It auto detects - which compiler is being run and configures the TARGET_ conditionals - appropriately. - - The short term work around is to set the TARGET_CPU_ and TARGET_OS_ - on the command line to the compiler (e.g. -DTARGET_CPU_MIPS=1 -DTARGET_OS_UNIX=1) - - The long term solution is to add a new case to this file which - auto detects your compiler and sets up the TARGET_ conditionals. - Then submit the changes to Apple Computer. - */ - #error TargetConditionals.h: unknown compiler (see comment above) - #define TARGET_CPU_PPC 0 - #define TARGET_CPU_68K 0 - #define TARGET_CPU_X86 0 - #define TARGET_CPU_ARM 0 - #define TARGET_CPU_ARM64 0 - #define TARGET_CPU_MIPS 0 - #define TARGET_CPU_SPARC 0 - #define TARGET_CPU_ALPHA 0 - #endif - #define TARGET_OS_MAC 1 - #define TARGET_OS_WIN32 0 - #define TARGET_OS_UNIX 0 - #define TARGET_OS_EMBEDDED 0 - #if TARGET_CPU_PPC || TARGET_CPU_PPC64 - #define TARGET_RT_BIG_ENDIAN 1 - #define TARGET_RT_LITTLE_ENDIAN 0 - #else - #define TARGET_RT_BIG_ENDIAN 0 - #define TARGET_RT_LITTLE_ENDIAN 1 - #endif - #if TARGET_CPU_PPC64 || TARGET_CPU_X86_64 - #define TARGET_RT_64_BIT 1 - #else - #define TARGET_RT_64_BIT 0 - #endif - #ifdef __MACH__ - #define TARGET_RT_MAC_MACHO 1 - #define TARGET_RT_MAC_CFM 0 - #else - #define TARGET_RT_MAC_MACHO 0 - #define TARGET_RT_MAC_CFM 1 - #endif - -#endif - -#endif /* __TARGETCONDITIONALS__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/_ctermid.h b/lib/libc/include/x86_64-macos.10-none/_ctermid.h deleted file mode 100644 index b941ea10d4..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/_ctermid.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _CTERMID_H_ -#define _CTERMID_H_ -char *ctermid(char *); -#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/assert.h b/lib/libc/include/x86_64-macos.10-none/assert.h deleted file mode 100644 index e08d52cb28..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/assert.h +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)assert.h 8.2 (Berkeley) 1/21/94 - * $FreeBSD: src/include/assert.h,v 1.4 2002/03/23 17:24:53 imp Exp $ - */ - -#include -#ifdef __cplusplus -#include -#endif /* __cplusplus */ - -/* - * Unlike other ANSI header files, may usefully be included - * multiple times, with and without NDEBUG defined. - */ - -#undef assert -#undef __assert - -#ifdef NDEBUG -#define assert(e) ((void)0) -#else - -#ifndef __GNUC__ - -__BEGIN_DECLS -#ifndef __cplusplus -void abort(void) __dead2 __cold; -#endif /* !__cplusplus */ -int printf(const char * __restrict, ...); -__END_DECLS - -#define assert(e) \ - ((void) ((e) ? ((void)0) : __assert (#e, __FILE__, __LINE__))) -#define __assert(e, file, line) \ - ((void)printf ("%s:%d: failed assertion `%s'\n", file, line, e), abort()) - -#else /* __GNUC__ */ - -__BEGIN_DECLS -void __assert_rtn(const char *, const char *, int, const char *) __dead2 __cold __disable_tail_calls; -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1070) -void __eprintf(const char *, const char *, unsigned, const char *) __dead2 __cold; -#endif -__END_DECLS - -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1070) -#define __assert(e, file, line) \ - __eprintf ("%s:%d: failed assertion `%s'\n", file, line, e) -#else -/* 8462256: modified __assert_rtn() replaces deprecated __eprintf() */ -#define __assert(e, file, line) \ - __assert_rtn ((const char *)-1L, file, line, e) -#endif - -#if __DARWIN_UNIX03 -#define assert(e) \ - (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0) -#else /* !__DARWIN_UNIX03 */ -#define assert(e) \ - (__builtin_expect(!(e), 0) ? __assert (#e, __FILE__, __LINE__) : (void)0) -#endif /* __DARWIN_UNIX03 */ - -#endif /* __GNUC__ */ -#endif /* NDEBUG */ - -#ifndef _ASSERT_H_ -#define _ASSERT_H_ - -#ifndef __cplusplus -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#define static_assert _Static_assert -#endif /* __STDC_VERSION__ */ -#endif /* !__cplusplus */ - -#endif /* _ASSERT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/bsm/audit.h b/lib/libc/include/x86_64-macos.10-none/bsm/audit.h deleted file mode 100644 index e65ccbfab6..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/bsm/audit.h +++ /dev/null @@ -1,378 +0,0 @@ -/*- - * Copyright (c) 2005-2009 Apple Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#10 $ - */ - -#ifndef _BSM_AUDIT_H -#define _BSM_AUDIT_H - -#include -#include - -#define AUDIT_RECORD_MAGIC 0x828a0f1b -#define MAX_AUDIT_RECORDS 20 -#define MAXAUDITDATA (0x8000 - 1) -#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA -#define MIN_AUDIT_FILE_SIZE (512 * 1024) - -/* - * Minimum noumber of free blocks on the filesystem containing the audit - * log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0 - * as the kernel does an unsigned compare, plus we want to leave a few blocks - * free so userspace can terminate the log, etc. - */ -#define AUDIT_HARD_LIMIT_FREE_BLOCKS 4 - -/* - * Triggers for the audit daemon. - */ -#define AUDIT_TRIGGER_MIN 1 -#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */ -#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */ -#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */ -#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */ -#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */ -#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */ -#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */ -#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */ -#define AUDIT_TRIGGER_MAX 8 - -/* - * The special device filename (FreeBSD). - */ -#define AUDITDEV_FILENAME "audit" -#define AUDIT_TRIGGER_FILE ("/dev/" AUDITDEV_FILENAME) - -/* - * Pre-defined audit IDs - */ -#define AU_DEFAUDITID (uid_t)(-1) -#define AU_DEFAUDITSID 0 -#define AU_ASSIGN_ASID -1 - -/* - * IPC types. - */ -#define AT_IPC_MSG ((unsigned char)1) /* Message IPC id. */ -#define AT_IPC_SEM ((unsigned char)2) /* Semaphore IPC id. */ -#define AT_IPC_SHM ((unsigned char)3) /* Shared mem IPC id. */ - -/* - * Audit conditions. - */ -#define AUC_UNSET 0 -#define AUC_AUDITING 1 -#define AUC_NOAUDIT 2 -#define AUC_DISABLED -1 - -/* - * auditon(2) commands. - */ -#define A_OLDGETPOLICY 2 -#define A_OLDSETPOLICY 3 -#define A_GETKMASK 4 -#define A_SETKMASK 5 -#define A_OLDGETQCTRL 6 -#define A_OLDSETQCTRL 7 -#define A_GETCWD 8 -#define A_GETCAR 9 -#define A_GETSTAT 12 -#define A_SETSTAT 13 -#define A_SETUMASK 14 -#define A_SETSMASK 15 -#define A_OLDGETCOND 20 -#define A_OLDSETCOND 21 -#define A_GETCLASS 22 -#define A_SETCLASS 23 -#define A_GETPINFO 24 -#define A_SETPMASK 25 -#define A_SETFSIZE 26 -#define A_GETFSIZE 27 -#define A_GETPINFO_ADDR 28 -#define A_GETKAUDIT 29 -#define A_SETKAUDIT 30 -#define A_SENDTRIGGER 31 -#define A_GETSINFO_ADDR 32 -#define A_GETPOLICY 33 -#define A_SETPOLICY 34 -#define A_GETQCTRL 35 -#define A_SETQCTRL 36 -#define A_GETCOND 37 -#define A_SETCOND 38 -#define A_GETSFLAGS 39 -#define A_SETSFLAGS 40 -#define A_GETCTLMODE 41 -#define A_SETCTLMODE 42 -#define A_GETEXPAFTER 43 -#define A_SETEXPAFTER 44 - -/* - * Audit policy controls. - */ -#define AUDIT_CNT 0x0001 -#define AUDIT_AHLT 0x0002 -#define AUDIT_ARGV 0x0004 -#define AUDIT_ARGE 0x0008 -#define AUDIT_SEQ 0x0010 -#define AUDIT_WINDATA 0x0020 -#define AUDIT_USER 0x0040 -#define AUDIT_GROUP 0x0080 -#define AUDIT_TRAIL 0x0100 -#define AUDIT_PATH 0x0200 -#define AUDIT_SCNT 0x0400 -#define AUDIT_PUBLIC 0x0800 -#define AUDIT_ZONENAME 0x1000 -#define AUDIT_PERZONE 0x2000 - -/* - * Default audit queue control parameters. - */ -#define AQ_HIWATER 100 -#define AQ_MAXHIGH 10000 -#define AQ_LOWATER 10 -#define AQ_BUFSZ MAXAUDITDATA -#define AQ_MAXBUFSZ 1048576 - -/* - * Default minimum percentage free space on file system. - */ -#define AU_FS_MINFREE 20 - -/* - * Type definitions used indicating the length of variable length addresses - * in tokens containing addresses, such as header fields. - */ -#define AU_IPv4 4 -#define AU_IPv6 16 - -/* - * Reserved audit class mask indicating which classes are unable to have - * events added or removed by unentitled processes. - */ -#define AU_CLASS_MASK_RESERVED 0x10000000 - -/* - * Audit control modes - */ -#define AUDIT_CTLMODE_NORMAL ((unsigned char)1) -#define AUDIT_CTLMODE_EXTERNAL ((unsigned char)2) - -/* - * Audit file expire_after op modes - */ -#define AUDIT_EXPIRE_OP_AND ((unsigned char)0) -#define AUDIT_EXPIRE_OP_OR ((unsigned char)1) - -__BEGIN_DECLS - -typedef uid_t au_id_t; -typedef pid_t au_asid_t; -typedef u_int16_t au_event_t; -typedef u_int16_t au_emod_t; -typedef u_int32_t au_class_t; -typedef u_int64_t au_asflgs_t __attribute__ ((aligned(8))); -typedef unsigned char au_ctlmode_t; - -struct au_tid { - dev_t port; - u_int32_t machine; -}; -typedef struct au_tid au_tid_t; - -struct au_tid_addr { - dev_t at_port; - u_int32_t at_type; - u_int32_t at_addr[4]; -}; -typedef struct au_tid_addr au_tid_addr_t; - -struct au_mask { - unsigned int am_success; /* Success bits. */ - unsigned int am_failure; /* Failure bits. */ -}; -typedef struct au_mask au_mask_t; - -struct auditinfo { - au_id_t ai_auid; /* Audit user ID. */ - au_mask_t ai_mask; /* Audit masks. */ - au_tid_t ai_termid; /* Terminal ID. */ - au_asid_t ai_asid; /* Audit session ID. */ -}; -typedef struct auditinfo auditinfo_t; - -struct auditinfo_addr { - au_id_t ai_auid; /* Audit user ID. */ - au_mask_t ai_mask; /* Audit masks. */ - au_tid_addr_t ai_termid; /* Terminal ID. */ - au_asid_t ai_asid; /* Audit session ID. */ - au_asflgs_t ai_flags; /* Audit session flags. */ -}; -typedef struct auditinfo_addr auditinfo_addr_t; - -struct auditpinfo { - pid_t ap_pid; /* ID of target process. */ - au_id_t ap_auid; /* Audit user ID. */ - au_mask_t ap_mask; /* Audit masks. */ - au_tid_t ap_termid; /* Terminal ID. */ - au_asid_t ap_asid; /* Audit session ID. */ -}; -typedef struct auditpinfo auditpinfo_t; - -struct auditpinfo_addr { - pid_t ap_pid; /* ID of target process. */ - au_id_t ap_auid; /* Audit user ID. */ - au_mask_t ap_mask; /* Audit masks. */ - au_tid_addr_t ap_termid; /* Terminal ID. */ - au_asid_t ap_asid; /* Audit session ID. */ - au_asflgs_t ap_flags; /* Audit session flags. */ -}; -typedef struct auditpinfo_addr auditpinfo_addr_t; - -struct au_session { - auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */ - au_mask_t as_mask; /* Process Audit Masks. */ -}; -typedef struct au_session au_session_t; - -struct au_expire_after { - time_t age; /* Age after which trail files should be expired */ - size_t size; /* Aggregate trail size when files should be expired */ - unsigned char op_type; /* Operator used with the above values to determine when files should be expired */ -}; -typedef struct au_expire_after au_expire_after_t; - -/* - * Contents of token_t are opaque outside of libbsm. - */ -typedef struct au_token token_t; - -/* - * Kernel audit queue control parameters: - * Default: Maximum: - * aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000) - * aq_lowater: AQ_LOWATER (10) - -/* - * getaudit()/setaudit() are deprecated and have been replaced with - * wrappers to the getaudit_addr()/setaudit_addr() syscalls above. - */ - -int getaudit(struct auditinfo *) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, - __IPHONE_2_0, __IPHONE_6_0); -int setaudit(const struct auditinfo *) -__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, - __IPHONE_2_0, __IPHONE_6_0); -#else - -int getaudit(struct auditinfo *); -int setaudit(const struct auditinfo *); -#endif /* !__APPLE__ */ - -#ifdef __APPLE_API_PRIVATE -#include -mach_port_name_t audit_session_self(void); -au_asid_t audit_session_join(mach_port_name_t port); -int audit_session_port(au_asid_t asid, mach_port_name_t *portname); -#endif /* __APPLE_API_PRIVATE */ - -#endif /* defined(_KERNEL) || defined(KERNEL) */ - -__END_DECLS - -#endif /* !_BSM_AUDIT_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/device/device_types.h b/lib/libc/include/x86_64-macos.10-none/device/device_types.h deleted file mode 100644 index 2878666853..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/device/device_types.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - */ -/* - * Author: David B. Golub, Carnegie Mellon University - * Date: 3/89 - */ - -#ifndef DEVICE_TYPES_H -#define DEVICE_TYPES_H - -/* - * Types for device interface. - */ -#include -#include -#include -#include - - - -/* - * IO buffer - out-of-line array of characters. - */ -typedef char * io_buf_ptr_t; - -/* - * Some types for IOKit. - */ - -#ifdef IOKIT - -/* must match device_types.defs */ -typedef char io_name_t[128]; -typedef char io_string_t[512]; -typedef char io_string_inband_t[4096]; -typedef char io_struct_inband_t[4096]; - -#if __LP64__ -typedef uint64_t io_user_scalar_t; -typedef uint64_t io_user_reference_t; -typedef io_user_scalar_t io_scalar_inband_t[16]; -typedef io_user_reference_t io_async_ref_t[8]; -typedef io_user_scalar_t io_scalar_inband64_t[16]; -typedef io_user_reference_t io_async_ref64_t[8]; -#else -typedef int io_user_scalar_t; -typedef natural_t io_user_reference_t; -typedef io_user_scalar_t io_scalar_inband_t[16]; -typedef io_user_reference_t io_async_ref_t[8]; -typedef uint64_t io_scalar_inband64_t[16]; -typedef uint64_t io_async_ref64_t[8]; -#endif // __LP64__ - - -#ifndef __IOKIT_PORTS_DEFINED__ -#define __IOKIT_PORTS_DEFINED__ -typedef mach_port_t io_object_t; -#endif /* __IOKIT_PORTS_DEFINED__ */ - - -#endif /* IOKIT */ - -#endif /* DEVICE_TYPES_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/dispatch/dispatch.h b/lib/libc/include/x86_64-macos.10-none/dispatch/dispatch.h deleted file mode 100644 index 7d5356aab6..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/dispatch/dispatch.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2008-2013 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -#ifndef __DISPATCH_PUBLIC__ -#define __DISPATCH_PUBLIC__ - -#ifdef __APPLE__ -#include -#include -#include -#include -#elif defined(_WIN32) -#include -#elif defined(__unix__) -#include -#endif - -#include -#include -#include -#include -#include -#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) -#include -#endif -#include - -#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__has_feature) -#if __has_feature(modules) -#if !defined(__arm__) -#include // for off_t (to match Glibc.modulemap) -#endif -#endif -#endif - -#define DISPATCH_API_VERSION 20181008 - -#ifndef __DISPATCH_INDIRECT__ -#define __DISPATCH_INDIRECT__ -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef __DISPATCH_INDIRECT__ - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/execinfo.h b/lib/libc/include/x86_64-macos.10-none/execinfo.h deleted file mode 100644 index 65d9d20486..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/execinfo.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2007 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -#ifndef _EXECINFO_H_ -#define _EXECINFO_H_ 1 - -#include -#include -#include -#include -#include -#include - -__BEGIN_DECLS - -int backtrace(void**,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); - -API_AVAILABLE(macosx(10.14), ios(12.0), tvos(12.0), watchos(5.0)) -OS_EXPORT -int backtrace_from_fp(void *startfp, void **array, int size); - -char** backtrace_symbols(void* const*,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); -void backtrace_symbols_fd(void* const*,int,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); - -struct image_offset { - /* - * The UUID of the image. - */ - uuid_t uuid; - - /* - * The offset is relative to the __TEXT section of the image. - */ - uint32_t offset; -}; - -API_AVAILABLE(macosx(10.14), ios(12.0), tvos(12.0), watchos(5.0)) -OS_EXPORT -void backtrace_image_offsets(void* const* array, - struct image_offset *image_offsets, int size); - -__END_DECLS - -#endif /* !_EXECINFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/OSByteOrder.h b/lib/libc/include/x86_64-macos.10-none/libkern/OSByteOrder.h deleted file mode 100644 index 25563e26e7..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/libkern/OSByteOrder.h +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _OS_OSBYTEORDER_H -#define _OS_OSBYTEORDER_H - -#include -#include - -/* Macros for swapping constant values in the preprocessing stage. */ -#define OSSwapConstInt16(x) __DARWIN_OSSwapConstInt16(x) -#define OSSwapConstInt32(x) __DARWIN_OSSwapConstInt32(x) -#define OSSwapConstInt64(x) __DARWIN_OSSwapConstInt64(x) - -#if defined(__GNUC__) - -#if (defined(__i386__) || defined(__x86_64__)) -#include -#else -#include -#endif - -#else /* ! __GNUC__ */ - -#include - -#endif /* __GNUC__ */ - -#define OSSwapInt16(x) __DARWIN_OSSwapInt16(x) -#define OSSwapInt32(x) __DARWIN_OSSwapInt32(x) -#define OSSwapInt64(x) __DARWIN_OSSwapInt64(x) - -enum { - OSUnknownByteOrder, - OSLittleEndian, - OSBigEndian -}; - -OS_INLINE -int32_t -OSHostByteOrder(void) -{ -#if defined(__LITTLE_ENDIAN__) - return OSLittleEndian; -#elif defined(__BIG_ENDIAN__) - return OSBigEndian; -#else - return OSUnknownByteOrder; -#endif -} - -#define OSReadBigInt(x, y) OSReadBigInt32(x, y) -#define OSWriteBigInt(x, y, z) OSWriteBigInt32(x, y, z) -#define OSSwapBigToHostInt(x) OSSwapBigToHostInt32(x) -#define OSSwapHostToBigInt(x) OSSwapHostToBigInt32(x) -#define OSReadLittleInt(x, y) OSReadLittleInt32(x, y) -#define OSWriteLittleInt(x, y, z) OSWriteLittleInt32(x, y, z) -#define OSSwapHostToLittleInt(x) OSSwapHostToLittleInt32(x) -#define OSSwapLittleToHostInt(x) OSSwapLittleToHostInt32(x) - -/* Functions for loading native endian values. */ - -OS_INLINE -uint16_t -_OSReadInt16( - const volatile void * base, - uintptr_t byteOffset - ) -{ - return *(volatile uint16_t *)((uintptr_t)base + byteOffset); -} - -OS_INLINE -uint32_t -_OSReadInt32( - const volatile void * base, - uintptr_t byteOffset - ) -{ - return *(volatile uint32_t *)((uintptr_t)base + byteOffset); -} - -OS_INLINE -uint64_t -_OSReadInt64( - const volatile void * base, - uintptr_t byteOffset - ) -{ - return *(volatile uint64_t *)((uintptr_t)base + byteOffset); -} - -/* Functions for storing native endian values. */ - -OS_INLINE -void -_OSWriteInt16( - volatile void * base, - uintptr_t byteOffset, - uint16_t data - ) -{ - *(volatile uint16_t *)((uintptr_t)base + byteOffset) = data; -} - -OS_INLINE -void -_OSWriteInt32( - volatile void * base, - uintptr_t byteOffset, - uint32_t data - ) -{ - *(volatile uint32_t *)((uintptr_t)base + byteOffset) = data; -} - -OS_INLINE -void -_OSWriteInt64( - volatile void * base, - uintptr_t byteOffset, - uint64_t data - ) -{ - *(volatile uint64_t *)((uintptr_t)base + byteOffset) = data; -} - -#if defined(__BIG_ENDIAN__) - -/* Functions for loading big endian to host endianess. */ - -#define OSReadBigInt16(base, byteOffset) _OSReadInt16(base, byteOffset) -#define OSReadBigInt32(base, byteOffset) _OSReadInt32(base, byteOffset) -#define OSReadBigInt64(base, byteOffset) _OSReadInt64(base, byteOffset) - -/* Functions for storing host endianess to big endian. */ - -#define OSWriteBigInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data) -#define OSWriteBigInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data) -#define OSWriteBigInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data) - -/* Functions for loading little endian to host endianess. */ - -#define OSReadLittleInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset) -#define OSReadLittleInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset) -#define OSReadLittleInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset) - -/* Functions for storing host endianess to little endian. */ - -#define OSWriteLittleInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data) -#define OSWriteLittleInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data) -#define OSWriteLittleInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data) - -/* Host endianess to big endian byte swapping macros for constants. */ - -#define OSSwapHostToBigConstInt16(x) ((uint16_t)(x)) -#define OSSwapHostToBigConstInt32(x) ((uint32_t)(x)) -#define OSSwapHostToBigConstInt64(x) ((uint64_t)(x)) - -/* Generic host endianess to big endian byte swapping functions. */ - -#define OSSwapHostToBigInt16(x) ((uint16_t)(x)) -#define OSSwapHostToBigInt32(x) ((uint32_t)(x)) -#define OSSwapHostToBigInt64(x) ((uint64_t)(x)) - -/* Host endianess to little endian byte swapping macros for constants. */ - -#define OSSwapHostToLittleConstInt16(x) OSSwapConstInt16(x) -#define OSSwapHostToLittleConstInt32(x) OSSwapConstInt32(x) -#define OSSwapHostToLittleConstInt64(x) OSSwapConstInt64(x) - -/* Generic host endianess to little endian byte swapping functions. */ - -#define OSSwapHostToLittleInt16(x) OSSwapInt16(x) -#define OSSwapHostToLittleInt32(x) OSSwapInt32(x) -#define OSSwapHostToLittleInt64(x) OSSwapInt64(x) - -/* Big endian to host endianess byte swapping macros for constants. */ - -#define OSSwapBigToHostConstInt16(x) ((uint16_t)(x)) -#define OSSwapBigToHostConstInt32(x) ((uint32_t)(x)) -#define OSSwapBigToHostConstInt64(x) ((uint64_t)(x)) - -/* Generic big endian to host endianess byte swapping functions. */ - -#define OSSwapBigToHostInt16(x) ((uint16_t)(x)) -#define OSSwapBigToHostInt32(x) ((uint32_t)(x)) -#define OSSwapBigToHostInt64(x) ((uint64_t)(x)) - -/* Little endian to host endianess byte swapping macros for constants. */ - -#define OSSwapLittleToHostConstInt16(x) OSSwapConstInt16(x) -#define OSSwapLittleToHostConstInt32(x) OSSwapConstInt32(x) -#define OSSwapLittleToHostConstInt64(x) OSSwapConstInt64(x) - -/* Generic little endian to host endianess byte swapping functions. */ - -#define OSSwapLittleToHostInt16(x) OSSwapInt16(x) -#define OSSwapLittleToHostInt32(x) OSSwapInt32(x) -#define OSSwapLittleToHostInt64(x) OSSwapInt64(x) - -#elif defined(__LITTLE_ENDIAN__) - -/* Functions for loading big endian to host endianess. */ - -#define OSReadBigInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset) -#define OSReadBigInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset) -#define OSReadBigInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset) - -/* Functions for storing host endianess to big endian. */ - -#define OSWriteBigInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data) -#define OSWriteBigInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data) -#define OSWriteBigInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data) - -/* Functions for loading little endian to host endianess. */ - -#define OSReadLittleInt16(base, byteOffset) _OSReadInt16(base, byteOffset) -#define OSReadLittleInt32(base, byteOffset) _OSReadInt32(base, byteOffset) -#define OSReadLittleInt64(base, byteOffset) _OSReadInt64(base, byteOffset) - -/* Functions for storing host endianess to little endian. */ - -#define OSWriteLittleInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data) -#define OSWriteLittleInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data) -#define OSWriteLittleInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data) - -/* Host endianess to big endian byte swapping macros for constants. */ - -#define OSSwapHostToBigConstInt16(x) OSSwapConstInt16(x) -#define OSSwapHostToBigConstInt32(x) OSSwapConstInt32(x) -#define OSSwapHostToBigConstInt64(x) OSSwapConstInt64(x) - -/* Generic host endianess to big endian byte swapping functions. */ - -#define OSSwapHostToBigInt16(x) OSSwapInt16(x) -#define OSSwapHostToBigInt32(x) OSSwapInt32(x) -#define OSSwapHostToBigInt64(x) OSSwapInt64(x) - -/* Host endianess to little endian byte swapping macros for constants. */ - -#define OSSwapHostToLittleConstInt16(x) ((uint16_t)(x)) -#define OSSwapHostToLittleConstInt32(x) ((uint32_t)(x)) -#define OSSwapHostToLittleConstInt64(x) ((uint64_t)(x)) - -/* Generic host endianess to little endian byte swapping functions. */ - -#define OSSwapHostToLittleInt16(x) ((uint16_t)(x)) -#define OSSwapHostToLittleInt32(x) ((uint32_t)(x)) -#define OSSwapHostToLittleInt64(x) ((uint64_t)(x)) - -/* Big endian to host endianess byte swapping macros for constants. */ - -#define OSSwapBigToHostConstInt16(x) OSSwapConstInt16(x) -#define OSSwapBigToHostConstInt32(x) OSSwapConstInt32(x) -#define OSSwapBigToHostConstInt64(x) OSSwapConstInt64(x) - -/* Generic big endian to host endianess byte swapping functions. */ - -#define OSSwapBigToHostInt16(x) OSSwapInt16(x) -#define OSSwapBigToHostInt32(x) OSSwapInt32(x) -#define OSSwapBigToHostInt64(x) OSSwapInt64(x) - -/* Little endian to host endianess byte swapping macros for constants. */ - -#define OSSwapLittleToHostConstInt16(x) ((uint16_t)(x)) -#define OSSwapLittleToHostConstInt32(x) ((uint32_t)(x)) -#define OSSwapLittleToHostConstInt64(x) ((uint64_t)(x)) - -/* Generic little endian to host endianess byte swapping functions. */ - -#define OSSwapLittleToHostInt16(x) ((uint16_t)(x)) -#define OSSwapLittleToHostInt32(x) ((uint32_t)(x)) -#define OSSwapLittleToHostInt64(x) ((uint64_t)(x)) - -#else -#error Unknown endianess. -#endif - -#endif /* ! _OS_OSBYTEORDER_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/_OSByteOrder.h b/lib/libc/include/x86_64-macos.10-none/libkern/_OSByteOrder.h deleted file mode 100644 index 06614c63ea..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/libkern/_OSByteOrder.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _OS__OSBYTEORDER_H -#define _OS__OSBYTEORDER_H - -/* - * This header is normally included from . However, - * also includes this in the case of little-endian - * architectures, so that we can map OSByteOrder routines to the hton* and ntoh* - * macros. This results in the asymmetry below; we only include - * for little-endian architectures. - */ - -#include - -/* Macros for swapping constant values in the preprocessing stage. */ -#define __DARWIN_OSSwapConstInt16(x) \ - ((__uint16_t)((((__uint16_t)(x) & 0xff00) >> 8) | \ - (((__uint16_t)(x) & 0x00ff) << 8))) - -#define __DARWIN_OSSwapConstInt32(x) \ - ((__uint32_t)((((__uint32_t)(x) & 0xff000000) >> 24) | \ - (((__uint32_t)(x) & 0x00ff0000) >> 8) | \ - (((__uint32_t)(x) & 0x0000ff00) << 8) | \ - (((__uint32_t)(x) & 0x000000ff) << 24))) - -#define __DARWIN_OSSwapConstInt64(x) \ - ((__uint64_t)((((__uint64_t)(x) & 0xff00000000000000ULL) >> 56) | \ - (((__uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \ - (((__uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \ - (((__uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \ - (((__uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \ - (((__uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \ - (((__uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \ - (((__uint64_t)(x) & 0x00000000000000ffULL) << 56))) - -#if defined(__GNUC__) - -#if defined(__i386__) || defined(__x86_64__) -#include -#endif - - - -#define __DARWIN_OSSwapInt16(x) \ - ((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x))) - -#define __DARWIN_OSSwapInt32(x) \ - (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt32(x) : _OSSwapInt32(x)) - -#define __DARWIN_OSSwapInt64(x) \ - (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x)) - -#else /* ! __GNUC__ */ - -#if defined(__i386__) || defined(__x86_64__) - -#if !defined(__DARWIN_OS_INLINE) -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -# define __DARWIN_OS_INLINE static inline -# elif defined(__MWERKS__) || defined(__cplusplus) -# define __DARWIN_OS_INLINE static inline -# else -# define __DARWIN_OS_INLINE static __inline__ -# endif -#endif - -__DARWIN_OS_INLINE -uint16_t -_OSSwapInt16( - uint16_t data - ) -{ - return __DARWIN_OSSwapConstInt16(data); -} - -__DARWIN_OS_INLINE -uint32_t -_OSSwapInt32( - uint32_t data - ) -{ - return __DARWIN_OSSwapConstInt32(data); -} - -__DARWIN_OS_INLINE -uint64_t -_OSSwapInt64( - uint64_t data - ) -{ - return __DARWIN_OSSwapConstInt64(data); -} -#endif - -#define __DARWIN_OSSwapInt16(x) _OSSwapInt16(x) - -#define __DARWIN_OSSwapInt32(x) _OSSwapInt32(x) - -#define __DARWIN_OSSwapInt64(x) _OSSwapInt64(x) - -#endif /* __GNUC__ */ - -#endif /* ! _OS__OSBYTEORDER_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach-o/compact_unwind_encoding.h b/lib/libc/include/x86_64-macos.10-none/mach-o/compact_unwind_encoding.h deleted file mode 100644 index 3c37bb3bc7..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach-o/compact_unwind_encoding.h +++ /dev/null @@ -1,427 +0,0 @@ -/* -*- mode: C; c-basic-offset: 4; tab-width: 4 -*- - * - * Copyright (c) 2008-2011 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - -#ifndef __COMPACT_UNWIND_ENCODING__ -#define __COMPACT_UNWIND_ENCODING__ - -#include - - - -// -// Compilers can emit standard Dwarf FDEs in the __TEXT,__eh_frame section -// of object files. Or compilers can emit compact unwind information in -// the __LD,__compact_unwind section. -// -// When the linker creates a final linked image, it will create a -// __TEXT,__unwind_info section. This section is a small and fast way for the -// runtime to access unwind info for any given function. If the compiler emitted -// compact unwind info for the function, that compact unwind info will be encoded -// in the __TEXT,__unwind_info section. If the compiler emitted dwarf unwind info, -// the __TEXT,__unwind_info section will contain the offset of the FDE in the -// __TEXT,__eh_frame section in the final linked image. -// -// Note: Previously, the linker would transform some dwarf unwind infos into -// compact unwind info. But that is fragile and no longer done. - - -// -// The compact unwind endoding is a 32-bit value which encoded in an architecture -// specific way, which registers to restore from where, and how to unwind out -// of the function. -// -typedef uint32_t compact_unwind_encoding_t; - - -// architecture independent bits -enum { - UNWIND_IS_NOT_FUNCTION_START = 0x80000000, - UNWIND_HAS_LSDA = 0x40000000, - UNWIND_PERSONALITY_MASK = 0x30000000, -}; - - - - -// -// x86 -// -// 1-bit: start -// 1-bit: has lsda -// 2-bit: personality index -// -// 4-bits: 0=old, 1=ebp based, 2=stack-imm, 3=stack-ind, 4=dwarf -// ebp based: -// 15-bits (5*3-bits per reg) register permutation -// 8-bits for stack offset -// frameless: -// 8-bits stack size -// 3-bits stack adjust -// 3-bits register count -// 10-bits register permutation -// -enum { - UNWIND_X86_MODE_MASK = 0x0F000000, - UNWIND_X86_MODE_EBP_FRAME = 0x01000000, - UNWIND_X86_MODE_STACK_IMMD = 0x02000000, - UNWIND_X86_MODE_STACK_IND = 0x03000000, - UNWIND_X86_MODE_DWARF = 0x04000000, - - UNWIND_X86_EBP_FRAME_REGISTERS = 0x00007FFF, - UNWIND_X86_EBP_FRAME_OFFSET = 0x00FF0000, - - UNWIND_X86_FRAMELESS_STACK_SIZE = 0x00FF0000, - UNWIND_X86_FRAMELESS_STACK_ADJUST = 0x0000E000, - UNWIND_X86_FRAMELESS_STACK_REG_COUNT = 0x00001C00, - UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF, - - UNWIND_X86_DWARF_SECTION_OFFSET = 0x00FFFFFF, -}; - -enum { - UNWIND_X86_REG_NONE = 0, - UNWIND_X86_REG_EBX = 1, - UNWIND_X86_REG_ECX = 2, - UNWIND_X86_REG_EDX = 3, - UNWIND_X86_REG_EDI = 4, - UNWIND_X86_REG_ESI = 5, - UNWIND_X86_REG_EBP = 6, -}; - -// -// For x86 there are four modes for the compact unwind encoding: -// UNWIND_X86_MODE_EBP_FRAME: -// EBP based frame where EBP is push on stack immediately after return address, -// then ESP is moved to EBP. Thus, to unwind ESP is restored with the current -// EPB value, then EBP is restored by popping off the stack, and the return -// is done by popping the stack once more into the pc. -// All non-volatile registers that need to be restored must have been saved -// in a small range in the stack that starts EBP-4 to EBP-1020. The offset/4 -// is encoded in the UNWIND_X86_EBP_FRAME_OFFSET bits. The registers saved -// are encoded in the UNWIND_X86_EBP_FRAME_REGISTERS bits as five 3-bit entries. -// Each entry contains which register to restore. -// UNWIND_X86_MODE_STACK_IMMD: -// A "frameless" (EBP not used as frame pointer) function with a small -// constant stack size. To return, a constant (encoded in the compact -// unwind encoding) is added to the ESP. Then the return is done by -// popping the stack into the pc. -// All non-volatile registers that need to be restored must have been saved -// on the stack immediately after the return address. The stack_size/4 is -// encoded in the UNWIND_X86_FRAMELESS_STACK_SIZE (max stack size is 1024). -// The number of registers saved is encoded in UNWIND_X86_FRAMELESS_STACK_REG_COUNT. -// UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION constains which registers were -// saved and their order. -// UNWIND_X86_MODE_STACK_IND: -// A "frameless" (EBP not used as frame pointer) function large constant -// stack size. This case is like the previous, except the stack size is too -// large to encode in the compact unwind encoding. Instead it requires that -// the function contains "subl $nnnnnnnn,ESP" in its prolog. The compact -// encoding contains the offset to the nnnnnnnn value in the function in -// UNWIND_X86_FRAMELESS_STACK_SIZE. -// UNWIND_X86_MODE_DWARF: -// No compact unwind encoding is available. Instead the low 24-bits of the -// compact encoding is the offset of the dwarf FDE in the __eh_frame section. -// This mode is never used in object files. It is only generated by the -// linker in final linked images which have only dwarf unwind info for a -// function. -// -// The following is the algorithm used to create the permutation encoding used -// with frameless stacks. It is passed the number of registers to be saved and -// an array of the register numbers saved. -// -//uint32_t permute_encode(uint32_t registerCount, const uint32_t registers[6]) -//{ -// uint32_t renumregs[6]; -// for (int i=6-registerCount; i < 6; ++i) { -// int countless = 0; -// for (int j=6-registerCount; j < i; ++j) { -// if ( registers[j] < registers[i] ) -// ++countless; -// } -// renumregs[i] = registers[i] - countless -1; -// } -// uint32_t permutationEncoding = 0; -// switch ( registerCount ) { -// case 6: -// permutationEncoding |= (120*renumregs[0] + 24*renumregs[1] -// + 6*renumregs[2] + 2*renumregs[3] -// + renumregs[4]); -// break; -// case 5: -// permutationEncoding |= (120*renumregs[1] + 24*renumregs[2] -// + 6*renumregs[3] + 2*renumregs[4] -// + renumregs[5]); -// break; -// case 4: -// permutationEncoding |= (60*renumregs[2] + 12*renumregs[3] -// + 3*renumregs[4] + renumregs[5]); -// break; -// case 3: -// permutationEncoding |= (20*renumregs[3] + 4*renumregs[4] -// + renumregs[5]); -// break; -// case 2: -// permutationEncoding |= (5*renumregs[4] + renumregs[5]); -// break; -// case 1: -// permutationEncoding |= (renumregs[5]); -// break; -// } -// return permutationEncoding; -//} -// - - - - -// -// x86_64 -// -// 1-bit: start -// 1-bit: has lsda -// 2-bit: personality index -// -// 4-bits: 0=old, 1=rbp based, 2=stack-imm, 3=stack-ind, 4=dwarf -// rbp based: -// 15-bits (5*3-bits per reg) register permutation -// 8-bits for stack offset -// frameless: -// 8-bits stack size -// 3-bits stack adjust -// 3-bits register count -// 10-bits register permutation -// -enum { - UNWIND_X86_64_MODE_MASK = 0x0F000000, - UNWIND_X86_64_MODE_RBP_FRAME = 0x01000000, - UNWIND_X86_64_MODE_STACK_IMMD = 0x02000000, - UNWIND_X86_64_MODE_STACK_IND = 0x03000000, - UNWIND_X86_64_MODE_DWARF = 0x04000000, - - UNWIND_X86_64_RBP_FRAME_REGISTERS = 0x00007FFF, - UNWIND_X86_64_RBP_FRAME_OFFSET = 0x00FF0000, - - UNWIND_X86_64_FRAMELESS_STACK_SIZE = 0x00FF0000, - UNWIND_X86_64_FRAMELESS_STACK_ADJUST = 0x0000E000, - UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT = 0x00001C00, - UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF, - - UNWIND_X86_64_DWARF_SECTION_OFFSET = 0x00FFFFFF, -}; - -enum { - UNWIND_X86_64_REG_NONE = 0, - UNWIND_X86_64_REG_RBX = 1, - UNWIND_X86_64_REG_R12 = 2, - UNWIND_X86_64_REG_R13 = 3, - UNWIND_X86_64_REG_R14 = 4, - UNWIND_X86_64_REG_R15 = 5, - UNWIND_X86_64_REG_RBP = 6, -}; -// -// For x86_64 there are four modes for the compact unwind encoding: -// UNWIND_X86_64_MODE_RBP_FRAME: -// RBP based frame where RBP is push on stack immediately after return address, -// then RSP is moved to RBP. Thus, to unwind RSP is restored with the current -// EPB value, then RBP is restored by popping off the stack, and the return -// is done by popping the stack once more into the pc. -// All non-volatile registers that need to be restored must have been saved -// in a small range in the stack that starts RBP-8 to RBP-1020. The offset/4 -// is encoded in the UNWIND_X86_64_RBP_FRAME_OFFSET bits. The registers saved -// are encoded in the UNWIND_X86_64_RBP_FRAME_REGISTERS bits as five 3-bit entries. -// Each entry contains which register to restore. -// UNWIND_X86_64_MODE_STACK_IMMD: -// A "frameless" (RBP not used as frame pointer) function with a small -// constant stack size. To return, a constant (encoded in the compact -// unwind encoding) is added to the RSP. Then the return is done by -// popping the stack into the pc. -// All non-volatile registers that need to be restored must have been saved -// on the stack immediately after the return address. The stack_size/4 is -// encoded in the UNWIND_X86_64_FRAMELESS_STACK_SIZE (max stack size is 1024). -// The number of registers saved is encoded in UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT. -// UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION constains which registers were -// saved and their order. -// UNWIND_X86_64_MODE_STACK_IND: -// A "frameless" (RBP not used as frame pointer) function large constant -// stack size. This case is like the previous, except the stack size is too -// large to encode in the compact unwind encoding. Instead it requires that -// the function contains "subq $nnnnnnnn,RSP" in its prolog. The compact -// encoding contains the offset to the nnnnnnnn value in the function in -// UNWIND_X86_64_FRAMELESS_STACK_SIZE. -// UNWIND_X86_64_MODE_DWARF: -// No compact unwind encoding is available. Instead the low 24-bits of the -// compact encoding is the offset of the dwarf FDE in the __eh_frame section. -// This mode is never used in object files. It is only generated by the -// linker in final linked images which have only dwarf unwind info for a -// function. -// - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Relocatable Object Files: __LD,__compact_unwind -// -//////////////////////////////////////////////////////////////////////////////// - -// -// A compiler can generated compact unwind information for a function by adding -// a "row" to the __LD,__compact_unwind section. This section has the -// S_ATTR_DEBUG bit set, so the section will be ignored by older linkers. -// It is removed by the new linker, so never ends up in final executables. -// This section is a table, initially with one row per function (that needs -// unwind info). The table columns and some conceptual entries are: -// -// range-start pointer to start of function/range -// range-length -// compact-unwind-encoding 32-bit encoding -// personality-function or zero if no personality function -// lsda or zero if no LSDA data -// -// The length and encoding fields are 32-bits. The other are all pointer sized. -// -// In x86_64 assembly, these entry would look like: -// -// .section __LD,__compact_unwind,regular,debug -// -// #compact unwind for _foo -// .quad _foo -// .set L1,LfooEnd-_foo -// .long L1 -// .long 0x01010001 -// .quad 0 -// .quad 0 -// -// #compact unwind for _bar -// .quad _bar -// .set L2,LbarEnd-_bar -// .long L2 -// .long 0x01020011 -// .quad __gxx_personality -// .quad except_tab1 -// -// -// Notes: There is no need for any labels in the the __compact_unwind section. -// The use of the .set directive is to force the evaluation of the -// range-length at assembly time, instead of generating relocations. -// -// To support future compiler optimizations where which non-volatile registers -// are saved changes within a function (e.g. delay saving non-volatiles until -// necessary), there can by multiple lines in the __compact_unwind table for one -// function, each with a different (non-overlapping) range and each with -// different compact unwind encodings that correspond to the non-volatiles -// saved at that range of the function. -// -// If a particular function is so wacky that there is no compact unwind way -// to encode it, then the compiler can emit traditional dwarf unwind info. -// The runtime will use which ever is available. -// -// Runtime support for compact unwind encodings are only available on 10.6 -// and later. So, the compiler should not generate it when targeting pre-10.6. - - - - -//////////////////////////////////////////////////////////////////////////////// -// -// Final Linked Images: __TEXT,__unwind_info -// -//////////////////////////////////////////////////////////////////////////////// - -// -// The __TEXT,__unwind_info section is laid out for an efficient two level lookup. -// The header of the section contains a coarse index that maps function address -// to the page (4096 byte block) containing the unwind info for that function. -// - -#define UNWIND_SECTION_VERSION 1 -struct unwind_info_section_header -{ - uint32_t version; // UNWIND_SECTION_VERSION - uint32_t commonEncodingsArraySectionOffset; - uint32_t commonEncodingsArrayCount; - uint32_t personalityArraySectionOffset; - uint32_t personalityArrayCount; - uint32_t indexSectionOffset; - uint32_t indexCount; - // compact_unwind_encoding_t[] - // uintptr_t personalities[] - // unwind_info_section_header_index_entry[] - // unwind_info_section_header_lsda_index_entry[] -}; - -struct unwind_info_section_header_index_entry -{ - uint32_t functionOffset; - uint32_t secondLevelPagesSectionOffset; // section offset to start of regular or compress page - uint32_t lsdaIndexArraySectionOffset; // section offset to start of lsda_index array for this range -}; - -struct unwind_info_section_header_lsda_index_entry -{ - uint32_t functionOffset; - uint32_t lsdaOffset; -}; - -// -// There are two kinds of second level index pages: regular and compressed. -// A compressed page can hold up to 1021 entries, but it cannot be used -// if too many different encoding types are used. The regular page holds -// 511 entries. -// - -struct unwind_info_regular_second_level_entry -{ - uint32_t functionOffset; - compact_unwind_encoding_t encoding; -}; - -#define UNWIND_SECOND_LEVEL_REGULAR 2 -struct unwind_info_regular_second_level_page_header -{ - uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR - uint16_t entryPageOffset; - uint16_t entryCount; - // entry array -}; - -#define UNWIND_SECOND_LEVEL_COMPRESSED 3 -struct unwind_info_compressed_second_level_page_header -{ - uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED - uint16_t entryPageOffset; - uint16_t entryCount; - uint16_t encodingsPageOffset; - uint16_t encodingsCount; - // 32-bit entry array - // encodings array -}; - -#define UNWIND_INFO_COMPRESSED_ENTRY_FUNC_OFFSET(entry) (entry & 0x00FFFFFF) -#define UNWIND_INFO_COMPRESSED_ENTRY_ENCODING_INDEX(entry) ((entry >> 24) & 0xFF) - - - -#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach-o/dyld.h b/lib/libc/include/x86_64-macos.10-none/mach-o/dyld.h deleted file mode 100644 index 0b293cbd09..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach-o/dyld.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 1999-2008 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -#ifndef _MACH_O_DYLD_H_ -#define _MACH_O_DYLD_H_ - - -#include -#include -#include - -#include -#include - -#if __cplusplus -extern "C" { -#endif - -#ifdef __DRIVERKIT_19_0 - #define DYLD_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit) -#else - #define DYLD_DRIVERKIT_UNAVAILABLE -#endif - -/* - * The following functions allow you to iterate through all loaded images. - * This is not a thread safe operation. Another thread can add or remove - * an image during the iteration. - * - * Many uses of these routines can be replace by a call to dladdr() which - * will return the mach_header and name of an image, given an address in - * the image. dladdr() is thread safe. - */ -extern uint32_t _dyld_image_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); -extern const struct mach_header* _dyld_get_image_header(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); -extern intptr_t _dyld_get_image_vmaddr_slide(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); -extern const char* _dyld_get_image_name(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); - - -/* - * The following functions allow you to install callbacks which will be called - * by dyld whenever an image is loaded or unloaded. During a call to _dyld_register_func_for_add_image() - * the callback func is called for every existing image. Later, it is called as each new image - * is loaded and bound (but initializers not yet run). The callback registered with - * _dyld_register_func_for_remove_image() is called after any terminators in an image are run - * and before the image is un-memory-mapped. - */ -extern void _dyld_register_func_for_add_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); -extern void _dyld_register_func_for_remove_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); - - -/* - * NSVersionOfRunTimeLibrary() returns the current_version number of the currently dylib - * specifed by the libraryName. The libraryName parameter would be "bar" for /path/libbar.3.dylib and - * "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if no such library is loaded. - */ -extern int32_t NSVersionOfRunTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); - - -/* - * NSVersionOfLinkTimeLibrary() returns the current_version number that the main executable was linked - * against at build time. The libraryName parameter would be "bar" for /path/libbar.3.dylib and - * "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if the main executable did not link - * against the specified library. - */ -extern int32_t NSVersionOfLinkTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0); - - -/* - * _NSGetExecutablePath() copies the path of the main executable into the buffer. The bufsize parameter - * should initially be the size of the buffer. The function returns 0 if the path was successfully copied, - * and *bufsize is left unchanged. It returns -1 if the buffer is not large enough, and *bufsize is set - * to the size required. - * - * Note that _NSGetExecutablePath will return "a path" to the executable not a "real path" to the executable. - * That is the path may be a symbolic link and not the real file. With deep directories the total bufsize - * needed could be more than MAXPATHLEN. - */ -extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0); - - - -/* - * Registers a function to be called when the current thread terminates. - * Called by c++ compiler to implement destructors on thread_local object variables. - */ -extern void _tlv_atexit(void (*termFunc)(void* objAddr), void* objAddr) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); - - -/* - * Never called. On-disk thread local variables contain a pointer to this. Once - * the thread local is prepared, the pointer changes to a real handler such as tlv_get_addr. - */ -extern void _tlv_bootstrap(void) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) DYLD_DRIVERKIT_UNAVAILABLE ; - -/* - * The following dyld API's are deprecated as of Mac OS X 10.5. They are either - * no longer necessary or are superceeded by dlopen and friends in . - * dlopen/dlsym/dlclose have been available since Mac OS X 10.3 and work with - * dylibs and bundles. - * - * NSAddImage -> dlopen - * NSLookupSymbolInImage -> dlsym - * NSCreateObjectFileImageFromFile -> dlopen - * NSDestroyObjectFileImage -> dlclose - * NSLinkModule -> not needed when dlopen used - * NSUnLinkModule -> not needed when dlclose used - * NSLookupSymbolInModule -> dlsym - * _dyld_image_containing_address -> dladdr - * NSLinkEditError -> dlerror - * - */ - -#ifndef ENUM_DYLD_BOOL -#define ENUM_DYLD_BOOL - #undef FALSE - #undef TRUE - enum DYLD_BOOL { FALSE, TRUE }; -#endif /* ENUM_DYLD_BOOL */ - - -/* Object file image API */ -typedef enum { - NSObjectFileImageFailure, /* for this a message is printed on stderr */ - NSObjectFileImageSuccess, - NSObjectFileImageInappropriateFile, - NSObjectFileImageArch, - NSObjectFileImageFormat, /* for this a message is printed on stderr */ - NSObjectFileImageAccess -} NSObjectFileImageReturnCode; - -typedef struct __NSObjectFileImage* NSObjectFileImage; - - - -/* NSObjectFileImage can only be used with MH_BUNDLE files */ -extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromFile(const char* pathName, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()"); -extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromMemory(const void *address, size_t size, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -extern bool NSDestroyObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlclose()"); - -extern uint32_t NSSymbolDefinitionCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -extern const char* NSSymbolDefinitionNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -extern uint32_t NSSymbolReferenceCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -extern const char* NSSymbolReferenceNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal, bool *tentative_definition) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -extern bool NSIsSymbolDefinedInObjectFileImage(NSObjectFileImage objectFileImage, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern void* NSGetSectionDataInObjectFileImage(NSObjectFileImage objectFileImage, const char* segmentName, const char* sectionName, size_t *size) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "getsectiondata()"); - -typedef struct __NSModule* NSModule; -extern const char* NSNameOfModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -extern const char* NSLibraryNameForModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); - -extern NSModule NSLinkModule(NSObjectFileImage objectFileImage, const char* moduleName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()"); -#define NSLINKMODULE_OPTION_NONE 0x0 -#define NSLINKMODULE_OPTION_BINDNOW 0x1 -#define NSLINKMODULE_OPTION_PRIVATE 0x2 -#define NSLINKMODULE_OPTION_RETURN_ON_ERROR 0x4 -#define NSLINKMODULE_OPTION_DONT_CALL_MOD_INIT_ROUTINES 0x8 -#define NSLINKMODULE_OPTION_TRAILING_PHYS_NAME 0x10 - -extern bool NSUnLinkModule(NSModule module, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -#define NSUNLINKMODULE_OPTION_NONE 0x0 -#define NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED 0x1 -#define NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES 0x2 - -/* symbol API */ -typedef struct __NSSymbol* NSSymbol; -extern bool NSIsSymbolNameDefined(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern bool NSIsSymbolNameDefinedWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern bool NSIsSymbolNameDefinedInImage(const struct mach_header* image, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern NSSymbol NSLookupAndBindSymbol(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern NSSymbol NSLookupAndBindSymbolWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern NSSymbol NSLookupSymbolInModule(NSModule module, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()"); -extern NSSymbol NSLookupSymbolInImage(const struct mach_header* image, const char* symbolName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()"); -#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0 -#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1 -#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2 -#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4 -extern const char* NSNameOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); -extern void * NSAddressOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()"); -extern NSModule NSModuleForSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dladdr()"); - -/* error handling API */ -typedef enum { - NSLinkEditFileAccessError, - NSLinkEditFileFormatError, - NSLinkEditMachResourceError, - NSLinkEditUnixResourceError, - NSLinkEditOtherError, - NSLinkEditWarningError, - NSLinkEditMultiplyDefinedError, - NSLinkEditUndefinedError -} NSLinkEditErrors; - -/* - * For the NSLinkEditErrors value NSLinkEditOtherError these are the values - * passed to the link edit error handler as the errorNumber (what would be an - * errno value for NSLinkEditUnixResourceError or a kern_return_t value for - * NSLinkEditMachResourceError). - */ -typedef enum { - NSOtherErrorRelocation, - NSOtherErrorLazyBind, - NSOtherErrorIndrLoop, - NSOtherErrorLazyInit, - NSOtherErrorInvalidArgs -} NSOtherErrorNumbers; - -extern void NSLinkEditError(NSLinkEditErrors *c, int *errorNumber, const char** fileName, const char** errorString) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlerror()"); - -typedef struct { - void (*undefined)(const char* symbolName); - NSModule (*multiple)(NSSymbol s, NSModule oldModule, NSModule newModule); - void (*linkEdit)(NSLinkEditErrors errorClass, int errorNumber, - const char* fileName, const char* errorString); -} NSLinkEditErrorHandlers; - -extern void NSInstallLinkEditErrorHandlers(const NSLinkEditErrorHandlers *handlers) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, ""); - -extern bool NSAddLibrary(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()"); -extern bool NSAddLibraryWithSearching(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()"); -extern const struct mach_header* NSAddImage(const char* image_name, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()"); -#define NSADDIMAGE_OPTION_NONE 0x0 -#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1 -#define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2 -#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4 -#define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8 - -extern bool _dyld_present(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "always true"); -extern bool _dyld_launched_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "moot"); -extern bool _dyld_all_twolevel_modules_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "moot"); -extern bool _dyld_bind_fully_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen(RTLD_NOW)"); -extern bool _dyld_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()"); -extern void _dyld_lookup_and_bind(const char* symbol_name, void **address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern void _dyld_lookup_and_bind_with_hint(const char* symbol_name, const char* library_name_hint, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()"); -extern void _dyld_lookup_and_bind_fully(const char* symbol_name, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()"); - -extern const struct mach_header* _dyld_get_image_header_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()"); - - -#if __cplusplus -} -#endif - -#endif /* _MACH_O_DYLD_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/kern_return.h b/lib/libc/include/x86_64-macos.10-none/mach/kern_return.h deleted file mode 100644 index 62d6415f52..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/kern_return.h +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - */ -/* - * File: h/kern_return.h - * Author: Avadis Tevanian, Jr. - * Date: 1985 - * - * Kernel return codes. - * - */ - -#ifndef _MACH_KERN_RETURN_H_ -#define _MACH_KERN_RETURN_H_ - -#include - -#define KERN_SUCCESS 0 - -#define KERN_INVALID_ADDRESS 1 -/* Specified address is not currently valid. - */ - -#define KERN_PROTECTION_FAILURE 2 -/* Specified memory is valid, but does not permit the - * required forms of access. - */ - -#define KERN_NO_SPACE 3 -/* The address range specified is already in use, or - * no address range of the size specified could be - * found. - */ - -#define KERN_INVALID_ARGUMENT 4 -/* The function requested was not applicable to this - * type of argument, or an argument is invalid - */ - -#define KERN_FAILURE 5 -/* The function could not be performed. A catch-all. - */ - -#define KERN_RESOURCE_SHORTAGE 6 -/* A system resource could not be allocated to fulfill - * this request. This failure may not be permanent. - */ - -#define KERN_NOT_RECEIVER 7 -/* The task in question does not hold receive rights - * for the port argument. - */ - -#define KERN_NO_ACCESS 8 -/* Bogus access restriction. - */ - -#define KERN_MEMORY_FAILURE 9 -/* During a page fault, the target address refers to a - * memory object that has been destroyed. This - * failure is permanent. - */ - -#define KERN_MEMORY_ERROR 10 -/* During a page fault, the memory object indicated - * that the data could not be returned. This failure - * may be temporary; future attempts to access this - * same data may succeed, as defined by the memory - * object. - */ - -#define KERN_ALREADY_IN_SET 11 -/* The receive right is already a member of the portset. - */ - -#define KERN_NOT_IN_SET 12 -/* The receive right is not a member of a port set. - */ - -#define KERN_NAME_EXISTS 13 -/* The name already denotes a right in the task. - */ - -#define KERN_ABORTED 14 -/* The operation was aborted. Ipc code will - * catch this and reflect it as a message error. - */ - -#define KERN_INVALID_NAME 15 -/* The name doesn't denote a right in the task. - */ - -#define KERN_INVALID_TASK 16 -/* Target task isn't an active task. - */ - -#define KERN_INVALID_RIGHT 17 -/* The name denotes a right, but not an appropriate right. - */ - -#define KERN_INVALID_VALUE 18 -/* A blatant range error. - */ - -#define KERN_UREFS_OVERFLOW 19 -/* Operation would overflow limit on user-references. - */ - -#define KERN_INVALID_CAPABILITY 20 -/* The supplied (port) capability is improper. - */ - -#define KERN_RIGHT_EXISTS 21 -/* The task already has send or receive rights - * for the port under another name. - */ - -#define KERN_INVALID_HOST 22 -/* Target host isn't actually a host. - */ - -#define KERN_MEMORY_PRESENT 23 -/* An attempt was made to supply "precious" data - * for memory that is already present in a - * memory object. - */ - -#define KERN_MEMORY_DATA_MOVED 24 -/* A page was requested of a memory manager via - * memory_object_data_request for an object using - * a MEMORY_OBJECT_COPY_CALL strategy, with the - * VM_PROT_WANTS_COPY flag being used to specify - * that the page desired is for a copy of the - * object, and the memory manager has detected - * the page was pushed into a copy of the object - * while the kernel was walking the shadow chain - * from the copy to the object. This error code - * is delivered via memory_object_data_error - * and is handled by the kernel (it forces the - * kernel to restart the fault). It will not be - * seen by users. - */ - -#define KERN_MEMORY_RESTART_COPY 25 -/* A strategic copy was attempted of an object - * upon which a quicker copy is now possible. - * The caller should retry the copy using - * vm_object_copy_quickly. This error code - * is seen only by the kernel. - */ - -#define KERN_INVALID_PROCESSOR_SET 26 -/* An argument applied to assert processor set privilege - * was not a processor set control port. - */ - -#define KERN_POLICY_LIMIT 27 -/* The specified scheduling attributes exceed the thread's - * limits. - */ - -#define KERN_INVALID_POLICY 28 -/* The specified scheduling policy is not currently - * enabled for the processor set. - */ - -#define KERN_INVALID_OBJECT 29 -/* The external memory manager failed to initialize the - * memory object. - */ - -#define KERN_ALREADY_WAITING 30 -/* A thread is attempting to wait for an event for which - * there is already a waiting thread. - */ - -#define KERN_DEFAULT_SET 31 -/* An attempt was made to destroy the default processor - * set. - */ - -#define KERN_EXCEPTION_PROTECTED 32 -/* An attempt was made to fetch an exception port that is - * protected, or to abort a thread while processing a - * protected exception. - */ - -#define KERN_INVALID_LEDGER 33 -/* A ledger was required but not supplied. - */ - -#define KERN_INVALID_MEMORY_CONTROL 34 -/* The port was not a memory cache control port. - */ - -#define KERN_INVALID_SECURITY 35 -/* An argument supplied to assert security privilege - * was not a host security port. - */ - -#define KERN_NOT_DEPRESSED 36 -/* thread_depress_abort was called on a thread which - * was not currently depressed. - */ - -#define KERN_TERMINATED 37 -/* Object has been terminated and is no longer available - */ - -#define KERN_LOCK_SET_DESTROYED 38 -/* Lock set has been destroyed and is no longer available. - */ - -#define KERN_LOCK_UNSTABLE 39 -/* The thread holding the lock terminated before releasing - * the lock - */ - -#define KERN_LOCK_OWNED 40 -/* The lock is already owned by another thread - */ - -#define KERN_LOCK_OWNED_SELF 41 -/* The lock is already owned by the calling thread - */ - -#define KERN_SEMAPHORE_DESTROYED 42 -/* Semaphore has been destroyed and is no longer available. - */ - -#define KERN_RPC_SERVER_TERMINATED 43 -/* Return from RPC indicating the target server was - * terminated before it successfully replied - */ - -#define KERN_RPC_TERMINATE_ORPHAN 44 -/* Terminate an orphaned activation. - */ - -#define KERN_RPC_CONTINUE_ORPHAN 45 -/* Allow an orphaned activation to continue executing. - */ - -#define KERN_NOT_SUPPORTED 46 -/* Empty thread activation (No thread linked to it) - */ - -#define KERN_NODE_DOWN 47 -/* Remote node down or inaccessible. - */ - -#define KERN_NOT_WAITING 48 -/* A signalled thread was not actually waiting. */ - -#define KERN_OPERATION_TIMED_OUT 49 -/* Some thread-oriented operation (semaphore_wait) timed out - */ - -#define KERN_CODESIGN_ERROR 50 -/* During a page fault, indicates that the page was rejected - * as a result of a signature check. - */ - -#define KERN_POLICY_STATIC 51 -/* The requested property cannot be changed at this time. - */ - -#define KERN_INSUFFICIENT_BUFFER_SIZE 52 -/* The provided buffer is of insufficient size for the requested data. - */ - -#define KERN_RETURN_MAX 0x100 -/* Maximum return value allowable - */ - -#endif /* _MACH_KERN_RETURN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/lock_set.h b/lib/libc/include/x86_64-macos.10-none/mach/lock_set.h deleted file mode 100644 index 752d7c2976..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/lock_set.h +++ /dev/null @@ -1,350 +0,0 @@ -#ifndef _lock_set_user_ -#define _lock_set_user_ - -/* Module lock_set */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ - -#if defined(__has_include) -#if __has_include() -#ifndef USING_MIG_STRNCPY_ZEROFILL -#define USING_MIG_STRNCPY_ZEROFILL -#endif -#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ -#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ -#ifdef __cplusplus -extern "C" { -#endif - extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); -#ifdef __cplusplus -} -#endif -#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ -#endif /* __has_include() */ -#endif /* __has_include */ - -/* END MIG_STRNCPY_ZEROFILL CODE */ - - -#ifdef AUTOTEST -#ifndef FUNCTION_PTR_T -#define FUNCTION_PTR_T -typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); -typedef struct { - char *name; - function_ptr_t function; -} function_table_entry; -typedef function_table_entry *function_table_t; -#endif /* FUNCTION_PTR_T */ -#endif /* AUTOTEST */ - -#ifndef lock_set_MSG_COUNT -#define lock_set_MSG_COUNT 6 -#endif /* lock_set_MSG_COUNT */ - -#include -#include -#include -#include - -#ifdef __BeforeMigUserHeader -__BeforeMigUserHeader -#endif /* __BeforeMigUserHeader */ - -#include -__BEGIN_DECLS - - -/* Routine lock_acquire */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t lock_acquire -( - lock_set_t lock_set, - int lock_id -); - -/* Routine lock_release */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t lock_release -( - lock_set_t lock_set, - int lock_id -); - -/* Routine lock_try */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t lock_try -( - lock_set_t lock_set, - int lock_id -); - -/* Routine lock_make_stable */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t lock_make_stable -( - lock_set_t lock_set, - int lock_id -); - -/* Routine lock_handoff */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t lock_handoff -( - lock_set_t lock_set, - int lock_id -); - -/* Routine lock_handoff_accept */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t lock_handoff_accept -( - lock_set_t lock_set, - int lock_id -); - -__END_DECLS - -/********************** Caution **************************/ -/* The following data types should be used to calculate */ -/* maximum message sizes only. The actual message may be */ -/* smaller, and the position of the arguments within the */ -/* message layout may vary from what is presented here. */ -/* For example, if any of the arguments are variable- */ -/* sized, and less than the maximum is sent, the data */ -/* will be packed tight in the actual message to reduce */ -/* the presence of holes. */ -/********************** Caution **************************/ - -/* typedefs for all requests */ - -#ifndef __Request__lock_set_subsystem__defined -#define __Request__lock_set_subsystem__defined - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - int lock_id; - } __Request__lock_acquire_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - int lock_id; - } __Request__lock_release_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - int lock_id; - } __Request__lock_try_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - int lock_id; - } __Request__lock_make_stable_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - int lock_id; - } __Request__lock_handoff_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - int lock_id; - } __Request__lock_handoff_accept_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif -#endif /* !__Request__lock_set_subsystem__defined */ - -/* union of all requests */ - -#ifndef __RequestUnion__lock_set_subsystem__defined -#define __RequestUnion__lock_set_subsystem__defined -union __RequestUnion__lock_set_subsystem { - __Request__lock_acquire_t Request_lock_acquire; - __Request__lock_release_t Request_lock_release; - __Request__lock_try_t Request_lock_try; - __Request__lock_make_stable_t Request_lock_make_stable; - __Request__lock_handoff_t Request_lock_handoff; - __Request__lock_handoff_accept_t Request_lock_handoff_accept; -}; -#endif /* !__RequestUnion__lock_set_subsystem__defined */ -/* typedefs for all replies */ - -#ifndef __Reply__lock_set_subsystem__defined -#define __Reply__lock_set_subsystem__defined - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__lock_acquire_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__lock_release_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__lock_try_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__lock_make_stable_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__lock_handoff_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif - -#ifdef __MigPackStructs -#pragma pack(push, 4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__lock_handoff_accept_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack(pop) -#endif -#endif /* !__Reply__lock_set_subsystem__defined */ - -/* union of all replies */ - -#ifndef __ReplyUnion__lock_set_subsystem__defined -#define __ReplyUnion__lock_set_subsystem__defined -union __ReplyUnion__lock_set_subsystem { - __Reply__lock_acquire_t Reply_lock_acquire; - __Reply__lock_release_t Reply_lock_release; - __Reply__lock_try_t Reply_lock_try; - __Reply__lock_make_stable_t Reply_lock_make_stable; - __Reply__lock_handoff_t Reply_lock_handoff; - __Reply__lock_handoff_accept_t Reply_lock_handoff_accept; -}; -#endif /* !__RequestUnion__lock_set_subsystem__defined */ - -#ifndef subsystem_to_name_map_lock_set -#define subsystem_to_name_map_lock_set \ - { "lock_acquire", 617000 },\ - { "lock_release", 617001 },\ - { "lock_try", 617002 },\ - { "lock_make_stable", 617003 },\ - { "lock_handoff", 617004 },\ - { "lock_handoff_accept", 617005 } -#endif - -#ifdef __AfterMigUserHeader -__AfterMigUserHeader -#endif /* __AfterMigUserHeader */ - -#endif /* _lock_set_user_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mach_init.h b/lib/libc/include/x86_64-macos.10-none/mach/mach_init.h deleted file mode 100644 index d61d6e90b5..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/mach_init.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987,1986 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -/* - * Items provided by the Mach environment initialization. - */ - -#ifndef _MACH_INIT_ -#define _MACH_INIT_ 1 - -#include -#include -#include - -#include - -/* - * Kernel-related ports; how a task/thread controls itself - */ - -__BEGIN_DECLS -extern mach_port_t mach_host_self(void); -extern mach_port_t mach_thread_self(void); -extern kern_return_t host_page_size(host_t, vm_size_t *); - -extern mach_port_t mach_task_self_; -#define mach_task_self() mach_task_self_ -#define current_task() mach_task_self() - -__END_DECLS -#include -__BEGIN_DECLS - -/* - * Other important ports in the Mach user environment - */ - -extern mach_port_t bootstrap_port; - -/* - * Where these ports occur in the "mach_ports_register" - * collection... only servers or the runtime library need know. - */ - -#define NAME_SERVER_SLOT 0 -#define ENVIRONMENT_SLOT 1 -#define SERVICE_SLOT 2 - -#define MACH_PORTS_SLOTS_USED 3 - -/* - * fprintf_stderr uses vprintf_stderr_func to produce - * error messages, this can be overridden by a user - * application to point to a user-specified output function - */ -extern int (*vprintf_stderr_func)(const char *format, va_list ap); - -__END_DECLS - -#endif /* _MACH_INIT_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mach_traps.h b/lib/libc/include/x86_64-macos.10-none/mach/mach_traps.h deleted file mode 100644 index d3aaf577ed..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/mach_traps.h +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2000-2019 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - */ -/* - * Definitions of general Mach system traps. - * - * These are the definitions as seen from user-space. - * The kernel definitions are in . - * Kernel RPC functions are defined in . - */ - -#ifndef _MACH_MACH_TRAPS_H_ -#define _MACH_MACH_TRAPS_H_ - -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include - -__BEGIN_DECLS - - - -extern kern_return_t clock_sleep_trap( - mach_port_name_t clock_name, - sleep_type_t sleep_type, - int sleep_sec, - int sleep_nsec, - mach_timespec_t *wakeup_time); - -extern kern_return_t _kernelrpc_mach_vm_allocate_trap( - mach_port_name_t target, - mach_vm_offset_t *addr, - mach_vm_size_t size, - int flags); - -extern kern_return_t _kernelrpc_mach_vm_deallocate_trap( - mach_port_name_t target, - mach_vm_address_t address, - mach_vm_size_t size - ); - -extern kern_return_t _kernelrpc_mach_vm_protect_trap( - mach_port_name_t target, - mach_vm_address_t address, - mach_vm_size_t size, - boolean_t set_maximum, - vm_prot_t new_protection - ); - -extern kern_return_t _kernelrpc_mach_vm_map_trap( - mach_port_name_t target, - mach_vm_offset_t *address, - mach_vm_size_t size, - mach_vm_offset_t mask, - int flags, - vm_prot_t cur_protection - ); - -extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap( - mach_port_name_t target, - mach_vm_offset_t address, - vm_purgable_t control, - int *state); - -extern kern_return_t _kernelrpc_mach_port_allocate_trap( - mach_port_name_t target, - mach_port_right_t right, - mach_port_name_t *name - ); - - -extern kern_return_t _kernelrpc_mach_port_destroy_trap( - mach_port_name_t target, - mach_port_name_t name - ); - -extern kern_return_t _kernelrpc_mach_port_deallocate_trap( - mach_port_name_t target, - mach_port_name_t name - ); - -extern kern_return_t _kernelrpc_mach_port_mod_refs_trap( - mach_port_name_t target, - mach_port_name_t name, - mach_port_right_t right, - mach_port_delta_t delta - ); - -extern kern_return_t _kernelrpc_mach_port_move_member_trap( - mach_port_name_t target, - mach_port_name_t member, - mach_port_name_t after - ); - -extern kern_return_t _kernelrpc_mach_port_insert_right_trap( - mach_port_name_t target, - mach_port_name_t name, - mach_port_name_t poly, - mach_msg_type_name_t polyPoly - ); - -extern kern_return_t _kernelrpc_mach_port_get_attributes_trap( - mach_port_name_t target, - mach_port_name_t name, - mach_port_flavor_t flavor, - mach_port_info_t port_info_out, - mach_msg_type_number_t *port_info_outCnt - ); - -extern kern_return_t _kernelrpc_mach_port_insert_member_trap( - mach_port_name_t target, - mach_port_name_t name, - mach_port_name_t pset - ); - -extern kern_return_t _kernelrpc_mach_port_extract_member_trap( - mach_port_name_t target, - mach_port_name_t name, - mach_port_name_t pset - ); - -extern kern_return_t _kernelrpc_mach_port_construct_trap( - mach_port_name_t target, - mach_port_options_t *options, - uint64_t context, - mach_port_name_t *name - ); - -extern kern_return_t _kernelrpc_mach_port_destruct_trap( - mach_port_name_t target, - mach_port_name_t name, - mach_port_delta_t srdelta, - uint64_t guard - ); - -extern kern_return_t _kernelrpc_mach_port_guard_trap( - mach_port_name_t target, - mach_port_name_t name, - uint64_t guard, - boolean_t strict - ); - -extern kern_return_t _kernelrpc_mach_port_unguard_trap( - mach_port_name_t target, - mach_port_name_t name, - uint64_t guard - ); - -extern kern_return_t mach_generate_activity_id( - mach_port_name_t target, - int count, - uint64_t *activity_id - ); - -extern kern_return_t macx_swapon( - uint64_t filename, - int flags, - int size, - int priority); - -extern kern_return_t macx_swapoff( - uint64_t filename, - int flags); - -extern kern_return_t macx_triggers( - int hi_water, - int low_water, - int flags, - mach_port_t alert_port); - -extern kern_return_t macx_backing_store_suspend( - boolean_t suspend); - -extern kern_return_t macx_backing_store_recovery( - int pid); - -extern boolean_t swtch_pri(int pri); - -extern boolean_t swtch(void); - -extern kern_return_t thread_switch( - mach_port_name_t thread_name, - int option, - mach_msg_timeout_t option_time); - -extern mach_port_name_t task_self_trap(void); - -extern kern_return_t host_create_mach_voucher_trap( - mach_port_name_t host, - mach_voucher_attr_raw_recipe_array_t recipes, - int recipes_size, - mach_port_name_t *voucher); - -extern kern_return_t mach_voucher_extract_attr_recipe_trap( - mach_port_name_t voucher_name, - mach_voucher_attr_key_t key, - mach_voucher_attr_raw_recipe_t recipe, - mach_msg_type_number_t *recipe_size); - -extern kern_return_t _kernelrpc_mach_port_type_trap( - ipc_space_t task, - mach_port_name_t name, - mach_port_type_t *ptype); - -extern kern_return_t _kernelrpc_mach_port_request_notification_trap( - ipc_space_t task, - mach_port_name_t name, - mach_msg_id_t msgid, - mach_port_mscount_t sync, - mach_port_name_t notify, - mach_msg_type_name_t notifyPoly, - mach_port_name_t *previous); - -/* - * Obsolete interfaces. - */ - -extern kern_return_t task_for_pid( - mach_port_name_t target_tport, - int pid, - mach_port_name_t *t); - -extern kern_return_t task_name_for_pid( - mach_port_name_t target_tport, - int pid, - mach_port_name_t *tn); - -extern kern_return_t pid_for_task( - mach_port_name_t t, - int *x); - -extern kern_return_t debug_control_port_for_pid( - mach_port_name_t target_tport, - int pid, - mach_port_name_t *t); - - -__END_DECLS - -#endif /* _MACH_MACH_TRAPS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/_structs.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/_structs.h deleted file mode 100644 index 0a61125417..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/_structs.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE__STRUCTS_H_ -#define _MACH_MACHINE__STRUCTS_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/_structs.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE__STRUCTS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/boolean.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/boolean.h deleted file mode 100644 index d373913b40..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/boolean.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_BOOLEAN_H_ -#define _MACH_MACHINE_BOOLEAN_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/boolean.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_BOOLEAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/exception.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/exception.h deleted file mode 100644 index f3e960d436..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/exception.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_EXCEPTION_H_ -#define _MACH_MACHINE_EXCEPTION_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/exception.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_EXCEPTION_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/kern_return.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/kern_return.h deleted file mode 100644 index b764492d29..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/kern_return.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_KERN_RETURN_H_ -#define _MACH_MACHINE_KERN_RETURN_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/kern_return.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_KERN_RETURN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/processor_info.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/processor_info.h deleted file mode 100644 index 4e5028d24d..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/processor_info.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_PROCESSOR_INFO_H_ -#define _MACH_MACHINE_PROCESSOR_INFO_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/processor_info.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_PROCESSOR_INFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/thread_state.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/thread_state.h deleted file mode 100644 index 91daad8671..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/thread_state.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_THREAD_STATE_H_ -#define _MACH_MACHINE_THREAD_STATE_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/thread_state.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_THREAD_STATE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/thread_status.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/thread_status.h deleted file mode 100644 index 7e65df246e..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/thread_status.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_THREAD_STATUS_H_ -#define _MACH_MACHINE_THREAD_STATUS_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/thread_status.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_THREAD_STATUS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/vm_param.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/vm_param.h deleted file mode 100644 index 7f272f5b70..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/vm_param.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_VM_PARAM_H_ -#define _MACH_MACHINE_VM_PARAM_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/vm_param.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_VM_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/machine/vm_types.h b/lib/libc/include/x86_64-macos.10-none/mach/machine/vm_types.h deleted file mode 100644 index 5d16a871ea..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/machine/vm_types.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_MACHINE_VM_TYPES_H_ -#define _MACH_MACHINE_VM_TYPES_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "mach/i386/vm_types.h" -#else -#error architecture not supported -#endif - -#endif /* _MACH_MACHINE_VM_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/memory_object_types.h b/lib/libc/include/x86_64-macos.10-none/mach/memory_object_types.h deleted file mode 100644 index fec6e53593..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/memory_object_types.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 2000-2016 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - */ -/* - * File: memory_object.h - * Author: Michael Wayne Young - * - * External memory management interface definition. - */ - -#ifndef _MACH_MEMORY_OBJECT_TYPES_H_ -#define _MACH_MEMORY_OBJECT_TYPES_H_ - -/* - * User-visible types used in the external memory - * management interface: - */ - -#include -#include -#include -#include -#include -#include - -#include - -#define VM_64_BIT_DATA_OBJECTS - -typedef unsigned long long memory_object_offset_t; -typedef unsigned long long memory_object_size_t; -typedef natural_t memory_object_cluster_size_t; -typedef natural_t * memory_object_fault_info_t; - -typedef unsigned long long vm_object_id_t; - - -/* - * Temporary until real EMMI version gets re-implemented - */ - - -typedef mach_port_t memory_object_t; -typedef mach_port_t memory_object_control_t; - - -typedef memory_object_t *memory_object_array_t; -/* A memory object ... */ -/* Used by the kernel to retrieve */ -/* or store data */ - -typedef mach_port_t memory_object_name_t; -/* Used to describe the memory ... */ -/* object in vm_regions() calls */ - -typedef mach_port_t memory_object_default_t; -/* Registered with the host ... */ -/* for creating new internal objects */ - -#define MEMORY_OBJECT_NULL ((memory_object_t) 0) -#define MEMORY_OBJECT_CONTROL_NULL ((memory_object_control_t) 0) -#define MEMORY_OBJECT_NAME_NULL ((memory_object_name_t) 0) -#define MEMORY_OBJECT_DEFAULT_NULL ((memory_object_default_t) 0) - - -typedef int memory_object_copy_strategy_t; -/* How memory manager handles copy: */ -#define MEMORY_OBJECT_COPY_NONE 0 -/* ... No special support */ -#define MEMORY_OBJECT_COPY_CALL 1 -/* ... Make call on memory manager */ -#define MEMORY_OBJECT_COPY_DELAY 2 -/* ... Memory manager doesn't - * change data externally. - */ -#define MEMORY_OBJECT_COPY_TEMPORARY 3 -/* ... Memory manager doesn't - * change data externally, and - * doesn't need to see changes. - */ -#define MEMORY_OBJECT_COPY_SYMMETRIC 4 -/* ... Memory manager doesn't - * change data externally, - * doesn't need to see changes, - * and object will not be - * multiply mapped. - * - * XXX - * Not yet safe for non-kernel use. - */ - -#define MEMORY_OBJECT_COPY_INVALID 5 -/* ... An invalid copy strategy, - * for external objects which - * have not been initialized. - * Allows copy_strategy to be - * examined without also - * examining pager_ready and - * internal. - */ - -typedef int memory_object_return_t; -/* Which pages to return to manager - * this time (lock_request) */ -#define MEMORY_OBJECT_RETURN_NONE 0 -/* ... don't return any. */ -#define MEMORY_OBJECT_RETURN_DIRTY 1 -/* ... only dirty pages. */ -#define MEMORY_OBJECT_RETURN_ALL 2 -/* ... dirty and precious pages. */ -#define MEMORY_OBJECT_RETURN_ANYTHING 3 -/* ... any resident page. */ - -/* - * Data lock request flags - */ - -#define MEMORY_OBJECT_DATA_FLUSH 0x1 -#define MEMORY_OBJECT_DATA_NO_CHANGE 0x2 -#define MEMORY_OBJECT_DATA_PURGE 0x4 -#define MEMORY_OBJECT_COPY_SYNC 0x8 -#define MEMORY_OBJECT_DATA_SYNC 0x10 -#define MEMORY_OBJECT_IO_SYNC 0x20 -#define MEMORY_OBJECT_DATA_FLUSH_ALL 0x40 - -/* - * Types for the memory object flavor interfaces - */ - -#define MEMORY_OBJECT_INFO_MAX (1024) -typedef int *memory_object_info_t; -typedef int memory_object_flavor_t; -typedef int memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX]; - - -#define MEMORY_OBJECT_PERFORMANCE_INFO 11 -#define MEMORY_OBJECT_ATTRIBUTE_INFO 14 -#define MEMORY_OBJECT_BEHAVIOR_INFO 15 - - -struct memory_object_perf_info { - memory_object_cluster_size_t cluster_size; - boolean_t may_cache; -}; - -struct memory_object_attr_info { - memory_object_copy_strategy_t copy_strategy; - memory_object_cluster_size_t cluster_size; - boolean_t may_cache_object; - boolean_t temporary; -}; - -struct memory_object_behave_info { - memory_object_copy_strategy_t copy_strategy; - boolean_t temporary; - boolean_t invalidate; - boolean_t silent_overwrite; - boolean_t advisory_pageout; -}; - - -typedef struct memory_object_behave_info *memory_object_behave_info_t; -typedef struct memory_object_behave_info memory_object_behave_info_data_t; - -typedef struct memory_object_perf_info *memory_object_perf_info_t; -typedef struct memory_object_perf_info memory_object_perf_info_data_t; - -typedef struct memory_object_attr_info *memory_object_attr_info_t; -typedef struct memory_object_attr_info memory_object_attr_info_data_t; - -#define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(memory_object_behave_info_data_t)/sizeof(int))) -#define MEMORY_OBJECT_PERF_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(memory_object_perf_info_data_t)/sizeof(int))) -#define MEMORY_OBJECT_ATTR_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(memory_object_attr_info_data_t)/sizeof(int))) - -#define invalid_memory_object_flavor(f) \ - (f != MEMORY_OBJECT_ATTRIBUTE_INFO && \ - f != MEMORY_OBJECT_PERFORMANCE_INFO && \ - f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO && \ - f != MEMORY_OBJECT_BEHAVIOR_INFO && \ - f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO) - - -/* - * Used to support options on memory_object_release_name call - */ -#define MEMORY_OBJECT_TERMINATE_IDLE 0x1 -#define MEMORY_OBJECT_RESPECT_CACHE 0x2 -#define MEMORY_OBJECT_RELEASE_NO_OP 0x4 - - -/* named entry processor mapping options */ -/* enumerated */ -#define MAP_MEM_NOOP 0 -#define MAP_MEM_COPYBACK 1 -#define MAP_MEM_IO 2 -#define MAP_MEM_WTHRU 3 -#define MAP_MEM_WCOMB 4 /* Write combining mode */ - /* aka store gather */ -#define MAP_MEM_INNERWBACK 5 -#define MAP_MEM_POSTED 6 -#define MAP_MEM_RT 7 -#define MAP_MEM_POSTED_REORDERED 8 -#define MAP_MEM_POSTED_COMBINED_REORDERED 9 - -#define GET_MAP_MEM(flags) \ - ((((unsigned int)(flags)) >> 24) & 0xFF) - -#define SET_MAP_MEM(caching, flags) \ - ((flags) = ((((unsigned int)(caching)) << 24) \ - & 0xFF000000) | ((flags) & 0xFFFFFF)); - -/* leave room for vm_prot bits (0xFF ?) */ -#define MAP_MEM_LEDGER_TAGGED 0x002000 /* object owned by a specific task and ledger */ -#define MAP_MEM_PURGABLE_KERNEL_ONLY 0x004000 /* volatility controlled by kernel */ -#define MAP_MEM_GRAB_SECLUDED 0x008000 /* can grab secluded pages */ -#define MAP_MEM_ONLY 0x010000 /* change processor caching */ -#define MAP_MEM_NAMED_CREATE 0x020000 /* create extant object */ -#define MAP_MEM_PURGABLE 0x040000 /* create a purgable VM object */ -#define MAP_MEM_NAMED_REUSE 0x080000 /* reuse provided entry if identical */ -#define MAP_MEM_USE_DATA_ADDR 0x100000 /* preserve address of data, rather than base of page */ -#define MAP_MEM_VM_COPY 0x200000 /* make a copy of a VM range */ -#define MAP_MEM_VM_SHARE 0x400000 /* extract a VM range for remap */ -#define MAP_MEM_4K_DATA_ADDR 0x800000 /* preserve 4K aligned address of data */ - -#define MAP_MEM_FLAGS_MASK 0x00FFFF00 -#define MAP_MEM_FLAGS_USER ( \ - MAP_MEM_PURGABLE_KERNEL_ONLY | \ - MAP_MEM_GRAB_SECLUDED | \ - MAP_MEM_ONLY | \ - MAP_MEM_NAMED_CREATE | \ - MAP_MEM_PURGABLE | \ - MAP_MEM_NAMED_REUSE | \ - MAP_MEM_USE_DATA_ADDR | \ - MAP_MEM_VM_COPY | \ - MAP_MEM_VM_SHARE | \ - MAP_MEM_LEDGER_TAGGED | \ - MAP_MEM_4K_DATA_ADDR) -#define MAP_MEM_FLAGS_ALL ( \ - MAP_MEM_FLAGS_USER) - - -#endif /* _MACH_MEMORY_OBJECT_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/mig.h b/lib/libc/include/x86_64-macos.10-none/mach/mig.h deleted file mode 100644 index aa7bcf7448..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/mig.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ - -/* - * Mach MIG Subsystem Interfaces - */ - -#ifndef _MACH_MIG_H_ -#define _MACH_MIG_H_ - -#include -#include -#include -#include - -#include - -#if defined(MACH_KERNEL) - -#if !defined(__MigTypeCheck) -/* Turn MIG type checking on by default for kernel */ -#define __MigTypeCheck 1 -#endif - -#define __MigKernelSpecificCode 1 -#define _MIG_KERNEL_SPECIFIC_CODE_ 1 - -#elif !defined(__MigTypeCheck) - -#if defined(TypeCheck) -/* use legacy setting (temporary) */ -#define __MigTypeCheck TypeCheck -#else -/* default MIG type checking on */ -#define __MigTypeCheck 1 -#endif - -#endif /* !defined(MACH_KERNEL) && !defined(__MigTypeCheck) */ - -/* - * Pack MIG message structs. - * This is an indicator of the need to view shared structs in a - * binary-compatible format - and MIG message structs are no different. - */ -#define __MigPackStructs 1 - -/* - * Definition for MIG-generated server stub routines. These routines - * unpack the request message, call the server procedure, and pack the - * reply message. - */ -typedef void (*mig_stub_routine_t) (mach_msg_header_t *InHeadP, - mach_msg_header_t *OutHeadP); - -typedef mig_stub_routine_t mig_routine_t; - -/* - * Definition for MIG-generated server routine. This routine takes a - * message, and returns the appropriate stub function for handling that - * message. - */ -typedef mig_routine_t (*mig_server_routine_t) (mach_msg_header_t *InHeadP); - -/* - * Generic definition for implementation routines. These routines do - * the real work associated with this request. This generic type is - * used for keeping the pointers in the subsystem array. - */ -typedef kern_return_t (*mig_impl_routine_t)(void); - -typedef mach_msg_type_descriptor_t routine_arg_descriptor; -typedef mach_msg_type_descriptor_t *routine_arg_descriptor_t; -typedef mach_msg_type_descriptor_t *mig_routine_arg_descriptor_t; - -#define MIG_ROUTINE_ARG_DESCRIPTOR_NULL ((mig_routine_arg_descriptor_t)0) - -struct routine_descriptor { - mig_impl_routine_t impl_routine; /* Server work func pointer */ - mig_stub_routine_t stub_routine; /* Unmarshalling func pointer */ - unsigned int argc; /* Number of argument words */ - unsigned int descr_count; /* Number complex descriptors */ - routine_arg_descriptor_t - arg_descr; /* pointer to descriptor array*/ - unsigned int max_reply_msg; /* Max size for reply msg */ -}; -typedef struct routine_descriptor *routine_descriptor_t; - -typedef struct routine_descriptor mig_routine_descriptor; -typedef mig_routine_descriptor *mig_routine_descriptor_t; - -#define MIG_ROUTINE_DESCRIPTOR_NULL ((mig_routine_descriptor_t)0) - -typedef struct mig_subsystem { - mig_server_routine_t server; /* pointer to demux routine */ - mach_msg_id_t start; /* Min routine number */ - mach_msg_id_t end; /* Max routine number + 1 */ - mach_msg_size_t maxsize; /* Max reply message size */ - vm_address_t reserved; /* reserved for MIG use */ - mig_routine_descriptor - routine[1]; /* Routine descriptor array */ -} *mig_subsystem_t; - -#define MIG_SUBSYSTEM_NULL ((mig_subsystem_t)0) - -typedef struct mig_symtab { - char *ms_routine_name; - int ms_routine_number; - void (*ms_routine)(void); /* Since the functions in the - * symbol table have unknown - * signatures, this is the best - * we can do... - */ -} mig_symtab_t; - -/* - * A compiler attribute for annotating all MIG server routines and other - * functions that should behave similarly. Allows the compiler to perform - * additional static bug-finding over them. - */ -#if __has_attribute(mig_server_routine) -#define MIG_SERVER_ROUTINE __attribute__((mig_server_routine)) -#else -#define MIG_SERVER_ROUTINE -#endif - - -__BEGIN_DECLS - -/* Client side reply port allocate */ -extern mach_port_t mig_get_reply_port(void); - -/* Client side reply port deallocate */ -extern void mig_dealloc_reply_port(mach_port_t reply_port); - -/* Client side reply port "deallocation" */ -extern void mig_put_reply_port(mach_port_t reply_port); - -/* Bounded string copy */ -extern int mig_strncpy(char *dest, const char *src, int len); -extern int mig_strncpy_zerofill(char *dest, const char *src, int len); - - -/* Allocate memory for out-of-line mig structures */ -extern void mig_allocate(vm_address_t *, vm_size_t); - -/* Deallocate memory used for out-of-line mig structures */ -extern void mig_deallocate(vm_address_t, vm_size_t); - - -__END_DECLS - -#endif /* _MACH_MIG_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/task_info.h b/lib/libc/include/x86_64-macos.10-none/mach/task_info.h deleted file mode 100644 index 5b2046a700..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/task_info.h +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Copyright (c) 2000-2007, 2015 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Machine-independent task information structures and definitions. - * - * The definitions in this file are exported to the user. The kernel - * will translate its internal data structures to these structures - * as appropriate. - * - */ - -#ifndef _MACH_TASK_INFO_H_ -#define _MACH_TASK_INFO_H_ - -#include -#include -#include -#include -#include /* for vm_extmod_statistics_data_t */ -#include - -#include - -/* - * Generic information structure to allow for expansion. - */ -typedef natural_t task_flavor_t; -typedef integer_t *task_info_t; /* varying array of int */ - -/* Deprecated, use per structure _data_t's instead */ -#define TASK_INFO_MAX (1024) /* maximum array size */ -typedef integer_t task_info_data_t[TASK_INFO_MAX]; - -/* - * Currently defined information structures. - */ - -#pragma pack(push, 4) - -/* Don't use this, use MACH_TASK_BASIC_INFO instead */ -#define TASK_BASIC_INFO_32 4 /* basic information */ -#define TASK_BASIC2_INFO_32 6 - -struct task_basic_info_32 { - integer_t suspend_count; /* suspend count for task */ - natural_t virtual_size; /* virtual memory size (bytes) */ - natural_t resident_size; /* resident memory size (bytes) */ - time_value_t user_time; /* total user run time for - * terminated threads */ - time_value_t system_time; /* total system run time for - * terminated threads */ - policy_t policy; /* default policy for new threads */ -}; -typedef struct task_basic_info_32 task_basic_info_32_data_t; -typedef struct task_basic_info_32 *task_basic_info_32_t; -#define TASK_BASIC_INFO_32_COUNT \ - (sizeof(task_basic_info_32_data_t) / sizeof(natural_t)) - -/* Don't use this, use MACH_TASK_BASIC_INFO instead */ -struct task_basic_info_64 { - integer_t suspend_count; /* suspend count for task */ - mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ - mach_vm_size_t resident_size; /* resident memory size (bytes) */ - time_value_t user_time; /* total user run time for - * terminated threads */ - time_value_t system_time; /* total system run time for - * terminated threads */ - policy_t policy; /* default policy for new threads */ -}; -typedef struct task_basic_info_64 task_basic_info_64_data_t; -typedef struct task_basic_info_64 *task_basic_info_64_t; - -#define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */ -#define TASK_BASIC_INFO_64_COUNT \ - (sizeof(task_basic_info_64_data_t) / sizeof(natural_t)) - - -/* localized structure - cannot be safely passed between tasks of differing sizes */ -/* Don't use this, use MACH_TASK_BASIC_INFO instead */ -struct task_basic_info { - integer_t suspend_count; /* suspend count for task */ - vm_size_t virtual_size; /* virtual memory size (bytes) */ - vm_size_t resident_size; /* resident memory size (bytes) */ - time_value_t user_time; /* total user run time for - * terminated threads */ - time_value_t system_time; /* total system run time for - * terminated threads */ - policy_t policy; /* default policy for new threads */ -}; - -typedef struct task_basic_info task_basic_info_data_t; -typedef struct task_basic_info *task_basic_info_t; -#define TASK_BASIC_INFO_COUNT \ - (sizeof(task_basic_info_data_t) / sizeof(natural_t)) -#if !defined(__LP64__) -#define TASK_BASIC_INFO TASK_BASIC_INFO_32 -#else -#define TASK_BASIC_INFO TASK_BASIC_INFO_64 -#endif - - - -#define TASK_EVENTS_INFO 2 /* various event counts */ - -struct task_events_info { - integer_t faults; /* number of page faults */ - integer_t pageins; /* number of actual pageins */ - integer_t cow_faults; /* number of copy-on-write faults */ - integer_t messages_sent; /* number of messages sent */ - integer_t messages_received; /* number of messages received */ - integer_t syscalls_mach; /* number of mach system calls */ - integer_t syscalls_unix; /* number of unix system calls */ - integer_t csw; /* number of context switches */ -}; -typedef struct task_events_info task_events_info_data_t; -typedef struct task_events_info *task_events_info_t; -#define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(task_events_info_data_t) / sizeof(natural_t))) - -#define TASK_THREAD_TIMES_INFO 3 /* total times for live threads - - * only accurate if suspended */ - -struct task_thread_times_info { - time_value_t user_time; /* total user run time for - * live threads */ - time_value_t system_time; /* total system run time for - * live threads */ -}; - -typedef struct task_thread_times_info task_thread_times_info_data_t; -typedef struct task_thread_times_info *task_thread_times_info_t; -#define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(task_thread_times_info_data_t) / sizeof(natural_t))) - -#define TASK_ABSOLUTETIME_INFO 1 - -struct task_absolutetime_info { - uint64_t total_user; - uint64_t total_system; - uint64_t threads_user; /* existing threads only */ - uint64_t threads_system; -}; - -typedef struct task_absolutetime_info task_absolutetime_info_data_t; -typedef struct task_absolutetime_info *task_absolutetime_info_t; -#define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof (task_absolutetime_info_data_t) / sizeof (natural_t))) - -#define TASK_KERNELMEMORY_INFO 7 - -struct task_kernelmemory_info { - uint64_t total_palloc; /* private kernel mem alloc'ed */ - uint64_t total_pfree; /* private kernel mem freed */ - uint64_t total_salloc; /* shared kernel mem alloc'ed */ - uint64_t total_sfree; /* shared kernel mem freed */ -}; - -typedef struct task_kernelmemory_info task_kernelmemory_info_data_t; -typedef struct task_kernelmemory_info *task_kernelmemory_info_t; -#define TASK_KERNELMEMORY_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof (task_kernelmemory_info_data_t) / sizeof (natural_t))) - -#define TASK_SECURITY_TOKEN 13 -#define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \ - (sizeof(security_token_t) / sizeof(natural_t))) - -#define TASK_AUDIT_TOKEN 15 -#define TASK_AUDIT_TOKEN_COUNT \ - (sizeof(audit_token_t) / sizeof(natural_t)) - - -#define TASK_AFFINITY_TAG_INFO 16 /* This is experimental. */ - -struct task_affinity_tag_info { - integer_t set_count; - integer_t min; - integer_t max; - integer_t task_count; -}; -typedef struct task_affinity_tag_info task_affinity_tag_info_data_t; -typedef struct task_affinity_tag_info *task_affinity_tag_info_t; -#define TASK_AFFINITY_TAG_INFO_COUNT \ - (sizeof(task_affinity_tag_info_data_t) / sizeof(natural_t)) - -#define TASK_DYLD_INFO 17 - -struct task_dyld_info { - mach_vm_address_t all_image_info_addr; - mach_vm_size_t all_image_info_size; - integer_t all_image_info_format; -}; -typedef struct task_dyld_info task_dyld_info_data_t; -typedef struct task_dyld_info *task_dyld_info_t; -#define TASK_DYLD_INFO_COUNT \ - (sizeof(task_dyld_info_data_t) / sizeof(natural_t)) -#define TASK_DYLD_ALL_IMAGE_INFO_32 0 /* format value */ -#define TASK_DYLD_ALL_IMAGE_INFO_64 1 /* format value */ - - -#define TASK_EXTMOD_INFO 19 - -struct task_extmod_info { - unsigned char task_uuid[16]; - vm_extmod_statistics_data_t extmod_statistics; -}; -typedef struct task_extmod_info task_extmod_info_data_t; -typedef struct task_extmod_info *task_extmod_info_t; -#define TASK_EXTMOD_INFO_COUNT \ - (sizeof(task_extmod_info_data_t) / sizeof(natural_t)) - - -#define MACH_TASK_BASIC_INFO 20 /* always 64-bit basic info */ -struct mach_task_basic_info { - mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ - mach_vm_size_t resident_size; /* resident memory size (bytes) */ - mach_vm_size_t resident_size_max; /* maximum resident memory size (bytes) */ - time_value_t user_time; /* total user run time for - * terminated threads */ - time_value_t system_time; /* total system run time for - * terminated threads */ - policy_t policy; /* default policy for new threads */ - integer_t suspend_count; /* suspend count for task */ -}; -typedef struct mach_task_basic_info mach_task_basic_info_data_t; -typedef struct mach_task_basic_info *mach_task_basic_info_t; -#define MACH_TASK_BASIC_INFO_COUNT \ - (sizeof(mach_task_basic_info_data_t) / sizeof(natural_t)) - - -#define TASK_POWER_INFO 21 - -struct task_power_info { - uint64_t total_user; - uint64_t total_system; - uint64_t task_interrupt_wakeups; - uint64_t task_platform_idle_wakeups; - uint64_t task_timer_wakeups_bin_1; - uint64_t task_timer_wakeups_bin_2; -}; - -typedef struct task_power_info task_power_info_data_t; -typedef struct task_power_info *task_power_info_t; -#define TASK_POWER_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof (task_power_info_data_t) / sizeof (natural_t))) - - - -#define TASK_VM_INFO 22 -#define TASK_VM_INFO_PURGEABLE 23 -struct task_vm_info { - mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ - integer_t region_count; /* number of memory regions */ - integer_t page_size; - mach_vm_size_t resident_size; /* resident memory size (bytes) */ - mach_vm_size_t resident_size_peak; /* peak resident size (bytes) */ - - mach_vm_size_t device; - mach_vm_size_t device_peak; - mach_vm_size_t internal; - mach_vm_size_t internal_peak; - mach_vm_size_t external; - mach_vm_size_t external_peak; - mach_vm_size_t reusable; - mach_vm_size_t reusable_peak; - mach_vm_size_t purgeable_volatile_pmap; - mach_vm_size_t purgeable_volatile_resident; - mach_vm_size_t purgeable_volatile_virtual; - mach_vm_size_t compressed; - mach_vm_size_t compressed_peak; - mach_vm_size_t compressed_lifetime; - - /* added for rev1 */ - mach_vm_size_t phys_footprint; - - /* added for rev2 */ - mach_vm_address_t min_address; - mach_vm_address_t max_address; - - /* added for rev3 */ - int64_t ledger_phys_footprint_peak; - int64_t ledger_purgeable_nonvolatile; - int64_t ledger_purgeable_novolatile_compressed; - int64_t ledger_purgeable_volatile; - int64_t ledger_purgeable_volatile_compressed; - int64_t ledger_tag_network_nonvolatile; - int64_t ledger_tag_network_nonvolatile_compressed; - int64_t ledger_tag_network_volatile; - int64_t ledger_tag_network_volatile_compressed; - int64_t ledger_tag_media_footprint; - int64_t ledger_tag_media_footprint_compressed; - int64_t ledger_tag_media_nofootprint; - int64_t ledger_tag_media_nofootprint_compressed; - int64_t ledger_tag_graphics_footprint; - int64_t ledger_tag_graphics_footprint_compressed; - int64_t ledger_tag_graphics_nofootprint; - int64_t ledger_tag_graphics_nofootprint_compressed; - int64_t ledger_tag_neural_footprint; - int64_t ledger_tag_neural_footprint_compressed; - int64_t ledger_tag_neural_nofootprint; - int64_t ledger_tag_neural_nofootprint_compressed; - - /* added for rev4 */ - uint64_t limit_bytes_remaining; - - /* added for rev5 */ - integer_t decompressions; -}; -typedef struct task_vm_info task_vm_info_data_t; -typedef struct task_vm_info *task_vm_info_t; -#define TASK_VM_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof (task_vm_info_data_t) / sizeof (natural_t))) -#define TASK_VM_INFO_REV5_COUNT TASK_VM_INFO_COUNT -#define TASK_VM_INFO_REV4_COUNT /* doesn't include decompressions */ \ - ((mach_msg_type_number_t) (TASK_VM_INFO_REV5_COUNT - 1)) -#define TASK_VM_INFO_REV3_COUNT /* doesn't include limit bytes */ \ - ((mach_msg_type_number_t) (TASK_VM_INFO_REV4_COUNT - 2)) -#define TASK_VM_INFO_REV2_COUNT /* doesn't include extra ledgers info */ \ - ((mach_msg_type_number_t) (TASK_VM_INFO_REV3_COUNT - 42)) -#define TASK_VM_INFO_REV1_COUNT /* doesn't include min and max address */ \ - ((mach_msg_type_number_t) (TASK_VM_INFO_REV2_COUNT - 4)) -#define TASK_VM_INFO_REV0_COUNT /* doesn't include phys_footprint */ \ - ((mach_msg_type_number_t) (TASK_VM_INFO_REV1_COUNT - 2)) - -typedef struct vm_purgeable_info task_purgable_info_t; - - -#define TASK_TRACE_MEMORY_INFO 24 -struct task_trace_memory_info { - uint64_t user_memory_address; /* address of start of trace memory buffer */ - uint64_t buffer_size; /* size of buffer in bytes */ - uint64_t mailbox_array_size; /* size of mailbox area in bytes */ -}; -typedef struct task_trace_memory_info task_trace_memory_info_data_t; -typedef struct task_trace_memory_info * task_trace_memory_info_t; -#define TASK_TRACE_MEMORY_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(task_trace_memory_info_data_t) / sizeof(natural_t))) - -#define TASK_WAIT_STATE_INFO 25 /* deprecated. */ -struct task_wait_state_info { - uint64_t total_wait_state_time; /* Time that all threads past and present have been in a wait state */ - uint64_t total_wait_sfi_state_time; /* Time that threads have been in SFI wait (should be a subset of total wait state time */ - uint32_t _reserved[4]; -}; -typedef struct task_wait_state_info task_wait_state_info_data_t; -typedef struct task_wait_state_info * task_wait_state_info_t; -#define TASK_WAIT_STATE_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(task_wait_state_info_data_t) / sizeof(natural_t))) - -#define TASK_POWER_INFO_V2 26 - -typedef struct { - uint64_t task_gpu_utilisation; - uint64_t task_gpu_stat_reserved0; - uint64_t task_gpu_stat_reserved1; - uint64_t task_gpu_stat_reserved2; -} gpu_energy_data; - -typedef gpu_energy_data *gpu_energy_data_t; -struct task_power_info_v2 { - task_power_info_data_t cpu_energy; - gpu_energy_data gpu_energy; - uint64_t task_ptime; - uint64_t task_pset_switches; -}; - -typedef struct task_power_info_v2 task_power_info_v2_data_t; -typedef struct task_power_info_v2 *task_power_info_v2_t; -#define TASK_POWER_INFO_V2_COUNT_OLD \ - ((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) - sizeof(uint64_t)*2) / sizeof (natural_t)) -#define TASK_POWER_INFO_V2_COUNT \ - ((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) / sizeof (natural_t))) - -#define TASK_VM_INFO_PURGEABLE_ACCOUNT 27 /* Used for xnu purgeable vm unit tests */ - - -#define TASK_FLAGS_INFO 28 /* return t_flags field */ -struct task_flags_info { - uint32_t flags; /* task flags */ -}; -typedef struct task_flags_info task_flags_info_data_t; -typedef struct task_flags_info * task_flags_info_t; -#define TASK_FLAGS_INFO_COUNT ((mach_msg_type_number_t) \ - (sizeof(task_flags_info_data_t) / sizeof (natural_t))) - -#define TF_LP64 0x00000001 /* task has 64-bit addressing */ -#define TF_64B_DATA 0x00000002 /* task has 64-bit data registers */ - -#define TASK_DEBUG_INFO_INTERNAL 29 /* Used for kernel internal development tests. */ - - -/* - * Type to control EXC_GUARD delivery options for a task - * via task_get/set_exc_guard_behavior interface(s). - */ -typedef uint32_t task_exc_guard_behavior_t; - -/* EXC_GUARD optional delivery settings on a per-task basis */ -#define TASK_EXC_GUARD_VM_DELIVER 0x01 /* Deliver virtual memory EXC_GUARD exceptions */ -#define TASK_EXC_GUARD_VM_ONCE 0x02 /* Deliver them only once */ -#define TASK_EXC_GUARD_VM_CORPSE 0x04 /* Deliver them via a forked corpse */ -#define TASK_EXC_GUARD_VM_FATAL 0x08 /* Virtual Memory EXC_GUARD delivery is fatal */ -#define TASK_EXC_GUARD_VM_ALL 0x0f - -#define TASK_EXC_GUARD_MP_DELIVER 0x10 /* Deliver mach port EXC_GUARD exceptions */ -#define TASK_EXC_GUARD_MP_ONCE 0x20 /* Deliver them only once */ -#define TASK_EXC_GUARD_MP_CORPSE 0x40 /* Deliver them via a forked corpse */ -#define TASK_EXC_GUARD_MP_FATAL 0x80 /* mach port EXC_GUARD delivery is fatal */ -#define TASK_EXC_GUARD_MP_ALL 0xf0 - -#define TASK_EXC_GUARD_ALL 0xff /* All optional deliver settings */ - - -/* - * Obsolete interfaces. - */ - -#define TASK_SCHED_TIMESHARE_INFO 10 -#define TASK_SCHED_RR_INFO 11 -#define TASK_SCHED_FIFO_INFO 12 - -#define TASK_SCHED_INFO 14 - -#pragma pack(pop) - -#endif /* _MACH_TASK_INFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/task_inspect.h b/lib/libc/include/x86_64-macos.10-none/mach/task_inspect.h deleted file mode 100644 index 1ae3c6e5f1..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/task_inspect.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef MACH_TASK_INSPECT_H -#define MACH_TASK_INSPECT_H - -/* - * XXX These interfaces are still in development -- they are subject to change - * without notice. - */ - -typedef natural_t task_inspect_flavor_t; - -enum task_inspect_flavor { - TASK_INSPECT_BASIC_COUNTS = 1, -}; - -struct task_inspect_basic_counts { - uint64_t instructions; - uint64_t cycles; -}; -#define TASK_INSPECT_BASIC_COUNTS_COUNT \ - (sizeof(struct task_inspect_basic_counts) / sizeof(natural_t)) -typedef struct task_inspect_basic_counts task_inspect_basic_counts_data_t; -typedef struct task_inspect_basic_counts *task_inspect_basic_counts_t; - -typedef integer_t *task_inspect_info_t; - -#endif /* !defined(MACH_TASK_INSPECT_H) */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/task_special_ports.h b/lib/libc/include/x86_64-macos.10-none/mach/task_special_ports.h deleted file mode 100644 index f8ee7c2bbf..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/task_special_ports.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2000-2010 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - */ -/* - * File: mach/task_special_ports.h - * - * Defines codes for special_purpose task ports. These are NOT - * port identifiers - they are only used for the task_get_special_port - * and task_set_special_port routines. - * - */ - -#ifndef _MACH_TASK_SPECIAL_PORTS_H_ -#define _MACH_TASK_SPECIAL_PORTS_H_ - -typedef int task_special_port_t; - -#define TASK_KERNEL_PORT 1 /* Represents task to the outside - * world.*/ - -#define TASK_HOST_PORT 2 /* The host (priv) port for task. */ - -#define TASK_NAME_PORT 3 /* the name (unpriv) port for task */ - -#define TASK_BOOTSTRAP_PORT 4 /* Bootstrap environment for task. */ - -/* - * Evolving and likely to change. - */ - -#define TASK_SEATBELT_PORT 7 /* Seatbelt compiler/DEM port for task. */ - -/* PORT 8 was the GSSD TASK PORT which transformed to a host port */ - -#define TASK_ACCESS_PORT 9 /* Permission check for task_for_pid. */ - -#define TASK_DEBUG_CONTROL_PORT 10 /* debug control port */ - -#define TASK_RESOURCE_NOTIFY_PORT 11 /* overrides host special RN port */ - -#define TASK_MAX_SPECIAL_PORT TASK_RESOURCE_NOTIFY_PORT - -/* - * Definitions for ease of use - */ - -#define task_get_kernel_port(task, port) \ - (task_get_special_port((task), TASK_KERNEL_PORT, (port))) - -#define task_set_kernel_port(task, port) \ - (task_set_special_port((task), TASK_KERNEL_PORT, (port))) - -#define task_get_host_port(task, port) \ - (task_get_special_port((task), TASK_HOST_PORT, (port))) - -#define task_set_host_port(task, port) \ - (task_set_special_port((task), TASK_HOST_PORT, (port))) - -#define task_get_bootstrap_port(task, port) \ - (task_get_special_port((task), TASK_BOOTSTRAP_PORT, (port))) - -#define task_get_debug_control_port(task, port) \ - (task_get_special_port((task), TASK_DEBUG_CONTROL_PORT, (port))) - -#define task_set_bootstrap_port(task, port) \ - (task_set_special_port((task), TASK_BOOTSTRAP_PORT, (port))) - -#define task_get_task_access_port(task, port) \ - (task_get_special_port((task), TASK_ACCESS_PORT, (port))) - -#define task_set_task_access_port(task, port) \ - (task_set_special_port((task), TASK_ACCESS_PORT, (port))) - -#define task_set_task_debug_control_port(task, port) \ - (task_set_special_port((task), TASK_DEBUG_CONTROL_PORT, (port))) - - -#endif /* _MACH_TASK_SPECIAL_PORTS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/thread_state.h b/lib/libc/include/x86_64-macos.10-none/mach/thread_state.h deleted file mode 100644 index 33b38b8665..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/thread_state.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2015 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _MACH_THREAD_STATE_H_ -#define _MACH_THREAD_STATE_H_ - -#include -#include - -#ifndef KERNEL -/* - * Gets all register values in the target thread with pointer-like contents. - * - * There is no guarantee that the returned values are valid pointers, but all - * valid pointers will be returned. The order and count of the provided - * register values is unspecified and may change; registers with values that - * are not valid pointers may be omitted, so the number of pointers returned - * may vary from call to call. - * - * sp is an out parameter that will contain the stack pointer. - * length is an in/out parameter for the length of the values array. - * values is an array of pointers. - * - * This may only be called on threads in the current task. If the current - * platform defines a stack red zone, the stack pointer returned will be - * adjusted to account for red zone. - * - * If length is insufficient, KERN_INSUFFICIENT_BUFFER_SIZE will be returned - * and length set to the amount of memory required. Callers MUST NOT assume - * that any particular size of buffer will be sufficient and should retry with - * an appropriately sized buffer upon this error. - */ -__API_AVAILABLE(macosx(10.14), ios(12.0), tvos(9.0), watchos(5.0)) -kern_return_t thread_get_register_pointer_values(thread_t thread, - uintptr_t *sp, size_t *length, uintptr_t *values); -#endif - -#endif /* _MACH_THREAD_STATE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/thread_status.h b/lib/libc/include/x86_64-macos.10-none/mach/thread_status.h deleted file mode 100644 index 886cae365c..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach/thread_status.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - */ -/* - * File: mach/thread_status.h - * Author: Avadis Tevanian, Jr. - * - * This file contains the structure definitions for the user-visible - * thread state. This thread state is examined with the thread_get_state - * kernel call and may be changed with the thread_set_state kernel call. - * - */ - -#ifndef _MACH_THREAD_STATUS_H_ -#define _MACH_THREAD_STATUS_H_ - -/* - * The actual structure that comprises the thread state is defined - * in the machine dependent module. - */ -#include -#include -#include - -/* - * Generic definition for machine-dependent thread status. - */ - -typedef natural_t *thread_state_t; /* Variable-length array */ - -/* THREAD_STATE_MAX is now defined in */ -typedef natural_t thread_state_data_t[THREAD_STATE_MAX]; - -#define THREAD_STATE_FLAVOR_LIST 0 /* List of valid flavors */ -#define THREAD_STATE_FLAVOR_LIST_NEW 128 -#define THREAD_STATE_FLAVOR_LIST_10_9 129 -#define THREAD_STATE_FLAVOR_LIST_10_13 130 -#define THREAD_STATE_FLAVOR_LIST_10_15 131 - -typedef int thread_state_flavor_t; -typedef thread_state_flavor_t *thread_state_flavor_array_t; - -#endif /* _MACH_THREAD_STATUS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach_debug/mach_debug_types.h b/lib/libc/include/x86_64-macos.10-none/mach_debug/mach_debug_types.h deleted file mode 100644 index a4a2f3d7c7..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/mach_debug/mach_debug_types.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * @OSF_COPYRIGHT@ - */ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - */ -/* - * Mach kernel debugging interface type declarations - */ - -#ifndef _MACH_DEBUG_MACH_DEBUG_TYPES_H_ -#define _MACH_DEBUG_MACH_DEBUG_TYPES_H_ - -#include -#include -#include -#include -#include -#include - -#define MACH_CORE_FILEHEADER_SIGNATURE 0x0063614d20646152ULL -#define MACH_CORE_FILEHEADER_MAXFILES 16 -#define MACH_CORE_FILEHEADER_NAMELEN 16 - -typedef char symtab_name_t[32]; - -struct mach_core_details { - uint64_t gzip_offset; - uint64_t gzip_length; - char core_name[MACH_CORE_FILEHEADER_NAMELEN]; -}; - -struct mach_core_fileheader { - uint64_t signature; - uint64_t log_offset; - uint64_t log_length; - uint64_t num_files; - struct mach_core_details files[MACH_CORE_FILEHEADER_MAXFILES]; -}; - -#define KOBJECT_DESCRIPTION_LENGTH 512 -typedef char kobject_description_t[KOBJECT_DESCRIPTION_LENGTH]; - -#endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/_mcontext.h b/lib/libc/include/x86_64-macos.10-none/machine/_mcontext.h deleted file mode 100644 index 9ccd985fcc..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/machine/_mcontext.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#if defined (__i386__) || defined (__x86_64__) -#include "i386/_mcontext.h" -#else -#error architecture not supported -#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/_param.h b/lib/libc/include/x86_64-macos.10-none/machine/_param.h deleted file mode 100644 index c40232c3c2..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/machine/_param.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2004-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#if defined (__i386__) || defined (__x86_64__) -#include "i386/_param.h" -#else -#error architecture not supported -#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/_types.h b/lib/libc/include/x86_64-macos.10-none/machine/_types.h deleted file mode 100644 index 0ed6acf677..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/machine/_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2003-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _BSD_MACHINE__TYPES_H_ -#define _BSD_MACHINE__TYPES_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "i386/_types.h" -#else -#error architecture not supported -#endif - -#endif /* _BSD_MACHINE__TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/endian.h b/lib/libc/include/x86_64-macos.10-none/machine/endian.h deleted file mode 100644 index 85c8f12508..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/machine/endian.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * Copyright 1995 NeXT Computer, Inc. All rights reserved. - */ -#ifndef _BSD_MACHINE_ENDIAN_H_ -#define _BSD_MACHINE_ENDIAN_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "i386/endian.h" -#else -#error architecture not supported -#endif - -#endif /* _BSD_MACHINE_ENDIAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/limits.h b/lib/libc/include/x86_64-macos.10-none/machine/limits.h deleted file mode 100644 index 9763e810b6..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/machine/limits.h +++ /dev/null @@ -1,9 +0,0 @@ -/* This is the `system' limits.h, independent of any particular - * compiler. GCC provides its own limits.h which can be found in - * /usr/lib/gcc, although it is not very informative. - * This file is public domain. */ -#if defined (__i386__) || defined(__x86_64__) -#include -#else -#error architecture not supported -#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/param.h b/lib/libc/include/x86_64-macos.10-none/machine/param.h deleted file mode 100644 index 8435acbdfb..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/machine/param.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * Copyright 1995 NeXT Computer, Inc. All rights reserved. - */ -#ifndef _BSD_MACHINE_PARAM_H_ -#define _BSD_MACHINE_PARAM_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "i386/param.h" -#else -#error architecture not supported -#endif - -#endif /* _BSD_MACHINE_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/machine/signal.h b/lib/libc/include/x86_64-macos.10-none/machine/signal.h deleted file mode 100644 index 19ef535ebd..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/machine/signal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _BSD_MACHINE_SIGNAL_H_ -#define _BSD_MACHINE_SIGNAL_H_ - -#if defined (__i386__) || defined(__x86_64__) -#include "i386/signal.h" -#else -#error architecture not supported -#endif - -#endif /* _BSD_MACHINE_SIGNAL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/malloc/_malloc.h b/lib/libc/include/x86_64-macos.10-none/malloc/_malloc.h deleted file mode 100644 index 91555d11bb..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/malloc/_malloc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _MALLOC_UNDERSCORE_MALLOC_H_ -#define _MALLOC_UNDERSCORE_MALLOC_H_ - -/* - * This header is included from , so the contents of this file have - * broad source compatibility and POSIX conformance implications. - * Be cautious about what is included and declared here. - */ - -#include -#include -#include <_types.h> -#include - -__BEGIN_DECLS - -void *malloc(size_t __size) __result_use_check __alloc_size(1); -void *calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2); -void free(void *); -void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2); -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -void *valloc(size_t) __alloc_size(1); -#endif // !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) && \ - ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ - (defined(__cplusplus) && __cplusplus >= 201703L)) -void *aligned_alloc(size_t __alignment, size_t __size) __result_use_check __alloc_size(2) __OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0); -#endif -int posix_memalign(void **__memptr, size_t __alignment, size_t __size) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); - -__END_DECLS - -#endif /* _MALLOC_UNDERSCORE_MALLOC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/math.h b/lib/libc/include/x86_64-macos.10-none/math.h deleted file mode 100644 index 8bb019247e..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/math.h +++ /dev/null @@ -1,771 +0,0 @@ -/* - * Copyright (c) 2002-2017 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef __MATH_H__ -#define __MATH_H__ - -#ifndef __MATH__ -#define __MATH__ -#endif - -#include -#include - -__BEGIN_DECLS - -/****************************************************************************** - * Floating point data types * - ******************************************************************************/ - -/* Define float_t and double_t per C standard, ISO/IEC 9899:2011 7.12 2, - taking advantage of GCC's __FLT_EVAL_METHOD__ (which a compiler may - define anytime and GCC does) that shadows FLT_EVAL_METHOD (which a - compiler must define only in float.h). */ -#if __FLT_EVAL_METHOD__ == 0 - typedef float float_t; - typedef double double_t; -#elif __FLT_EVAL_METHOD__ == 1 - typedef double float_t; - typedef double double_t; -#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1 - typedef long double float_t; - typedef long double double_t; -#else /* __FLT_EVAL_METHOD__ */ -# error "Unsupported value of __FLT_EVAL_METHOD__." -#endif /* __FLT_EVAL_METHOD__ */ - -#if defined(__GNUC__) -# define HUGE_VAL __builtin_huge_val() -# define HUGE_VALF __builtin_huge_valf() -# define HUGE_VALL __builtin_huge_vall() -# define NAN __builtin_nanf("0x7fc00000") -#else -# define HUGE_VAL 1e500 -# define HUGE_VALF 1e50f -# define HUGE_VALL 1e5000L -# define NAN __nan() -#endif - -#define INFINITY HUGE_VALF - -/****************************************************************************** - * Taxonomy of floating point data types * - ******************************************************************************/ - -#define FP_NAN 1 -#define FP_INFINITE 2 -#define FP_ZERO 3 -#define FP_NORMAL 4 -#define FP_SUBNORMAL 5 -#define FP_SUPERNORMAL 6 /* legacy PowerPC support; this is otherwise unused */ - -#if defined __arm64__ || defined __ARM_VFPV4__ -/* On these architectures, fma(), fmaf( ), and fmal( ) are generally about as - fast as (or faster than) separate multiply and add of the same operands. */ -# define FP_FAST_FMA 1 -# define FP_FAST_FMAF 1 -# define FP_FAST_FMAL 1 -#elif (defined __i386__ || defined __x86_64__) && (defined __FMA__ || defined __AVX512F__) -/* When targeting the FMA ISA extension, fma() and fmaf( ) are generally - about as fast as (or faster than) separate multiply and add of the same - operands, but fmal( ) may be more costly. */ -# define FP_FAST_FMA 1 -# define FP_FAST_FMAF 1 -# undef FP_FAST_FMAL -#else -/* On these architectures, fma( ), fmaf( ), and fmal( ) function calls are - significantly more costly than separate multiply and add operations. */ -# undef FP_FAST_FMA -# undef FP_FAST_FMAF -# undef FP_FAST_FMAL -#endif - -/* The values returned by `ilogb' for 0 and NaN respectively. */ -#define FP_ILOGB0 (-2147483647 - 1) -#define FP_ILOGBNAN (-2147483647 - 1) - -/* Bitmasks for the math_errhandling macro. */ -#define MATH_ERRNO 1 /* errno set by math functions. */ -#define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */ - -#define math_errhandling (__math_errhandling()) -extern int __math_errhandling(void); - -/****************************************************************************** - * * - * Inquiry macros * - * * - * fpclassify Returns one of the FP_* values. * - * isnormal Non-zero if and only if the argument x is normalized. * - * isfinite Non-zero if and only if the argument x is finite. * - * isnan Non-zero if and only if the argument x is a NaN. * - * signbit Non-zero if and only if the sign of the argument x is * - * negative. This includes, NaNs, infinities and zeros. * - * * - ******************************************************************************/ - -#define fpclassify(x) \ - ( sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) \ - : sizeof(x) == sizeof(double) ? __fpclassifyd((double)(x)) \ - : __fpclassifyl((long double)(x))) - -extern int __fpclassifyf(float); -extern int __fpclassifyd(double); -extern int __fpclassifyl(long double); - -#if (defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__) -/* These inline functions may fail to return expected results if unsafe - math optimizations like those enabled by -ffast-math are turned on. - Thus, (somewhat surprisingly) you only get the fast inline - implementations if such compiler options are NOT enabled. This is - because the inline functions require the compiler to be adhering to - the standard in order to work properly; -ffast-math, among other - things, implies that NaNs don't happen, which allows the compiler to - optimize away checks like x != x, which might lead to things like - isnan(NaN) returning false. - - Thus, if you compile with -ffast-math, actual function calls are - generated for these utilities. */ - -#define isnormal(x) \ - ( sizeof(x) == sizeof(float) ? __inline_isnormalf((float)(x)) \ - : sizeof(x) == sizeof(double) ? __inline_isnormald((double)(x)) \ - : __inline_isnormall((long double)(x))) - -#define isfinite(x) \ - ( sizeof(x) == sizeof(float) ? __inline_isfinitef((float)(x)) \ - : sizeof(x) == sizeof(double) ? __inline_isfinited((double)(x)) \ - : __inline_isfinitel((long double)(x))) - -#define isinf(x) \ - ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \ - : sizeof(x) == sizeof(double) ? __inline_isinfd((double)(x)) \ - : __inline_isinfl((long double)(x))) - -#define isnan(x) \ - ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \ - : sizeof(x) == sizeof(double) ? __inline_isnand((double)(x)) \ - : __inline_isnanl((long double)(x))) - -#define signbit(x) \ - ( sizeof(x) == sizeof(float) ? __inline_signbitf((float)(x)) \ - : sizeof(x) == sizeof(double) ? __inline_signbitd((double)(x)) \ - : __inline_signbitl((long double)(x))) - -__header_always_inline int __inline_isfinitef(float); -__header_always_inline int __inline_isfinited(double); -__header_always_inline int __inline_isfinitel(long double); -__header_always_inline int __inline_isinff(float); -__header_always_inline int __inline_isinfd(double); -__header_always_inline int __inline_isinfl(long double); -__header_always_inline int __inline_isnanf(float); -__header_always_inline int __inline_isnand(double); -__header_always_inline int __inline_isnanl(long double); -__header_always_inline int __inline_isnormalf(float); -__header_always_inline int __inline_isnormald(double); -__header_always_inline int __inline_isnormall(long double); -__header_always_inline int __inline_signbitf(float); -__header_always_inline int __inline_signbitd(double); -__header_always_inline int __inline_signbitl(long double); - -__header_always_inline int __inline_isfinitef(float __x) { - return __x == __x && __builtin_fabsf(__x) != __builtin_inff(); -} -__header_always_inline int __inline_isfinited(double __x) { - return __x == __x && __builtin_fabs(__x) != __builtin_inf(); -} -__header_always_inline int __inline_isfinitel(long double __x) { - return __x == __x && __builtin_fabsl(__x) != __builtin_infl(); -} -__header_always_inline int __inline_isinff(float __x) { - return __builtin_fabsf(__x) == __builtin_inff(); -} -__header_always_inline int __inline_isinfd(double __x) { - return __builtin_fabs(__x) == __builtin_inf(); -} -__header_always_inline int __inline_isinfl(long double __x) { - return __builtin_fabsl(__x) == __builtin_infl(); -} -__header_always_inline int __inline_isnanf(float __x) { - return __x != __x; -} -__header_always_inline int __inline_isnand(double __x) { - return __x != __x; -} -__header_always_inline int __inline_isnanl(long double __x) { - return __x != __x; -} -__header_always_inline int __inline_signbitf(float __x) { - union { float __f; unsigned int __u; } __u; - __u.__f = __x; - return (int)(__u.__u >> 31); -} -__header_always_inline int __inline_signbitd(double __x) { - union { double __f; unsigned long long __u; } __u; - __u.__f = __x; - return (int)(__u.__u >> 63); -} -#if defined __i386__ || defined __x86_64__ -__header_always_inline int __inline_signbitl(long double __x) { - union { - long double __ld; - struct{ unsigned long long __m; unsigned short __sexp; } __p; - } __u; - __u.__ld = __x; - return (int)(__u.__p.__sexp >> 15); -} -#else -__header_always_inline int __inline_signbitl(long double __x) { - union { long double __f; unsigned long long __u;} __u; - __u.__f = __x; - return (int)(__u.__u >> 63); -} -#endif -__header_always_inline int __inline_isnormalf(float __x) { - return __inline_isfinitef(__x) && __builtin_fabsf(__x) >= __FLT_MIN__; -} -__header_always_inline int __inline_isnormald(double __x) { - return __inline_isfinited(__x) && __builtin_fabs(__x) >= __DBL_MIN__; -} -__header_always_inline int __inline_isnormall(long double __x) { - return __inline_isfinitel(__x) && __builtin_fabsl(__x) >= __LDBL_MIN__; -} - -#else /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */ - -/* Implementations making function calls to fall back on when -ffast-math - or similar is specified. These are not available in iOS versions prior - to 6.0. If you need them, you must target that version or later. */ - -#define isnormal(x) \ - ( sizeof(x) == sizeof(float) ? __isnormalf((float)(x)) \ - : sizeof(x) == sizeof(double) ? __isnormald((double)(x)) \ - : __isnormall((long double)(x))) - -#define isfinite(x) \ - ( sizeof(x) == sizeof(float) ? __isfinitef((float)(x)) \ - : sizeof(x) == sizeof(double) ? __isfinited((double)(x)) \ - : __isfinitel((long double)(x))) - -#define isinf(x) \ - ( sizeof(x) == sizeof(float) ? __isinff((float)(x)) \ - : sizeof(x) == sizeof(double) ? __isinfd((double)(x)) \ - : __isinfl((long double)(x))) - -#define isnan(x) \ - ( sizeof(x) == sizeof(float) ? __isnanf((float)(x)) \ - : sizeof(x) == sizeof(double) ? __isnand((double)(x)) \ - : __isnanl((long double)(x))) - -#define signbit(x) \ - ( sizeof(x) == sizeof(float) ? __signbitf((float)(x)) \ - : sizeof(x) == sizeof(double) ? __signbitd((double)(x)) \ - : __signbitl((long double)(x))) - -extern int __isnormalf(float); -extern int __isnormald(double); -extern int __isnormall(long double); -extern int __isfinitef(float); -extern int __isfinited(double); -extern int __isfinitel(long double); -extern int __isinff(float); -extern int __isinfd(double); -extern int __isinfl(long double); -extern int __isnanf(float); -extern int __isnand(double); -extern int __isnanl(long double); -extern int __signbitf(float); -extern int __signbitd(double); -extern int __signbitl(long double); - -#endif /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */ - -/****************************************************************************** - * * - * Math Functions * - * * - ******************************************************************************/ - -extern float acosf(float); -extern double acos(double); -extern long double acosl(long double); - -extern float asinf(float); -extern double asin(double); -extern long double asinl(long double); - -extern float atanf(float); -extern double atan(double); -extern long double atanl(long double); - -extern float atan2f(float, float); -extern double atan2(double, double); -extern long double atan2l(long double, long double); - -extern float cosf(float); -extern double cos(double); -extern long double cosl(long double); - -extern float sinf(float); -extern double sin(double); -extern long double sinl(long double); - -extern float tanf(float); -extern double tan(double); -extern long double tanl(long double); - -extern float acoshf(float); -extern double acosh(double); -extern long double acoshl(long double); - -extern float asinhf(float); -extern double asinh(double); -extern long double asinhl(long double); - -extern float atanhf(float); -extern double atanh(double); -extern long double atanhl(long double); - -extern float coshf(float); -extern double cosh(double); -extern long double coshl(long double); - -extern float sinhf(float); -extern double sinh(double); -extern long double sinhl(long double); - -extern float tanhf(float); -extern double tanh(double); -extern long double tanhl(long double); - -extern float expf(float); -extern double exp(double); -extern long double expl(long double); - -extern float exp2f(float); -extern double exp2(double); -extern long double exp2l(long double); - -extern float expm1f(float); -extern double expm1(double); -extern long double expm1l(long double); - -extern float logf(float); -extern double log(double); -extern long double logl(long double); - -extern float log10f(float); -extern double log10(double); -extern long double log10l(long double); - -extern float log2f(float); -extern double log2(double); -extern long double log2l(long double); - -extern float log1pf(float); -extern double log1p(double); -extern long double log1pl(long double); - -extern float logbf(float); -extern double logb(double); -extern long double logbl(long double); - -extern float modff(float, float *); -extern double modf(double, double *); -extern long double modfl(long double, long double *); - -extern float ldexpf(float, int); -extern double ldexp(double, int); -extern long double ldexpl(long double, int); - -extern float frexpf(float, int *); -extern double frexp(double, int *); -extern long double frexpl(long double, int *); - -extern int ilogbf(float); -extern int ilogb(double); -extern int ilogbl(long double); - -extern float scalbnf(float, int); -extern double scalbn(double, int); -extern long double scalbnl(long double, int); - -extern float scalblnf(float, long int); -extern double scalbln(double, long int); -extern long double scalblnl(long double, long int); - -extern float fabsf(float); -extern double fabs(double); -extern long double fabsl(long double); - -extern float cbrtf(float); -extern double cbrt(double); -extern long double cbrtl(long double); - -extern float hypotf(float, float); -extern double hypot(double, double); -extern long double hypotl(long double, long double); - -extern float powf(float, float); -extern double pow(double, double); -extern long double powl(long double, long double); - -extern float sqrtf(float); -extern double sqrt(double); -extern long double sqrtl(long double); - -extern float erff(float); -extern double erf(double); -extern long double erfl(long double); - -extern float erfcf(float); -extern double erfc(double); -extern long double erfcl(long double); - -/* lgammaf, lgamma, and lgammal are not thread-safe. The thread-safe - variants lgammaf_r, lgamma_r, and lgammal_r are made available if - you define the _REENTRANT symbol before including */ -extern float lgammaf(float); -extern double lgamma(double); -extern long double lgammal(long double); - -extern float tgammaf(float); -extern double tgamma(double); -extern long double tgammal(long double); - -extern float ceilf(float); -extern double ceil(double); -extern long double ceill(long double); - -extern float floorf(float); -extern double floor(double); -extern long double floorl(long double); - -extern float nearbyintf(float); -extern double nearbyint(double); -extern long double nearbyintl(long double); - -extern float rintf(float); -extern double rint(double); -extern long double rintl(long double); - -extern long int lrintf(float); -extern long int lrint(double); -extern long int lrintl(long double); - -extern float roundf(float); -extern double round(double); -extern long double roundl(long double); - -extern long int lroundf(float); -extern long int lround(double); -extern long int lroundl(long double); - -/* long long is not part of C90. Make sure you are passing -std=c99 or - -std=gnu99 or higher if you need these functions returning long longs */ -#if !(__DARWIN_NO_LONG_LONG) -extern long long int llrintf(float); -extern long long int llrint(double); -extern long long int llrintl(long double); - -extern long long int llroundf(float); -extern long long int llround(double); -extern long long int llroundl(long double); -#endif /* !(__DARWIN_NO_LONG_LONG) */ - -extern float truncf(float); -extern double trunc(double); -extern long double truncl(long double); - -extern float fmodf(float, float); -extern double fmod(double, double); -extern long double fmodl(long double, long double); - -extern float remainderf(float, float); -extern double remainder(double, double); -extern long double remainderl(long double, long double); - -extern float remquof(float, float, int *); -extern double remquo(double, double, int *); -extern long double remquol(long double, long double, int *); - -extern float copysignf(float, float); -extern double copysign(double, double); -extern long double copysignl(long double, long double); - -extern float nanf(const char *); -extern double nan(const char *); -extern long double nanl(const char *); - -extern float nextafterf(float, float); -extern double nextafter(double, double); -extern long double nextafterl(long double, long double); - -extern double nexttoward(double, long double); -extern float nexttowardf(float, long double); -extern long double nexttowardl(long double, long double); - -extern float fdimf(float, float); -extern double fdim(double, double); -extern long double fdiml(long double, long double); - -extern float fmaxf(float, float); -extern double fmax(double, double); -extern long double fmaxl(long double, long double); - -extern float fminf(float, float); -extern double fmin(double, double); -extern long double fminl(long double, long double); - -extern float fmaf(float, float, float); -extern double fma(double, double, double); -extern long double fmal(long double, long double, long double); - -#define isgreater(x, y) __builtin_isgreater((x),(y)) -#define isgreaterequal(x, y) __builtin_isgreaterequal((x),(y)) -#define isless(x, y) __builtin_isless((x),(y)) -#define islessequal(x, y) __builtin_islessequal((x),(y)) -#define islessgreater(x, y) __builtin_islessgreater((x),(y)) -#define isunordered(x, y) __builtin_isunordered((x),(y)) - -/* Deprecated functions; use the INFINITY and NAN macros instead. */ -extern float __inff(void) -__API_DEPRECATED("use `(float)INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -extern double __inf(void) -__API_DEPRECATED("use `INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -extern long double __infl(void) -__API_DEPRECATED("use `(long double)INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -extern float __nan(void) -__API_DEPRECATED("use `NAN` instead", macos(10.0, 10.14)) __API_UNAVAILABLE(ios, watchos, tvos); - -/****************************************************************************** - * Reentrant variants of lgamma[fl] * - ******************************************************************************/ - -#ifdef _REENTRANT -/* Reentrant variants of the lgamma[fl] functions. */ -extern float lgammaf_r(float, int *) __API_AVAILABLE(macos(10.6), ios(3.1)); -extern double lgamma_r(double, int *) __API_AVAILABLE(macos(10.6), ios(3.1)); -extern long double lgammal_r(long double, int *) __API_AVAILABLE(macos(10.6), ios(3.1)); -#endif /* _REENTRANT */ - -/****************************************************************************** - * Apple extensions to the C standard * - ******************************************************************************/ - -/* Because these functions are not specified by any relevant standard, they - are prefixed with __, which places them in the implementor's namespace, so - they should not conflict with any developer or third-party code. If they - are added to a relevant standard in the future, un-prefixed names may be - added to the library and they may be moved out of this section of the - header. - - Because these functions are non-standard, they may not be available on non- - Apple platforms. */ - -/* __exp10(x) returns 10**x. Edge cases match those of exp( ) and exp2( ). */ -extern float __exp10f(float) __API_AVAILABLE(macos(10.9), ios(7.0)); -extern double __exp10(double) __API_AVAILABLE(macos(10.9), ios(7.0)); - -/* __sincos(x,sinp,cosp) computes the sine and cosine of x with a single - function call, storing the sine in the memory pointed to by sinp, and - the cosine in the memory pointed to by cosp. Edge cases match those of - separate calls to sin( ) and cos( ). */ -__header_always_inline void __sincosf(float __x, float *__sinp, float *__cosp); -__header_always_inline void __sincos(double __x, double *__sinp, double *__cosp); - -/* __sinpi(x) returns the sine of pi times x; __cospi(x) and __tanpi(x) return - the cosine and tangent, respectively. These functions can produce a more - accurate answer than expressions of the form sin(M_PI * x) because they - avoid any loss of precision that results from rounding the result of the - multiplication M_PI * x. They may also be significantly more efficient in - some cases because the argument reduction for these functions is easier - to compute. Consult the man pages for edge case details. */ -extern float __cospif(float) __API_AVAILABLE(macos(10.9), ios(7.0)); -extern double __cospi(double) __API_AVAILABLE(macos(10.9), ios(7.0)); -extern float __sinpif(float) __API_AVAILABLE(macos(10.9), ios(7.0)); -extern double __sinpi(double) __API_AVAILABLE(macos(10.9), ios(7.0)); -extern float __tanpif(float) __API_AVAILABLE(macos(10.9), ios(7.0)); -extern double __tanpi(double) __API_AVAILABLE(macos(10.9), ios(7.0)); - -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 1090) || \ - (defined __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 70000) -/* __sincos and __sincosf were introduced in OSX 10.9 and iOS 7.0. When - targeting an older system, we simply split them up into discrete calls - to sin( ) and cos( ). */ -__header_always_inline void __sincosf(float __x, float *__sinp, float *__cosp) { - *__sinp = sinf(__x); - *__cosp = cosf(__x); -} - -__header_always_inline void __sincos(double __x, double *__sinp, double *__cosp) { - *__sinp = sin(__x); - *__cosp = cos(__x); -} -#else -/* __sincospi(x,sinp,cosp) computes the sine and cosine of pi times x with a - single function call, storing the sine in the memory pointed to by sinp, - and the cosine in the memory pointed to by cosp. Edge cases match those - of separate calls to __sinpi( ) and __cospi( ), and are documented in the - man pages. - - These functions were introduced in OSX 10.9 and iOS 7.0. Because they are - implemented as header inlines, weak-linking does not function as normal, - and they are simply hidden when targeting earlier OS versions. */ -__header_always_inline void __sincospif(float __x, float *__sinp, float *__cosp); -__header_always_inline void __sincospi(double __x, double *__sinp, double *__cosp); - -/* Implementation details of __sincos and __sincospi allowing them to return - two results while allowing the compiler to optimize away unnecessary load- - store traffic. Although these interfaces are exposed in the math.h header - to allow compilers to generate better code, users should call __sincos[f] - and __sincospi[f] instead and allow the compiler to emit these calls. */ -struct __float2 { float __sinval; float __cosval; }; -struct __double2 { double __sinval; double __cosval; }; - -extern struct __float2 __sincosf_stret(float); -extern struct __double2 __sincos_stret(double); -extern struct __float2 __sincospif_stret(float); -extern struct __double2 __sincospi_stret(double); - -__header_always_inline void __sincosf(float __x, float *__sinp, float *__cosp) { - const struct __float2 __stret = __sincosf_stret(__x); - *__sinp = __stret.__sinval; *__cosp = __stret.__cosval; -} - -__header_always_inline void __sincos(double __x, double *__sinp, double *__cosp) { - const struct __double2 __stret = __sincos_stret(__x); - *__sinp = __stret.__sinval; *__cosp = __stret.__cosval; -} - -__header_always_inline void __sincospif(float __x, float *__sinp, float *__cosp) { - const struct __float2 __stret = __sincospif_stret(__x); - *__sinp = __stret.__sinval; *__cosp = __stret.__cosval; -} - -__header_always_inline void __sincospi(double __x, double *__sinp, double *__cosp) { - const struct __double2 __stret = __sincospi_stret(__x); - *__sinp = __stret.__sinval; *__cosp = __stret.__cosval; -} -#endif - -/****************************************************************************** - * POSIX/UNIX extensions to the C standard * - ******************************************************************************/ - -#if __DARWIN_C_LEVEL >= 199506L -extern double j0(double) __API_AVAILABLE(macos(10.0), ios(3.2)); -extern double j1(double) __API_AVAILABLE(macos(10.0), ios(3.2)); -extern double jn(int, double) __API_AVAILABLE(macos(10.0), ios(3.2)); -extern double y0(double) __API_AVAILABLE(macos(10.0), ios(3.2)); -extern double y1(double) __API_AVAILABLE(macos(10.0), ios(3.2)); -extern double yn(int, double) __API_AVAILABLE(macos(10.0), ios(3.2)); -extern double scalb(double, double); -extern int signgam; - -/* Even though these might be more useful as long doubles, POSIX requires - that they be double-precision literals. */ -#define M_E 2.71828182845904523536028747135266250 /* e */ -#define M_LOG2E 1.44269504088896340735992468100189214 /* log2(e) */ -#define M_LOG10E 0.434294481903251827651128918916605082 /* log10(e) */ -#define M_LN2 0.693147180559945309417232121458176568 /* loge(2) */ -#define M_LN10 2.30258509299404568401799145468436421 /* loge(10) */ -#define M_PI 3.14159265358979323846264338327950288 /* pi */ -#define M_PI_2 1.57079632679489661923132169163975144 /* pi/2 */ -#define M_PI_4 0.785398163397448309615660845819875721 /* pi/4 */ -#define M_1_PI 0.318309886183790671537767526745028724 /* 1/pi */ -#define M_2_PI 0.636619772367581343075535053490057448 /* 2/pi */ -#define M_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */ -#define M_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */ -#define M_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */ - -#define MAXFLOAT 0x1.fffffep+127f -#endif /* __DARWIN_C_LEVEL >= 199506L */ - -/* Long-double versions of M_E, etc for convenience on Intel where long- - double is not the same as double. Define __MATH_LONG_DOUBLE_CONSTANTS - to make these constants available. */ -#if defined __MATH_LONG_DOUBLE_CONSTANTS -#define M_El 0xa.df85458a2bb4a9bp-2L -#define M_LOG2El 0xb.8aa3b295c17f0bcp-3L -#define M_LOG10El 0xd.e5bd8a937287195p-5L -#define M_LN2l 0xb.17217f7d1cf79acp-4L -#define M_LN10l 0x9.35d8dddaaa8ac17p-2L -#define M_PIl 0xc.90fdaa22168c235p-2L -#define M_PI_2l 0xc.90fdaa22168c235p-3L -#define M_PI_4l 0xc.90fdaa22168c235p-4L -#define M_1_PIl 0xa.2f9836e4e44152ap-5L -#define M_2_PIl 0xa.2f9836e4e44152ap-4L -#define M_2_SQRTPIl 0x9.06eba8214db688dp-3L -#define M_SQRT2l 0xb.504f333f9de6484p-3L -#define M_SQRT1_2l 0xb.504f333f9de6484p-4L -#endif /* defined __MATH_LONG_DOUBLE_CONSTANTS */ - -/****************************************************************************** - * Legacy BSD extensions to the C standard * - ******************************************************************************/ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define FP_SNAN FP_NAN -#define FP_QNAN FP_NAN -#define HUGE MAXFLOAT -#define X_TLOSS 1.41484755040568800000e+16 -#define DOMAIN 1 -#define SING 2 -#define OVERFLOW 3 -#define UNDERFLOW 4 -#define TLOSS 5 -#define PLOSS 6 - -/* Legacy BSD API; use the C99 `lrint( )` function instead. */ -extern long int rinttol(double) -__API_DEPRECATED_WITH_REPLACEMENT("lrint", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -/* Legacy BSD API; use the C99 `lround( )` function instead. */ -extern long int roundtol(double) -__API_DEPRECATED_WITH_REPLACEMENT("lround", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -/* Legacy BSD API; use the C99 `remainder( )` function instead. */ -extern double drem(double, double) -__API_DEPRECATED_WITH_REPLACEMENT("remainder", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -/* Legacy BSD API; use the C99 `isfinite( )` macro instead. */ -extern int finite(double) -__API_DEPRECATED("Use `isfinite((double)x)` instead.", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -/* Legacy BSD API; use the C99 `tgamma( )` function instead. */ -extern double gamma(double) -__API_DEPRECATED_WITH_REPLACEMENT("tgamma", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); -/* Legacy BSD API; use `2*frexp( )` or `scalbn(x, -ilogb(x))` instead. */ -extern double significand(double) -__API_DEPRECATED("Use `2*frexp( )` or `scalbn(x, -ilogb(x))` instead.", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos); - -#if !defined __cplusplus -struct exception { - int type; - char *name; - double arg1; - double arg2; - double retval; -}; - -#endif /* !defined __cplusplus */ -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -__END_DECLS -#endif /* __MATH_H__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/net/net_kev.h b/lib/libc/include/x86_64-macos.10-none/net/net_kev.h deleted file mode 100644 index 0919e59ff2..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/net/net_kev.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2016-2018 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _NET_NETKEV_H_ -#define _NET_NETKEV_H_ - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) - -/* Kernel event subclass identifiers for KEV_NETWORK_CLASS */ -#define KEV_INET_SUBCLASS 1 /* inet subclass */ -/* KEV_INET_SUBCLASS event codes */ -#define KEV_INET_NEW_ADDR 1 /* Userland configured IP address */ -#define KEV_INET_CHANGED_ADDR 2 /* Address changed event */ -#define KEV_INET_ADDR_DELETED 3 /* IPv6 address was deleted */ -#define KEV_INET_SIFDSTADDR 4 /* Dest. address was set */ -#define KEV_INET_SIFBRDADDR 5 /* Broadcast address was set */ -#define KEV_INET_SIFNETMASK 6 /* Netmask was set */ -#define KEV_INET_ARPCOLLISION 7 /* ARP collision detected */ -#ifdef __APPLE_API_PRIVATE -#define KEV_INET_PORTINUSE 8 /* use ken_in_portinuse */ -#endif -#define KEV_INET_ARPRTRFAILURE 9 /* ARP resolution failed for router */ -#define KEV_INET_ARPRTRALIVE 10 /* ARP resolution succeeded for router */ - -#define KEV_DL_SUBCLASS 2 /* Data Link subclass */ -/* - * Define Data-Link event subclass, and associated - * events. - */ -#define KEV_DL_SIFFLAGS 1 -#define KEV_DL_SIFMETRICS 2 -#define KEV_DL_SIFMTU 3 -#define KEV_DL_SIFPHYS 4 -#define KEV_DL_SIFMEDIA 5 -#define KEV_DL_SIFGENERIC 6 -#define KEV_DL_ADDMULTI 7 -#define KEV_DL_DELMULTI 8 -#define KEV_DL_IF_ATTACHED 9 -#define KEV_DL_IF_DETACHING 10 -#define KEV_DL_IF_DETACHED 11 -#define KEV_DL_LINK_OFF 12 -#define KEV_DL_LINK_ON 13 -#define KEV_DL_PROTO_ATTACHED 14 -#define KEV_DL_PROTO_DETACHED 15 -#define KEV_DL_LINK_ADDRESS_CHANGED 16 -#define KEV_DL_WAKEFLAGS_CHANGED 17 -#define KEV_DL_IF_IDLE_ROUTE_REFCNT 18 -#define KEV_DL_IFCAP_CHANGED 19 -#define KEV_DL_LINK_QUALITY_METRIC_CHANGED 20 -#define KEV_DL_NODE_PRESENCE 21 -#define KEV_DL_NODE_ABSENCE 22 -#define KEV_DL_MASTER_ELECTED 23 -#define KEV_DL_ISSUES 24 -#define KEV_DL_IFDELEGATE_CHANGED 25 -#define KEV_DL_AWDL_RESTRICTED 26 -#define KEV_DL_AWDL_UNRESTRICTED 27 -#define KEV_DL_RRC_STATE_CHANGED 28 -#define KEV_DL_QOS_MODE_CHANGED 29 -#define KEV_DL_LOW_POWER_MODE_CHANGED 30 - - -#define KEV_INET6_SUBCLASS 6 /* inet6 subclass */ -/* KEV_INET6_SUBCLASS event codes */ -#define KEV_INET6_NEW_USER_ADDR 1 /* Userland configured IPv6 address */ -#define KEV_INET6_CHANGED_ADDR 2 /* Address changed event (future) */ -#define KEV_INET6_ADDR_DELETED 3 /* IPv6 address was deleted */ -#define KEV_INET6_NEW_LL_ADDR 4 /* Autoconf LL address appeared */ -#define KEV_INET6_NEW_RTADV_ADDR 5 /* Autoconf address has appeared */ -#define KEV_INET6_DEFROUTER 6 /* Default router detected */ -#define KEV_INET6_REQUEST_NAT64_PREFIX 7 /* Asking for the NAT64-prefix */ - -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ -#endif /* _NET_NETKEV_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/pthread_impl.h b/lib/libc/include/x86_64-macos.10-none/pthread_impl.h deleted file mode 100644 index aae74c2c03..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/pthread_impl.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _PTHREAD_IMPL_H_ -#define _PTHREAD_IMPL_H_ -/* - * Internal implementation details - */ - -/* This whole header file will disappear, so don't depend on it... */ - -#if __has_feature(assume_nonnull) -_Pragma("clang assume_nonnull begin") -#endif - -#ifndef __POSIX_LIB__ - -/* - * [Internal] data structure signatures - */ -#define _PTHREAD_MUTEX_SIG_init 0x32AAABA7 - -#define _PTHREAD_ERRORCHECK_MUTEX_SIG_init 0x32AAABA1 -#define _PTHREAD_RECURSIVE_MUTEX_SIG_init 0x32AAABA2 -#define _PTHREAD_FIRSTFIT_MUTEX_SIG_init 0x32AAABA3 - -#define _PTHREAD_COND_SIG_init 0x3CB0B1BB -#define _PTHREAD_ONCE_SIG_init 0x30B1BCBA -#define _PTHREAD_RWLOCK_SIG_init 0x2DA8B3B4 - -/* - * POSIX scheduling policies - */ -#define SCHED_OTHER 1 -#define SCHED_FIFO 4 -#define SCHED_RR 2 - -#define __SCHED_PARAM_SIZE__ 4 - -#endif /* __POSIX_LIB__ */ - -#if __has_feature(assume_nonnull) -_Pragma("clang assume_nonnull end") -#endif - -#endif /* _PTHREAD_IMPL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sched.h b/lib/libc/include/x86_64-macos.10-none/sched.h deleted file mode 100644 index 3c49e7980d..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sched.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _SCHED_H_ -#define _SCHED_H_ - -#include -#include - -__BEGIN_DECLS -/* - * Scheduling paramters - */ -#ifndef __POSIX_LIB__ -struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; }; -#endif - -extern int sched_yield(void); -extern int sched_get_priority_min(int); -extern int sched_get_priority_max(int); -__END_DECLS - -#endif /* _SCHED_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/signal.h b/lib/libc/include/x86_64-macos.10-none/signal.h deleted file mode 100644 index dbc5b35f2b..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/signal.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)signal.h 8.3 (Berkeley) 3/30/94 - */ - -#ifndef _USER_SIGNAL_H -#define _USER_SIGNAL_H - -#include -#include <_types.h> -#include - -#include -#include - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -extern __const char *__const sys_signame[NSIG]; -extern __const char *__const sys_siglist[NSIG]; -#endif - -__BEGIN_DECLS -int raise(int); -__END_DECLS - -#ifndef _ANSI_SOURCE -__BEGIN_DECLS -void (* _Nullable bsd_signal(int, void (* _Nullable)(int)))(int); -int kill(pid_t, int) __DARWIN_ALIAS(kill); -int killpg(pid_t, int) __DARWIN_ALIAS(killpg); -int pthread_kill(pthread_t, int); -int pthread_sigmask(int, const sigset_t *, sigset_t *) __DARWIN_ALIAS(pthread_sigmask); -int sigaction(int, const struct sigaction * __restrict, - struct sigaction * __restrict); -int sigaddset(sigset_t *, int); -int sigaltstack(const stack_t * __restrict, stack_t * __restrict) __DARWIN_ALIAS(sigaltstack) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int sigdelset(sigset_t *, int); -int sigemptyset(sigset_t *); -int sigfillset(sigset_t *); -int sighold(int); -int sigignore(int); -int siginterrupt(int, int); -int sigismember(const sigset_t *, int); -int sigpause(int) __DARWIN_ALIAS_C(sigpause); -int sigpending(sigset_t *); -int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict); -int sigrelse(int); -void (* _Nullable sigset(int, void (* _Nullable)(int)))(int); -int sigsuspend(const sigset_t *) __DARWIN_ALIAS_C(sigsuspend); -int sigwait(const sigset_t * __restrict, int * __restrict) __DARWIN_ALIAS_C(sigwait); -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -void psignal(unsigned int, const char *); -int sigblock(int); -int sigsetmask(int); -int sigvec(int, struct sigvec *, struct sigvec *); -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ -__END_DECLS - -/* List definitions after function declarations, or Reiser cpp gets upset. */ -#if defined(__i386__) || defined(__x86_64__) -/* The left shift operator on intel is modulo 32 */ -__header_always_inline int -__sigbits(int __signo) -{ - return __signo > __DARWIN_NSIG ? 0 : (1 << (__signo - 1)); -} -#else /* !__i386__ && !__x86_64__ */ -#define __sigbits(signo) (1 << ((signo) - 1)) -#endif /* __i386__ || __x86_64__ */ - -#define sigaddset(set, signo) (*(set) |= __sigbits(signo), 0) -#define sigdelset(set, signo) (*(set) &= ~__sigbits(signo), 0) -#define sigismember(set, signo) ((*(set) & __sigbits(signo)) != 0) -#define sigemptyset(set) (*(set) = 0, 0) -#define sigfillset(set) (*(set) = ~(sigset_t)0, 0) -#endif /* !_ANSI_SOURCE */ - -#endif /* !_USER_SIGNAL_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/common.h b/lib/libc/include/x86_64-macos.10-none/simd/common.h deleted file mode 100644 index 4c2f4d0760..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/common.h +++ /dev/null @@ -1,4458 +0,0 @@ -/*! @header - * The interfaces declared in this header provide "common" elementwise - * operations that are neither math nor logic functions. These are available - * only for floating-point vectors and scalars, except for min, max, abs, - * clamp, and the reduce operations, which also support integer vectors. - * - * simd_abs(x) Absolute value of x. Also available as fabs - * for floating-point vectors. If x is the - * smallest signed integer, x is returned. - * - * simd_max(x,y) Returns the maximum of x and y. Also available - * as fmax for floating-point vectors. - * - * simd_min(x,y) Returns the minimum of x and y. Also available - * as fmin for floating-point vectors. - * - * simd_clamp(x,min,max) x clamped to the range [min, max]. - * - * simd_sign(x) -1 if x is less than zero, 0 if x is zero or - * NaN, and +1 if x is greater than zero. - * - * simd_mix(x,y,t) If t is not in the range [0,1], the result is - * undefined. Otherwise the result is x+(y-x)*t, - * which linearly interpolates between x and y. - * - * simd_recip(x) An approximation to 1/x. If x is very near the - * limits of representable values, or is infinity - * or NaN, the result is undefined. There are - * two variants of this function: - * - * simd_precise_recip(x) - * - * and - * - * simd_fast_recip(x). - * - * The "precise" variant is accurate to a few ULPs, - * whereas the "fast" variant may have as little - * as 11 bits of accuracy in float and about 22 - * bits in double. - * - * The function simd_recip(x) resolves to - * simd_precise_recip(x) ordinarily, but to - * simd_fast_recip(x) when used in a translation - * unit compiled with -ffast-math (when - * -ffast-math is in effect, you may still use the - * precise version of this function by calling it - * explicitly by name). - * - * simd_rsqrt(x) An approximation to 1/sqrt(x). If x is - * infinity or NaN, the result is undefined. - * There are two variants of this function: - * - * simd_precise_rsqrt(x) - * - * and - * - * simd_fast_rsqrt(x). - * - * The "precise" variant is accurate to a few ULPs, - * whereas the "fast" variant may have as little - * as 11 bits of accuracy in float and about 22 - * bits in double. - * - * The function simd_rsqrt(x) resolves to - * simd_precise_rsqrt(x) ordinarily, but to - * simd_fast_rsqrt(x) when used in a translation - * unit compiled with -ffast-math (when - * -ffast-math is in effect, you may still use the - * precise version of this function by calling it - * explicitly by name). - * - * simd_fract(x) The "fractional part" of x, which lies strictly - * in the range [0, 0x1.fffffep-1]. - * - * simd_step(edge,x) 0 if x < edge, and 1 otherwise. - * - * simd_smoothstep(edge0,edge1,x) 0 if x <= edge0, 1 if x >= edge1, and - * a Hermite interpolation between 0 and 1 if - * edge0 < x < edge1. - * - * simd_reduce_add(x) Sum of the elements of x. - * - * simd_reduce_min(x) Minimum of the elements of x. - * - * simd_reduce_max(x) Maximum of the elements of x. - * - * simd_equal(x,y) True if and only if every lane of x is equal - * to the corresponding lane of y. - * - * The following common functions are available in the simd:: namespace: - * - * C++ Function Equivalent C Function - * -------------------------------------------------------------------- - * simd::abs(x) simd_abs(x) - * simd::max(x,y) simd_max(x,y) - * simd::min(x,y) simd_min(x,y) - * simd::clamp(x,min,max) simd_clamp(x,min,max) - * simd::sign(x) simd_sign(x) - * simd::mix(x,y,t) simd_mix(x,y,t) - * simd::recip(x) simd_recip(x) - * simd::rsqrt(x) simd_rsqrt(x) - * simd::fract(x) simd_fract(x) - * simd::step(edge,x) simd_step(edge,x) - * simd::smoothstep(e0,e1,x) simd_smoothstep(e0,e1,x) - * simd::reduce_add(x) simd_reduce_add(x) - * simd::reduce_max(x) simd_reduce_max(x) - * simd::reduce_min(x) simd_reduce_min(x) - * simd::equal(x,y) simd_equal(x,y) - * - * simd::precise::recip(x) simd_precise_recip(x) - * simd::precise::rsqrt(x) simd_precise_rsqrt(x) - * - * simd::fast::recip(x) simd_fast_recip(x) - * simd::fast::rsqrt(x) simd_fast_rsqrt(x) - * - * @copyright 2014-2017 Apple, Inc. All rights reserved. - * @unsorted */ - -#ifndef SIMD_COMMON_HEADER -#define SIMD_COMMON_HEADER - -#include -#if SIMD_COMPILER_HAS_REQUIRED_FEATURES -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_char2 simd_abs(simd_char2 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_char3 simd_abs(simd_char3 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_char4 simd_abs(simd_char4 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_char8 simd_abs(simd_char8 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_char16 simd_abs(simd_char16 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_char32 simd_abs(simd_char32 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_char64 simd_abs(simd_char64 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_short2 simd_abs(simd_short2 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_short3 simd_abs(simd_short3 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_short4 simd_abs(simd_short4 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_short8 simd_abs(simd_short8 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_short16 simd_abs(simd_short16 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_short32 simd_abs(simd_short32 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_int2 simd_abs(simd_int2 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_int3 simd_abs(simd_int3 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_int4 simd_abs(simd_int4 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_int8 simd_abs(simd_int8 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_int16 simd_abs(simd_int16 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_float2 simd_abs(simd_float2 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_float3 simd_abs(simd_float3 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_float4 simd_abs(simd_float4 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_float8 simd_abs(simd_float8 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_float16 simd_abs(simd_float16 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_long2 simd_abs(simd_long2 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_long3 simd_abs(simd_long3 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_long4 simd_abs(simd_long4 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_long8 simd_abs(simd_long8 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_double2 simd_abs(simd_double2 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_double3 simd_abs(simd_double3 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_double4 simd_abs(simd_double4 x); -/*! @abstract The elementwise absolute value of x. */ -static inline SIMD_CFUNC simd_double8 simd_abs(simd_double8 x); -/*! @abstract The elementwise absolute value of x. - * @discussion Deprecated. Use simd_abs(x) instead. */ -#define vector_abs simd_abs - -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_char2 simd_max(simd_char2 x, simd_char2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_char3 simd_max(simd_char3 x, simd_char3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_char4 simd_max(simd_char4 x, simd_char4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_char8 simd_max(simd_char8 x, simd_char8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_char16 simd_max(simd_char16 x, simd_char16 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_char32 simd_max(simd_char32 x, simd_char32 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_char64 simd_max(simd_char64 x, simd_char64 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uchar2 simd_max(simd_uchar2 x, simd_uchar2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uchar3 simd_max(simd_uchar3 x, simd_uchar3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uchar4 simd_max(simd_uchar4 x, simd_uchar4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uchar8 simd_max(simd_uchar8 x, simd_uchar8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uchar16 simd_max(simd_uchar16 x, simd_uchar16 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uchar32 simd_max(simd_uchar32 x, simd_uchar32 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uchar64 simd_max(simd_uchar64 x, simd_uchar64 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_short2 simd_max(simd_short2 x, simd_short2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_short3 simd_max(simd_short3 x, simd_short3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_short4 simd_max(simd_short4 x, simd_short4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_short8 simd_max(simd_short8 x, simd_short8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_short16 simd_max(simd_short16 x, simd_short16 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_short32 simd_max(simd_short32 x, simd_short32 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ushort2 simd_max(simd_ushort2 x, simd_ushort2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ushort3 simd_max(simd_ushort3 x, simd_ushort3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ushort4 simd_max(simd_ushort4 x, simd_ushort4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ushort8 simd_max(simd_ushort8 x, simd_ushort8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ushort16 simd_max(simd_ushort16 x, simd_ushort16 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ushort32 simd_max(simd_ushort32 x, simd_ushort32 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_int2 simd_max(simd_int2 x, simd_int2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_int3 simd_max(simd_int3 x, simd_int3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_int4 simd_max(simd_int4 x, simd_int4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_int8 simd_max(simd_int8 x, simd_int8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_int16 simd_max(simd_int16 x, simd_int16 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uint2 simd_max(simd_uint2 x, simd_uint2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uint3 simd_max(simd_uint3 x, simd_uint3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uint4 simd_max(simd_uint4 x, simd_uint4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uint8 simd_max(simd_uint8 x, simd_uint8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_uint16 simd_max(simd_uint16 x, simd_uint16 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC float simd_max(float x, float y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_float2 simd_max(simd_float2 x, simd_float2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_float3 simd_max(simd_float3 x, simd_float3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_float4 simd_max(simd_float4 x, simd_float4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_float8 simd_max(simd_float8 x, simd_float8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_float16 simd_max(simd_float16 x, simd_float16 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_long2 simd_max(simd_long2 x, simd_long2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_long3 simd_max(simd_long3 x, simd_long3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_long4 simd_max(simd_long4 x, simd_long4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_long8 simd_max(simd_long8 x, simd_long8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ulong2 simd_max(simd_ulong2 x, simd_ulong2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ulong3 simd_max(simd_ulong3 x, simd_ulong3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ulong4 simd_max(simd_ulong4 x, simd_ulong4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_ulong8 simd_max(simd_ulong8 x, simd_ulong8 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC double simd_max(double x, double y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_double2 simd_max(simd_double2 x, simd_double2 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_double3 simd_max(simd_double3 x, simd_double3 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_double4 simd_max(simd_double4 x, simd_double4 y); -/*! @abstract The elementwise maximum of x and y. */ -static inline SIMD_CFUNC simd_double8 simd_max(simd_double8 x, simd_double8 y); -/*! @abstract The elementwise maximum of x and y. - * @discussion Deprecated. Use simd_max(x,y) instead. */ -#define vector_max simd_max - -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_char2 simd_min(simd_char2 x, simd_char2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_char3 simd_min(simd_char3 x, simd_char3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_char4 simd_min(simd_char4 x, simd_char4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_char8 simd_min(simd_char8 x, simd_char8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_char16 simd_min(simd_char16 x, simd_char16 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_char32 simd_min(simd_char32 x, simd_char32 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_char64 simd_min(simd_char64 x, simd_char64 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uchar2 simd_min(simd_uchar2 x, simd_uchar2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uchar3 simd_min(simd_uchar3 x, simd_uchar3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uchar4 simd_min(simd_uchar4 x, simd_uchar4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uchar8 simd_min(simd_uchar8 x, simd_uchar8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uchar16 simd_min(simd_uchar16 x, simd_uchar16 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uchar32 simd_min(simd_uchar32 x, simd_uchar32 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uchar64 simd_min(simd_uchar64 x, simd_uchar64 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_short2 simd_min(simd_short2 x, simd_short2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_short3 simd_min(simd_short3 x, simd_short3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_short4 simd_min(simd_short4 x, simd_short4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_short8 simd_min(simd_short8 x, simd_short8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_short16 simd_min(simd_short16 x, simd_short16 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_short32 simd_min(simd_short32 x, simd_short32 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ushort2 simd_min(simd_ushort2 x, simd_ushort2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ushort3 simd_min(simd_ushort3 x, simd_ushort3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ushort4 simd_min(simd_ushort4 x, simd_ushort4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ushort8 simd_min(simd_ushort8 x, simd_ushort8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ushort16 simd_min(simd_ushort16 x, simd_ushort16 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ushort32 simd_min(simd_ushort32 x, simd_ushort32 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_int2 simd_min(simd_int2 x, simd_int2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_int3 simd_min(simd_int3 x, simd_int3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_int4 simd_min(simd_int4 x, simd_int4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_int8 simd_min(simd_int8 x, simd_int8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_int16 simd_min(simd_int16 x, simd_int16 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uint2 simd_min(simd_uint2 x, simd_uint2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uint3 simd_min(simd_uint3 x, simd_uint3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uint4 simd_min(simd_uint4 x, simd_uint4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uint8 simd_min(simd_uint8 x, simd_uint8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_uint16 simd_min(simd_uint16 x, simd_uint16 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC float simd_min(float x, float y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_float2 simd_min(simd_float2 x, simd_float2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_float3 simd_min(simd_float3 x, simd_float3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_float4 simd_min(simd_float4 x, simd_float4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_float8 simd_min(simd_float8 x, simd_float8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_float16 simd_min(simd_float16 x, simd_float16 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_long2 simd_min(simd_long2 x, simd_long2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_long3 simd_min(simd_long3 x, simd_long3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_long4 simd_min(simd_long4 x, simd_long4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_long8 simd_min(simd_long8 x, simd_long8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ulong2 simd_min(simd_ulong2 x, simd_ulong2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ulong3 simd_min(simd_ulong3 x, simd_ulong3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ulong4 simd_min(simd_ulong4 x, simd_ulong4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_ulong8 simd_min(simd_ulong8 x, simd_ulong8 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC double simd_min(double x, double y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_double2 simd_min(simd_double2 x, simd_double2 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_double3 simd_min(simd_double3 x, simd_double3 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_double4 simd_min(simd_double4 x, simd_double4 y); -/*! @abstract The elementwise minimum of x and y. */ -static inline SIMD_CFUNC simd_double8 simd_min(simd_double8 x, simd_double8 y); -/*! @abstract The elementwise minimum of x and y. - * @discussion Deprecated. Use simd_min(x,y) instead. */ -#define vector_min simd_min - - -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_char2 simd_clamp(simd_char2 x, simd_char2 min, simd_char2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_char3 simd_clamp(simd_char3 x, simd_char3 min, simd_char3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_char4 simd_clamp(simd_char4 x, simd_char4 min, simd_char4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_char8 simd_clamp(simd_char8 x, simd_char8 min, simd_char8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_char16 simd_clamp(simd_char16 x, simd_char16 min, simd_char16 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_char32 simd_clamp(simd_char32 x, simd_char32 min, simd_char32 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_char64 simd_clamp(simd_char64 x, simd_char64 min, simd_char64 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uchar2 simd_clamp(simd_uchar2 x, simd_uchar2 min, simd_uchar2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uchar3 simd_clamp(simd_uchar3 x, simd_uchar3 min, simd_uchar3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uchar4 simd_clamp(simd_uchar4 x, simd_uchar4 min, simd_uchar4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uchar8 simd_clamp(simd_uchar8 x, simd_uchar8 min, simd_uchar8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uchar16 simd_clamp(simd_uchar16 x, simd_uchar16 min, simd_uchar16 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uchar32 simd_clamp(simd_uchar32 x, simd_uchar32 min, simd_uchar32 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uchar64 simd_clamp(simd_uchar64 x, simd_uchar64 min, simd_uchar64 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_short2 simd_clamp(simd_short2 x, simd_short2 min, simd_short2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_short3 simd_clamp(simd_short3 x, simd_short3 min, simd_short3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_short4 simd_clamp(simd_short4 x, simd_short4 min, simd_short4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_short8 simd_clamp(simd_short8 x, simd_short8 min, simd_short8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_short16 simd_clamp(simd_short16 x, simd_short16 min, simd_short16 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_short32 simd_clamp(simd_short32 x, simd_short32 min, simd_short32 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ushort2 simd_clamp(simd_ushort2 x, simd_ushort2 min, simd_ushort2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ushort3 simd_clamp(simd_ushort3 x, simd_ushort3 min, simd_ushort3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ushort4 simd_clamp(simd_ushort4 x, simd_ushort4 min, simd_ushort4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ushort8 simd_clamp(simd_ushort8 x, simd_ushort8 min, simd_ushort8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ushort16 simd_clamp(simd_ushort16 x, simd_ushort16 min, simd_ushort16 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ushort32 simd_clamp(simd_ushort32 x, simd_ushort32 min, simd_ushort32 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_int2 simd_clamp(simd_int2 x, simd_int2 min, simd_int2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_int3 simd_clamp(simd_int3 x, simd_int3 min, simd_int3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_int4 simd_clamp(simd_int4 x, simd_int4 min, simd_int4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_int8 simd_clamp(simd_int8 x, simd_int8 min, simd_int8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_int16 simd_clamp(simd_int16 x, simd_int16 min, simd_int16 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uint2 simd_clamp(simd_uint2 x, simd_uint2 min, simd_uint2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uint3 simd_clamp(simd_uint3 x, simd_uint3 min, simd_uint3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uint4 simd_clamp(simd_uint4 x, simd_uint4 min, simd_uint4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uint8 simd_clamp(simd_uint8 x, simd_uint8 min, simd_uint8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_uint16 simd_clamp(simd_uint16 x, simd_uint16 min, simd_uint16 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC float simd_clamp(float x, float min, float max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_float2 simd_clamp(simd_float2 x, simd_float2 min, simd_float2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_float3 simd_clamp(simd_float3 x, simd_float3 min, simd_float3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_float4 simd_clamp(simd_float4 x, simd_float4 min, simd_float4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_float8 simd_clamp(simd_float8 x, simd_float8 min, simd_float8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_float16 simd_clamp(simd_float16 x, simd_float16 min, simd_float16 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_long2 simd_clamp(simd_long2 x, simd_long2 min, simd_long2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_long3 simd_clamp(simd_long3 x, simd_long3 min, simd_long3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_long4 simd_clamp(simd_long4 x, simd_long4 min, simd_long4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_long8 simd_clamp(simd_long8 x, simd_long8 min, simd_long8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ulong2 simd_clamp(simd_ulong2 x, simd_ulong2 min, simd_ulong2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ulong3 simd_clamp(simd_ulong3 x, simd_ulong3 min, simd_ulong3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ulong4 simd_clamp(simd_ulong4 x, simd_ulong4 min, simd_ulong4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_ulong8 simd_clamp(simd_ulong8 x, simd_ulong8 min, simd_ulong8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC double simd_clamp(double x, double min, double max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_double2 simd_clamp(simd_double2 x, simd_double2 min, simd_double2 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_double3 simd_clamp(simd_double3 x, simd_double3 min, simd_double3 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_double4 simd_clamp(simd_double4 x, simd_double4 min, simd_double4 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Note that if you want to clamp all lanes to the same range, - * you can use a scalar value for min and max. */ -static inline SIMD_CFUNC simd_double8 simd_clamp(simd_double8 x, simd_double8 min, simd_double8 max); -/*! @abstract x clamped to the range [min, max]. - * @discussion Deprecated. Use simd_clamp(x,min,max) instead. */ -#define vector_clamp simd_clamp - -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC float simd_sign(float x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_float2 simd_sign(simd_float2 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_float3 simd_sign(simd_float3 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_float4 simd_sign(simd_float4 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_float8 simd_sign(simd_float8 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_float16 simd_sign(simd_float16 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC double simd_sign(double x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_double2 simd_sign(simd_double2 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_double3 simd_sign(simd_double3 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_double4 simd_sign(simd_double4 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ -static inline SIMD_CFUNC simd_double8 simd_sign(simd_double8 x); -/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. - * @discussion Deprecated. Use simd_sign(x) instead. */ -#define vector_sign simd_sign - -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC float simd_mix(float x, float y, float t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_float2 simd_mix(simd_float2 x, simd_float2 y, simd_float2 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_float3 simd_mix(simd_float3 x, simd_float3 y, simd_float3 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_float4 simd_mix(simd_float4 x, simd_float4 y, simd_float4 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_float8 simd_mix(simd_float8 x, simd_float8 y, simd_float8 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_float16 simd_mix(simd_float16 x, simd_float16 y, simd_float16 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC double simd_mix(double x, double y, double t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_double2 simd_mix(simd_double2 x, simd_double2 y, simd_double2 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_double3 simd_mix(simd_double3 x, simd_double3 y, simd_double3 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_double4 simd_mix(simd_double4 x, simd_double4 y, simd_double4 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 */ -static inline SIMD_CFUNC simd_double8 simd_mix(simd_double8 x, simd_double8 y, simd_double8 t); -/*! @abstract Linearly interpolates between x and y, taking the value x when - * t=0 and y when t=1 - * @discussion Deprecated. Use simd_mix(x, y, t) instead. */ -#define vector_mix simd_mix - -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC float simd_precise_recip(float x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_float2 simd_precise_recip(simd_float2 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_float3 simd_precise_recip(simd_float3 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_float4 simd_precise_recip(simd_float4 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_float8 simd_precise_recip(simd_float8 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_float16 simd_precise_recip(simd_float16 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC double simd_precise_recip(double x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_double2 simd_precise_recip(simd_double2 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_double3 simd_precise_recip(simd_double3 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_double4 simd_precise_recip(simd_double4 x); -/*! @abstract A good approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * a few units in the last place (ULPs). */ -static inline SIMD_CFUNC simd_double8 simd_precise_recip(simd_double8 x); -/*! @abstract A good approximation to 1/x. - * @discussion Deprecated. Use simd_precise_recip(x) instead. */ -#define vector_precise_recip simd_precise_recip - -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC float simd_fast_recip(float x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_float2 simd_fast_recip(simd_float2 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_float3 simd_fast_recip(simd_float3 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_float4 simd_fast_recip(simd_float4 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_float8 simd_fast_recip(simd_float8 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_float16 simd_fast_recip(simd_float16 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC double simd_fast_recip(double x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_double2 simd_fast_recip(simd_double2 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_double3 simd_fast_recip(simd_double3 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_double4 simd_fast_recip(simd_double4 x); -/*! @abstract A fast approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow; otherwise this function is accurate to - * at least 11 bits for float and 22 bits for double. */ -static inline SIMD_CFUNC simd_double8 simd_fast_recip(simd_double8 x); -/*! @abstract A fast approximation to 1/x. - * @discussion Deprecated. Use simd_fast_recip(x) instead. */ -#define vector_fast_recip simd_fast_recip - -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC float simd_recip(float x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float2 simd_recip(simd_float2 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float3 simd_recip(simd_float3 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float4 simd_recip(simd_float4 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float8 simd_recip(simd_float8 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float16 simd_recip(simd_float16 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC double simd_recip(double x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double2 simd_recip(simd_double2 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double3 simd_recip(simd_double3 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double4 simd_recip(simd_double4 x); -/*! @abstract An approximation to 1/x. - * @discussion If x is very close to the limits of representation, the - * result may overflow or underflow. This function maps to - * simd_fast_recip(x) if -ffast-math is specified, and to - * simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double8 simd_recip(simd_double8 x); -/*! @abstract An approximation to 1/x. - * @discussion Deprecated. Use simd_recip(x) instead. */ -#define vector_recip simd_recip - -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC float simd_precise_rsqrt(float x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_float2 simd_precise_rsqrt(simd_float2 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_float3 simd_precise_rsqrt(simd_float3 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_float4 simd_precise_rsqrt(simd_float4 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_float8 simd_precise_rsqrt(simd_float8 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_float16 simd_precise_rsqrt(simd_float16 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC double simd_precise_rsqrt(double x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_double2 simd_precise_rsqrt(simd_double2 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_double3 simd_precise_rsqrt(simd_double3 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_double4 simd_precise_rsqrt(simd_double4 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion This function is accurate to a few units in the last place - * (ULPs). */ -static inline SIMD_CFUNC simd_double8 simd_precise_rsqrt(simd_double8 x); -/*! @abstract A good approximation to 1/sqrt(x). - * @discussion Deprecated. Use simd_precise_rsqrt(x) instead. */ -#define vector_precise_rsqrt simd_precise_rsqrt - -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC float simd_fast_rsqrt(float x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_float2 simd_fast_rsqrt(simd_float2 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_float3 simd_fast_rsqrt(simd_float3 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_float4 simd_fast_rsqrt(simd_float4 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_float8 simd_fast_rsqrt(simd_float8 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_float16 simd_fast_rsqrt(simd_float16 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC double simd_fast_rsqrt(double x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_double2 simd_fast_rsqrt(simd_double2 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_double3 simd_fast_rsqrt(simd_double3 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_double4 simd_fast_rsqrt(simd_double4 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion This function is accurate to at least 11 bits for float and - * 22 bits for double. */ -static inline SIMD_CFUNC simd_double8 simd_fast_rsqrt(simd_double8 x); -/*! @abstract A fast approximation to 1/sqrt(x). - * @discussion Deprecated. Use simd_fast_rsqrt(x) instead. */ -#define vector_fast_rsqrt simd_fast_rsqrt - -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC float simd_rsqrt(float x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float2 simd_rsqrt(simd_float2 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float3 simd_rsqrt(simd_float3 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float4 simd_rsqrt(simd_float4 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float8 simd_rsqrt(simd_float8 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_float16 simd_rsqrt(simd_float16 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC double simd_rsqrt(double x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double2 simd_rsqrt(simd_double2 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double3 simd_rsqrt(simd_double3 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double4 simd_rsqrt(simd_double4 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion This function maps to simd_fast_recip(x) if -ffast-math is - * specified, and to simd_precise_recip(x) otherwise. */ -static inline SIMD_CFUNC simd_double8 simd_rsqrt(simd_double8 x); -/*! @abstract An approximation to 1/sqrt(x). - * @discussion Deprecated. Use simd_rsqrt(x) instead. */ -#define vector_rsqrt simd_rsqrt - -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC float simd_fract(float x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_float2 simd_fract(simd_float2 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_float3 simd_fract(simd_float3 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_float4 simd_fract(simd_float4 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_float8 simd_fract(simd_float8 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_float16 simd_fract(simd_float16 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC double simd_fract(double x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_double2 simd_fract(simd_double2 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_double3 simd_fract(simd_double3 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_double4 simd_fract(simd_double4 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion floor(x) + fract(x) is *approximately* equal to x. If x is - * positive and finite, then the two values are exactly equal. */ -static inline SIMD_CFUNC simd_double8 simd_fract(simd_double8 x); -/*! @abstract The "fractional part" of x, lying in the range [0, 1). - * @discussion Deprecated. Use simd_fract(x) instead. */ -#define vector_fract simd_fract - -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC float simd_step(float edge, float x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_float2 simd_step(simd_float2 edge, simd_float2 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_float3 simd_step(simd_float3 edge, simd_float3 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_float4 simd_step(simd_float4 edge, simd_float4 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_float8 simd_step(simd_float8 edge, simd_float8 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_float16 simd_step(simd_float16 edge, simd_float16 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC double simd_step(double edge, double x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_double2 simd_step(simd_double2 edge, simd_double2 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_double3 simd_step(simd_double3 edge, simd_double3 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_double4 simd_step(simd_double4 edge, simd_double4 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Use a scalar value for edge if you want to apply the same - * threshold to all lanes. */ -static inline SIMD_CFUNC simd_double8 simd_step(simd_double8 edge, simd_double8 x); -/*! @abstract 0 if x < edge, and 1 otherwise. - * @discussion Deprecated. Use simd_step(edge, x) instead. */ -#define vector_step simd_step - -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC float simd_smoothstep(float edge0, float edge1, float x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_float2 simd_smoothstep(simd_float2 edge0, simd_float2 edge1, simd_float2 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_float3 simd_smoothstep(simd_float3 edge0, simd_float3 edge1, simd_float3 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_float4 simd_smoothstep(simd_float4 edge0, simd_float4 edge1, simd_float4 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_float8 simd_smoothstep(simd_float8 edge0, simd_float8 edge1, simd_float8 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_float16 simd_smoothstep(simd_float16 edge0, simd_float16 edge1, simd_float16 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC double simd_smoothstep(double edge0, double edge1, double x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_double2 simd_smoothstep(simd_double2 edge0, simd_double2 edge1, simd_double2 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_double3 simd_smoothstep(simd_double3 edge0, simd_double3 edge1, simd_double3 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_double4 simd_smoothstep(simd_double4 edge0, simd_double4 edge1, simd_double4 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion You can use a scalar value for edge0 and edge1 if you want - * to clamp all lanes at the same points. */ -static inline SIMD_CFUNC simd_double8 simd_smoothstep(simd_double8 edge0, simd_double8 edge1, simd_double8 x); -/*! @abstract Interpolates smoothly between 0 at edge0 and 1 at edge1 - * @discussion Deprecated. Use simd_smoothstep(edge0, edge1, x) instead. */ -#define vector_smoothstep simd_smoothstep - -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC char simd_reduce_add(simd_char2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC char simd_reduce_add(simd_char3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC char simd_reduce_add(simd_char4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC char simd_reduce_add(simd_char8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC char simd_reduce_add(simd_char16 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC char simd_reduce_add(simd_char32 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC char simd_reduce_add(simd_char64 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar16 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar32 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar64 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC short simd_reduce_add(simd_short2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC short simd_reduce_add(simd_short3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC short simd_reduce_add(simd_short4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC short simd_reduce_add(simd_short8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC short simd_reduce_add(simd_short16 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC short simd_reduce_add(simd_short32 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort16 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort32 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC int simd_reduce_add(simd_int2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC int simd_reduce_add(simd_int3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC int simd_reduce_add(simd_int4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC int simd_reduce_add(simd_int8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC int simd_reduce_add(simd_int16 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint16 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC float simd_reduce_add(simd_float2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC float simd_reduce_add(simd_float3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC float simd_reduce_add(simd_float4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC float simd_reduce_add(simd_float8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC float simd_reduce_add(simd_float16 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong8 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC double simd_reduce_add(simd_double2 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC double simd_reduce_add(simd_double3 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC double simd_reduce_add(simd_double4 x); -/*! @abstract Sum of elements in x. - * @discussion This computation may overflow; especial for 8-bit types you - * may need to convert to a wider type before reducing. */ -static inline SIMD_CFUNC double simd_reduce_add(simd_double8 x); -/*! @abstract Sum of elements in x. - * @discussion Deprecated. Use simd_add(x) instead. */ -#define vector_reduce_add simd_reduce_add - -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_min(simd_char2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_min(simd_char3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_min(simd_char4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_min(simd_char8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_min(simd_char16 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_min(simd_char32 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_min(simd_char64 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar16 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar32 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar64 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_min(simd_short2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_min(simd_short3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_min(simd_short4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_min(simd_short8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_min(simd_short16 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_min(simd_short32 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort16 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort32 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_min(simd_int2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_min(simd_int3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_min(simd_int4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_min(simd_int8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_min(simd_int16 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint16 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_min(simd_float2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_min(simd_float3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_min(simd_float4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_min(simd_float8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_min(simd_float16 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong8 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_min(simd_double2 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_min(simd_double3 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_min(simd_double4 x); -/*! @abstract Minimum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_min(simd_double8 x); -/*! @abstract Minimum of elements in x. - * @discussion Deprecated. Use simd_min(x) instead. */ -#define vector_reduce_min simd_reduce_min - -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_max(simd_char2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_max(simd_char3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_max(simd_char4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_max(simd_char8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_max(simd_char16 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_max(simd_char32 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC char simd_reduce_max(simd_char64 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar16 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar32 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar64 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_max(simd_short2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_max(simd_short3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_max(simd_short4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_max(simd_short8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_max(simd_short16 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC short simd_reduce_max(simd_short32 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort16 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort32 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_max(simd_int2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_max(simd_int3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_max(simd_int4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_max(simd_int8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC int simd_reduce_max(simd_int16 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint16 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_max(simd_float2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_max(simd_float3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_max(simd_float4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_max(simd_float8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC float simd_reduce_max(simd_float16 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong8 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_max(simd_double2 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_max(simd_double3 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_max(simd_double4 x); -/*! @abstract Maximum of elements in x. */ -static inline SIMD_CFUNC double simd_reduce_max(simd_double8 x); -/*! @abstract Maximum of elements in x. - * @discussion Deprecated. Use simd_max(x) instead. */ -#define vector_reduce_max simd_reduce_max - -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_char2 x, simd_char2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_char3 x, simd_char3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_char4 x, simd_char4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_char8 x, simd_char8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_char16 x, simd_char16 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_char32 x, simd_char32 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_char64 x, simd_char64 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uchar2 x, simd_uchar2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uchar3 x, simd_uchar3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uchar4 x, simd_uchar4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uchar8 x, simd_uchar8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uchar16 x, simd_uchar16 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uchar32 x, simd_uchar32 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uchar64 x, simd_uchar64 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_short2 x, simd_short2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_short3 x, simd_short3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_short4 x, simd_short4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_short8 x, simd_short8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_short16 x, simd_short16 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_short32 x, simd_short32 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ushort2 x, simd_ushort2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ushort3 x, simd_ushort3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ushort4 x, simd_ushort4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ushort8 x, simd_ushort8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ushort16 x, simd_ushort16 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ushort32 x, simd_ushort32 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_int2 x, simd_int2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_int3 x, simd_int3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_int4 x, simd_int4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_int8 x, simd_int8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_int16 x, simd_int16 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uint2 x, simd_uint2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uint3 x, simd_uint3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uint4 x, simd_uint4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uint8 x, simd_uint8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_uint16 x, simd_uint16 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_float2 x, simd_float2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_float3 x, simd_float3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_float4 x, simd_float4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_float8 x, simd_float8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_float16 x, simd_float16 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_long2 x, simd_long2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_long3 x, simd_long3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_long4 x, simd_long4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_long8 x, simd_long8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ulong2 x, simd_ulong2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ulong3 x, simd_ulong3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ulong4 x, simd_ulong4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_ulong8 x, simd_ulong8 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_double2 x, simd_double2 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_double3 x, simd_double3 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_double4 x, simd_double4 y) { - return simd_all(x == y); -} -/*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. */ -static inline SIMD_CFUNC simd_bool simd_equal(simd_double8 x, simd_double8 y) { - return simd_all(x == y); -} - -#ifdef __cplusplus -} /* extern "C" */ - -namespace simd { - /*! @abstract The lanewise absolute value of x. */ - template static SIMD_CPPFUNC typeN abs(const typeN x) { return ::simd_abs(x); } - /*! @abstract The lanewise maximum of x and y. */ - template static SIMD_CPPFUNC typeN max(const typeN x, const typeN y) { return ::simd_max(x,y); } - /*! @abstract The lanewise minimum of x and y. */ - template static SIMD_CPPFUNC typeN min(const typeN x, const typeN y) { return ::simd_min(x,y); } - /*! @abstract x clamped to the interval [min, max]. */ - template static SIMD_CPPFUNC typeN clamp(const typeN x, const typeN min, const typeN max) { return ::simd_clamp(x,min,max); } - /*! @abstract -1 if x < 0, +1 if x > 0, and 0 otherwise. */ - template static SIMD_CPPFUNC fptypeN sign(const fptypeN x) { return ::simd_sign(x); } - /*! @abstract Linearly interpolates between x and y, taking the value x when t=0 and y when t=1 */ - template static SIMD_CPPFUNC fptypeN mix(const fptypeN x, const fptypeN y, const fptypeN t) { return ::simd_mix(x,y,t); } - /*! @abstract An approximation to 1/x. */ - template static SIMD_CPPFUNC fptypeN recip(const fptypeN x) { return simd_recip(x); } - /*! @abstract An approximation to 1/sqrt(x). */ - template static SIMD_CPPFUNC fptypeN rsqrt(const fptypeN x) { return simd_rsqrt(x); } - /*! @abstract The "fracional part" of x, in the range [0,1). */ - template static SIMD_CPPFUNC fptypeN fract(const fptypeN x) { return ::simd_fract(x); } - /*! @abstract 0 if x < edge, 1 otherwise. */ - template static SIMD_CPPFUNC fptypeN step(const fptypeN edge, const fptypeN x) { return ::simd_step(edge,x); } - /*! @abstract smoothly interpolates from 0 at edge0 to 1 at edge1. */ - template static SIMD_CPPFUNC fptypeN smoothstep(const fptypeN edge0, const fptypeN edge1, const fptypeN x) { return ::simd_smoothstep(edge0,edge1,x); } - /*! @abstract True if and only if each lane of x is equal to the - * corresponding lane of y. - * - * @discussion This isn't operator== because that's already defined by - * the compiler to return a lane mask. */ - template static SIMD_CPPFUNC simd_bool equal(const fptypeN x, const fptypeN y) { return ::simd_equal(x, y); } -#if __cpp_decltype_auto - /* If you are targeting an earlier version of the C++ standard that lacks - decltype_auto support, you may use the C-style simd_reduce_* functions - instead. */ - /*! @abstract The sum of the elements in x. May overflow. */ - template static SIMD_CPPFUNC auto reduce_add(typeN x) { return ::simd_reduce_add(x); } - /*! @abstract The least element in x. */ - template static SIMD_CPPFUNC auto reduce_min(typeN x) { return ::simd_reduce_min(x); } - /*! @abstract The greatest element in x. */ - template static SIMD_CPPFUNC auto reduce_max(typeN x) { return ::simd_reduce_max(x); } -#endif - namespace precise { - /*! @abstract An approximation to 1/x. */ - template static SIMD_CPPFUNC fptypeN recip(const fptypeN x) { return ::simd_precise_recip(x); } - /*! @abstract An approximation to 1/sqrt(x). */ - template static SIMD_CPPFUNC fptypeN rsqrt(const fptypeN x) { return ::simd_precise_rsqrt(x); } - } - namespace fast { - /*! @abstract An approximation to 1/x. */ - template static SIMD_CPPFUNC fptypeN recip(const fptypeN x) { return ::simd_fast_recip(x); } - /*! @abstract An approximation to 1/sqrt(x). */ - template static SIMD_CPPFUNC fptypeN rsqrt(const fptypeN x) { return ::simd_fast_rsqrt(x); } - } -} - -extern "C" { -#endif /* __cplusplus */ - -#pragma mark - Implementation - -static inline SIMD_CFUNC simd_char2 simd_abs(simd_char2 x) { - return simd_make_char2(simd_abs(simd_make_char8_undef(x))); -} - -static inline SIMD_CFUNC simd_char3 simd_abs(simd_char3 x) { - return simd_make_char3(simd_abs(simd_make_char8_undef(x))); -} - -static inline SIMD_CFUNC simd_char4 simd_abs(simd_char4 x) { - return simd_make_char4(simd_abs(simd_make_char8_undef(x))); -} - -static inline SIMD_CFUNC simd_char8 simd_abs(simd_char8 x) { -#if defined __arm__ || defined __arm64__ - return vabs_s8(x); -#else - return simd_make_char8(simd_abs(simd_make_char16_undef(x))); -#endif -} - -static inline SIMD_CFUNC simd_char16 simd_abs(simd_char16 x) { -#if defined __arm__ || defined __arm64__ - return vabsq_s8(x); -#elif defined __SSE4_1__ - return _mm_abs_epi8(x); -#else - simd_char16 mask = x >> 7; return (x ^ mask) - mask; -#endif -} - -static inline SIMD_CFUNC simd_char32 simd_abs(simd_char32 x) { -#if defined __AVX2__ - return _mm256_abs_epi8(x); -#else - return simd_make_char32(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_char64 simd_abs(simd_char64 x) { -#if defined __AVX512BW__ - return _mm512_abs_epi8(x); -#else - return simd_make_char64(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_short2 simd_abs(simd_short2 x) { - return simd_make_short2(simd_abs(simd_make_short4_undef(x))); -} - -static inline SIMD_CFUNC simd_short3 simd_abs(simd_short3 x) { - return simd_make_short3(simd_abs(simd_make_short4_undef(x))); -} - -static inline SIMD_CFUNC simd_short4 simd_abs(simd_short4 x) { -#if defined __arm__ || defined __arm64__ - return vabs_s16(x); -#else - return simd_make_short4(simd_abs(simd_make_short8_undef(x))); -#endif -} - -static inline SIMD_CFUNC simd_short8 simd_abs(simd_short8 x) { -#if defined __arm__ || defined __arm64__ - return vabsq_s16(x); -#elif defined __SSE4_1__ - return _mm_abs_epi16(x); -#else - simd_short8 mask = x >> 15; return (x ^ mask) - mask; -#endif -} - -static inline SIMD_CFUNC simd_short16 simd_abs(simd_short16 x) { -#if defined __AVX2__ - return _mm256_abs_epi16(x); -#else - return simd_make_short16(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_short32 simd_abs(simd_short32 x) { -#if defined __AVX512BW__ - return _mm512_abs_epi16(x); -#else - return simd_make_short32(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_int2 simd_abs(simd_int2 x) { -#if defined __arm__ || defined __arm64__ - return vabs_s32(x); -#else - return simd_make_int2(simd_abs(simd_make_int4_undef(x))); -#endif -} - -static inline SIMD_CFUNC simd_int3 simd_abs(simd_int3 x) { - return simd_make_int3(simd_abs(simd_make_int4_undef(x))); -} - -static inline SIMD_CFUNC simd_int4 simd_abs(simd_int4 x) { -#if defined __arm__ || defined __arm64__ - return vabsq_s32(x); -#elif defined __SSE4_1__ - return _mm_abs_epi32(x); -#else - simd_int4 mask = x >> 31; return (x ^ mask) - mask; -#endif -} - -static inline SIMD_CFUNC simd_int8 simd_abs(simd_int8 x) { -#if defined __AVX2__ - return _mm256_abs_epi32(x); -#else - return simd_make_int8(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_int16 simd_abs(simd_int16 x) { -#if defined __AVX512F__ - return _mm512_abs_epi32(x); -#else - return simd_make_int16(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_float2 simd_abs(simd_float2 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_float3 simd_abs(simd_float3 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_float4 simd_abs(simd_float4 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_float8 simd_abs(simd_float8 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_float16 simd_abs(simd_float16 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_long2 simd_abs(simd_long2 x) { -#if defined __arm64__ - return vabsq_s64(x); -#elif defined __SSE4_1__ - return _mm_abs_epi64(x); -#else - simd_long2 mask = x >> 63; return (x ^ mask) - mask; -#endif -} - -static inline SIMD_CFUNC simd_long3 simd_abs(simd_long3 x) { - return simd_make_long3(simd_abs(simd_make_long4_undef(x))); -} - -static inline SIMD_CFUNC simd_long4 simd_abs(simd_long4 x) { -#if defined __AVX2__ - return _mm256_abs_epi64(x); -#else - return simd_make_long4(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_long8 simd_abs(simd_long8 x) { -#if defined __AVX512F__ - return _mm512_abs_epi64(x); -#else - return simd_make_long8(simd_abs(x.lo), simd_abs(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_double2 simd_abs(simd_double2 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_double3 simd_abs(simd_double3 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_double4 simd_abs(simd_double4 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_double8 simd_abs(simd_double8 x) { - return __tg_fabs(x); -} - -static inline SIMD_CFUNC simd_char2 simd_min(simd_char2 x, simd_char2 y) { - return simd_make_char2(simd_min(simd_make_char8_undef(x), simd_make_char8_undef(y))); -} - -static inline SIMD_CFUNC simd_char3 simd_min(simd_char3 x, simd_char3 y) { - return simd_make_char3(simd_min(simd_make_char8_undef(x), simd_make_char8_undef(y))); -} - -static inline SIMD_CFUNC simd_char4 simd_min(simd_char4 x, simd_char4 y) { - return simd_make_char4(simd_min(simd_make_char8_undef(x), simd_make_char8_undef(y))); -} - -static inline SIMD_CFUNC simd_char8 simd_min(simd_char8 x, simd_char8 y) { -#if defined __arm__ || defined __arm64__ - return vmin_s8(x, y); -#else - return simd_make_char8(simd_min(simd_make_char16_undef(x), simd_make_char16_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_char16 simd_min(simd_char16 x, simd_char16 y) { -#if defined __arm__ || defined __arm64__ - return vminq_s8(x, y); -#elif defined __SSE4_1__ - return _mm_min_epi8(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_char32 simd_min(simd_char32 x, simd_char32 y) { -#if defined __AVX2__ - return _mm256_min_epi8(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_char64 simd_min(simd_char64 x, simd_char64 y) { -#if defined __AVX512BW__ - return _mm512_min_epi8(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_uchar2 simd_min(simd_uchar2 x, simd_uchar2 y) { - return simd_make_uchar2(simd_min(simd_make_uchar8_undef(x), simd_make_uchar8_undef(y))); -} - -static inline SIMD_CFUNC simd_uchar3 simd_min(simd_uchar3 x, simd_uchar3 y) { - return simd_make_uchar3(simd_min(simd_make_uchar8_undef(x), simd_make_uchar8_undef(y))); -} - -static inline SIMD_CFUNC simd_uchar4 simd_min(simd_uchar4 x, simd_uchar4 y) { - return simd_make_uchar4(simd_min(simd_make_uchar8_undef(x), simd_make_uchar8_undef(y))); -} - -static inline SIMD_CFUNC simd_uchar8 simd_min(simd_uchar8 x, simd_uchar8 y) { -#if defined __arm__ || defined __arm64__ - return vmin_u8(x, y); -#else - return simd_make_uchar8(simd_min(simd_make_uchar16_undef(x), simd_make_uchar16_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_uchar16 simd_min(simd_uchar16 x, simd_uchar16 y) { -#if defined __arm__ || defined __arm64__ - return vminq_u8(x, y); -#elif defined __SSE4_1__ - return _mm_min_epu8(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_uchar32 simd_min(simd_uchar32 x, simd_uchar32 y) { -#if defined __AVX2__ - return _mm256_min_epu8(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_uchar64 simd_min(simd_uchar64 x, simd_uchar64 y) { -#if defined __AVX512BW__ - return _mm512_min_epu8(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_short2 simd_min(simd_short2 x, simd_short2 y) { - return simd_make_short2(simd_min(simd_make_short4_undef(x), simd_make_short4_undef(y))); -} - -static inline SIMD_CFUNC simd_short3 simd_min(simd_short3 x, simd_short3 y) { - return simd_make_short3(simd_min(simd_make_short4_undef(x), simd_make_short4_undef(y))); -} - -static inline SIMD_CFUNC simd_short4 simd_min(simd_short4 x, simd_short4 y) { -#if defined __arm__ || defined __arm64__ - return vmin_s16(x, y); -#else - return simd_make_short4(simd_min(simd_make_short8_undef(x), simd_make_short8_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_short8 simd_min(simd_short8 x, simd_short8 y) { -#if defined __arm__ || defined __arm64__ - return vminq_s16(x, y); -#elif defined __SSE4_1__ - return _mm_min_epi16(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_short16 simd_min(simd_short16 x, simd_short16 y) { -#if defined __AVX2__ - return _mm256_min_epi16(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_short32 simd_min(simd_short32 x, simd_short32 y) { -#if defined __AVX512BW__ - return _mm512_min_epi16(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_ushort2 simd_min(simd_ushort2 x, simd_ushort2 y) { - return simd_make_ushort2(simd_min(simd_make_ushort4_undef(x), simd_make_ushort4_undef(y))); -} - -static inline SIMD_CFUNC simd_ushort3 simd_min(simd_ushort3 x, simd_ushort3 y) { - return simd_make_ushort3(simd_min(simd_make_ushort4_undef(x), simd_make_ushort4_undef(y))); -} - -static inline SIMD_CFUNC simd_ushort4 simd_min(simd_ushort4 x, simd_ushort4 y) { -#if defined __arm__ || defined __arm64__ - return vmin_u16(x, y); -#else - return simd_make_ushort4(simd_min(simd_make_ushort8_undef(x), simd_make_ushort8_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_ushort8 simd_min(simd_ushort8 x, simd_ushort8 y) { -#if defined __arm__ || defined __arm64__ - return vminq_u16(x, y); -#elif defined __SSE4_1__ - return _mm_min_epu16(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_ushort16 simd_min(simd_ushort16 x, simd_ushort16 y) { -#if defined __AVX2__ - return _mm256_min_epu16(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_ushort32 simd_min(simd_ushort32 x, simd_ushort32 y) { -#if defined __AVX512BW__ - return _mm512_min_epu16(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_int2 simd_min(simd_int2 x, simd_int2 y) { -#if defined __arm__ || defined __arm64__ - return vmin_s32(x, y); -#else - return simd_make_int2(simd_min(simd_make_int4_undef(x), simd_make_int4_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_int3 simd_min(simd_int3 x, simd_int3 y) { - return simd_make_int3(simd_min(simd_make_int4_undef(x), simd_make_int4_undef(y))); -} - -static inline SIMD_CFUNC simd_int4 simd_min(simd_int4 x, simd_int4 y) { -#if defined __arm__ || defined __arm64__ - return vminq_s32(x, y); -#elif defined __SSE4_1__ - return _mm_min_epi32(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_int8 simd_min(simd_int8 x, simd_int8 y) { -#if defined __AVX2__ - return _mm256_min_epi32(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_int16 simd_min(simd_int16 x, simd_int16 y) { -#if defined __AVX512F__ - return _mm512_min_epi32(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_uint2 simd_min(simd_uint2 x, simd_uint2 y) { -#if defined __arm__ || defined __arm64__ - return vmin_u32(x, y); -#else - return simd_make_uint2(simd_min(simd_make_uint4_undef(x), simd_make_uint4_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_uint3 simd_min(simd_uint3 x, simd_uint3 y) { - return simd_make_uint3(simd_min(simd_make_uint4_undef(x), simd_make_uint4_undef(y))); -} - -static inline SIMD_CFUNC simd_uint4 simd_min(simd_uint4 x, simd_uint4 y) { -#if defined __arm__ || defined __arm64__ - return vminq_u32(x, y); -#elif defined __SSE4_1__ - return _mm_min_epu32(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_uint8 simd_min(simd_uint8 x, simd_uint8 y) { -#if defined __AVX2__ - return _mm256_min_epu32(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_uint16 simd_min(simd_uint16 x, simd_uint16 y) { -#if defined __AVX512F__ - return _mm512_min_epu32(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC float simd_min(float x, float y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_float2 simd_min(simd_float2 x, simd_float2 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_float3 simd_min(simd_float3 x, simd_float3 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_float4 simd_min(simd_float4 x, simd_float4 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_float8 simd_min(simd_float8 x, simd_float8 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_float16 simd_min(simd_float16 x, simd_float16 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_long2 simd_min(simd_long2 x, simd_long2 y) { -#if defined __AVX512VL__ - return _mm_min_epi64(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_long3 simd_min(simd_long3 x, simd_long3 y) { - return simd_make_long3(simd_min(simd_make_long4_undef(x), simd_make_long4_undef(y))); -} - -static inline SIMD_CFUNC simd_long4 simd_min(simd_long4 x, simd_long4 y) { -#if defined __AVX512VL__ - return _mm256_min_epi64(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_long8 simd_min(simd_long8 x, simd_long8 y) { -#if defined __AVX512F__ - return _mm512_min_epi64(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_ulong2 simd_min(simd_ulong2 x, simd_ulong2 y) { -#if defined __AVX512VL__ - return _mm_min_epu64(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_ulong3 simd_min(simd_ulong3 x, simd_ulong3 y) { - return simd_make_ulong3(simd_min(simd_make_ulong4_undef(x), simd_make_ulong4_undef(y))); -} - -static inline SIMD_CFUNC simd_ulong4 simd_min(simd_ulong4 x, simd_ulong4 y) { -#if defined __AVX512VL__ - return _mm256_min_epu64(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC simd_ulong8 simd_min(simd_ulong8 x, simd_ulong8 y) { -#if defined __AVX512F__ - return _mm512_min_epu64(x, y); -#else - return simd_bitselect(x, y, y < x); -#endif -} - -static inline SIMD_CFUNC double simd_min(double x, double y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_double2 simd_min(simd_double2 x, simd_double2 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_double3 simd_min(simd_double3 x, simd_double3 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_double4 simd_min(simd_double4 x, simd_double4 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_double8 simd_min(simd_double8 x, simd_double8 y) { - return __tg_fmin(x,y); -} - -static inline SIMD_CFUNC simd_char2 simd_max(simd_char2 x, simd_char2 y) { - return simd_make_char2(simd_max(simd_make_char8_undef(x), simd_make_char8_undef(y))); -} - -static inline SIMD_CFUNC simd_char3 simd_max(simd_char3 x, simd_char3 y) { - return simd_make_char3(simd_max(simd_make_char8_undef(x), simd_make_char8_undef(y))); -} - -static inline SIMD_CFUNC simd_char4 simd_max(simd_char4 x, simd_char4 y) { - return simd_make_char4(simd_max(simd_make_char8_undef(x), simd_make_char8_undef(y))); -} - -static inline SIMD_CFUNC simd_char8 simd_max(simd_char8 x, simd_char8 y) { -#if defined __arm__ || defined __arm64__ - return vmax_s8(x, y); -#else - return simd_make_char8(simd_max(simd_make_char16_undef(x), simd_make_char16_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_char16 simd_max(simd_char16 x, simd_char16 y) { -#if defined __arm__ || defined __arm64__ - return vmaxq_s8(x, y); -#elif defined __SSE4_1__ - return _mm_max_epi8(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_char32 simd_max(simd_char32 x, simd_char32 y) { -#if defined __AVX2__ - return _mm256_max_epi8(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_char64 simd_max(simd_char64 x, simd_char64 y) { -#if defined __AVX512BW__ - return _mm512_max_epi8(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_uchar2 simd_max(simd_uchar2 x, simd_uchar2 y) { - return simd_make_uchar2(simd_max(simd_make_uchar8_undef(x), simd_make_uchar8_undef(y))); -} - -static inline SIMD_CFUNC simd_uchar3 simd_max(simd_uchar3 x, simd_uchar3 y) { - return simd_make_uchar3(simd_max(simd_make_uchar8_undef(x), simd_make_uchar8_undef(y))); -} - -static inline SIMD_CFUNC simd_uchar4 simd_max(simd_uchar4 x, simd_uchar4 y) { - return simd_make_uchar4(simd_max(simd_make_uchar8_undef(x), simd_make_uchar8_undef(y))); -} - -static inline SIMD_CFUNC simd_uchar8 simd_max(simd_uchar8 x, simd_uchar8 y) { -#if defined __arm__ || defined __arm64__ - return vmax_u8(x, y); -#else - return simd_make_uchar8(simd_max(simd_make_uchar16_undef(x), simd_make_uchar16_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_uchar16 simd_max(simd_uchar16 x, simd_uchar16 y) { -#if defined __arm__ || defined __arm64__ - return vmaxq_u8(x, y); -#elif defined __SSE4_1__ - return _mm_max_epu8(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_uchar32 simd_max(simd_uchar32 x, simd_uchar32 y) { -#if defined __AVX2__ - return _mm256_max_epu8(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_uchar64 simd_max(simd_uchar64 x, simd_uchar64 y) { -#if defined __AVX512BW__ - return _mm512_max_epu8(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_short2 simd_max(simd_short2 x, simd_short2 y) { - return simd_make_short2(simd_max(simd_make_short4_undef(x), simd_make_short4_undef(y))); -} - -static inline SIMD_CFUNC simd_short3 simd_max(simd_short3 x, simd_short3 y) { - return simd_make_short3(simd_max(simd_make_short4_undef(x), simd_make_short4_undef(y))); -} - -static inline SIMD_CFUNC simd_short4 simd_max(simd_short4 x, simd_short4 y) { -#if defined __arm__ || defined __arm64__ - return vmax_s16(x, y); -#else - return simd_make_short4(simd_max(simd_make_short8_undef(x), simd_make_short8_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_short8 simd_max(simd_short8 x, simd_short8 y) { -#if defined __arm__ || defined __arm64__ - return vmaxq_s16(x, y); -#elif defined __SSE4_1__ - return _mm_max_epi16(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_short16 simd_max(simd_short16 x, simd_short16 y) { -#if defined __AVX2__ - return _mm256_max_epi16(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_short32 simd_max(simd_short32 x, simd_short32 y) { -#if defined __AVX512BW__ - return _mm512_max_epi16(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_ushort2 simd_max(simd_ushort2 x, simd_ushort2 y) { - return simd_make_ushort2(simd_max(simd_make_ushort4_undef(x), simd_make_ushort4_undef(y))); -} - -static inline SIMD_CFUNC simd_ushort3 simd_max(simd_ushort3 x, simd_ushort3 y) { - return simd_make_ushort3(simd_max(simd_make_ushort4_undef(x), simd_make_ushort4_undef(y))); -} - -static inline SIMD_CFUNC simd_ushort4 simd_max(simd_ushort4 x, simd_ushort4 y) { -#if defined __arm__ || defined __arm64__ - return vmax_u16(x, y); -#else - return simd_make_ushort4(simd_max(simd_make_ushort8_undef(x), simd_make_ushort8_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_ushort8 simd_max(simd_ushort8 x, simd_ushort8 y) { -#if defined __arm__ || defined __arm64__ - return vmaxq_u16(x, y); -#elif defined __SSE4_1__ - return _mm_max_epu16(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_ushort16 simd_max(simd_ushort16 x, simd_ushort16 y) { -#if defined __AVX2__ - return _mm256_max_epu16(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_ushort32 simd_max(simd_ushort32 x, simd_ushort32 y) { -#if defined __AVX512BW__ - return _mm512_max_epu16(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_int2 simd_max(simd_int2 x, simd_int2 y) { -#if defined __arm__ || defined __arm64__ - return vmax_s32(x, y); -#else - return simd_make_int2(simd_max(simd_make_int4_undef(x), simd_make_int4_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_int3 simd_max(simd_int3 x, simd_int3 y) { - return simd_make_int3(simd_max(simd_make_int4_undef(x), simd_make_int4_undef(y))); -} - -static inline SIMD_CFUNC simd_int4 simd_max(simd_int4 x, simd_int4 y) { -#if defined __arm__ || defined __arm64__ - return vmaxq_s32(x, y); -#elif defined __SSE4_1__ - return _mm_max_epi32(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_int8 simd_max(simd_int8 x, simd_int8 y) { -#if defined __AVX2__ - return _mm256_max_epi32(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_int16 simd_max(simd_int16 x, simd_int16 y) { -#if defined __AVX512F__ - return _mm512_max_epi32(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_uint2 simd_max(simd_uint2 x, simd_uint2 y) { -#if defined __arm__ || defined __arm64__ - return vmax_u32(x, y); -#else - return simd_make_uint2(simd_max(simd_make_uint4_undef(x), simd_make_uint4_undef(y))); -#endif - -} - -static inline SIMD_CFUNC simd_uint3 simd_max(simd_uint3 x, simd_uint3 y) { - return simd_make_uint3(simd_max(simd_make_uint4_undef(x), simd_make_uint4_undef(y))); -} - -static inline SIMD_CFUNC simd_uint4 simd_max(simd_uint4 x, simd_uint4 y) { -#if defined __arm__ || defined __arm64__ - return vmaxq_u32(x, y); -#elif defined __SSE4_1__ - return _mm_max_epu32(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_uint8 simd_max(simd_uint8 x, simd_uint8 y) { -#if defined __AVX2__ - return _mm256_max_epu32(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_uint16 simd_max(simd_uint16 x, simd_uint16 y) { -#if defined __AVX512F__ - return _mm512_max_epu32(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC float simd_max(float x, float y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_float2 simd_max(simd_float2 x, simd_float2 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_float3 simd_max(simd_float3 x, simd_float3 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_float4 simd_max(simd_float4 x, simd_float4 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_float8 simd_max(simd_float8 x, simd_float8 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_float16 simd_max(simd_float16 x, simd_float16 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_long2 simd_max(simd_long2 x, simd_long2 y) { -#if defined __AVX512VL__ - return _mm_max_epi64(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_long3 simd_max(simd_long3 x, simd_long3 y) { - return simd_make_long3(simd_max(simd_make_long4_undef(x), simd_make_long4_undef(y))); -} - -static inline SIMD_CFUNC simd_long4 simd_max(simd_long4 x, simd_long4 y) { -#if defined __AVX512VL__ - return _mm256_max_epi64(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_long8 simd_max(simd_long8 x, simd_long8 y) { -#if defined __AVX512F__ - return _mm512_max_epi64(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_ulong2 simd_max(simd_ulong2 x, simd_ulong2 y) { -#if defined __AVX512VL__ - return _mm_max_epu64(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_ulong3 simd_max(simd_ulong3 x, simd_ulong3 y) { - return simd_make_ulong3(simd_max(simd_make_ulong4_undef(x), simd_make_ulong4_undef(y))); -} - -static inline SIMD_CFUNC simd_ulong4 simd_max(simd_ulong4 x, simd_ulong4 y) { -#if defined __AVX512VL__ - return _mm256_max_epu64(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC simd_ulong8 simd_max(simd_ulong8 x, simd_ulong8 y) { -#if defined __AVX512F__ - return _mm512_max_epu64(x, y); -#else - return simd_bitselect(x, y, x < y); -#endif -} - -static inline SIMD_CFUNC double simd_max(double x, double y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_double2 simd_max(simd_double2 x, simd_double2 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_double3 simd_max(simd_double3 x, simd_double3 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_double4 simd_max(simd_double4 x, simd_double4 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_double8 simd_max(simd_double8 x, simd_double8 y) { - return __tg_fmax(x,y); -} - -static inline SIMD_CFUNC simd_char2 simd_clamp(simd_char2 x, simd_char2 min, simd_char2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_char3 simd_clamp(simd_char3 x, simd_char3 min, simd_char3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_char4 simd_clamp(simd_char4 x, simd_char4 min, simd_char4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_char8 simd_clamp(simd_char8 x, simd_char8 min, simd_char8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_char16 simd_clamp(simd_char16 x, simd_char16 min, simd_char16 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_char32 simd_clamp(simd_char32 x, simd_char32 min, simd_char32 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_char64 simd_clamp(simd_char64 x, simd_char64 min, simd_char64 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uchar2 simd_clamp(simd_uchar2 x, simd_uchar2 min, simd_uchar2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uchar3 simd_clamp(simd_uchar3 x, simd_uchar3 min, simd_uchar3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uchar4 simd_clamp(simd_uchar4 x, simd_uchar4 min, simd_uchar4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uchar8 simd_clamp(simd_uchar8 x, simd_uchar8 min, simd_uchar8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uchar16 simd_clamp(simd_uchar16 x, simd_uchar16 min, simd_uchar16 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uchar32 simd_clamp(simd_uchar32 x, simd_uchar32 min, simd_uchar32 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uchar64 simd_clamp(simd_uchar64 x, simd_uchar64 min, simd_uchar64 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_short2 simd_clamp(simd_short2 x, simd_short2 min, simd_short2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_short3 simd_clamp(simd_short3 x, simd_short3 min, simd_short3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_short4 simd_clamp(simd_short4 x, simd_short4 min, simd_short4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_short8 simd_clamp(simd_short8 x, simd_short8 min, simd_short8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_short16 simd_clamp(simd_short16 x, simd_short16 min, simd_short16 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_short32 simd_clamp(simd_short32 x, simd_short32 min, simd_short32 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ushort2 simd_clamp(simd_ushort2 x, simd_ushort2 min, simd_ushort2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ushort3 simd_clamp(simd_ushort3 x, simd_ushort3 min, simd_ushort3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ushort4 simd_clamp(simd_ushort4 x, simd_ushort4 min, simd_ushort4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ushort8 simd_clamp(simd_ushort8 x, simd_ushort8 min, simd_ushort8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ushort16 simd_clamp(simd_ushort16 x, simd_ushort16 min, simd_ushort16 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ushort32 simd_clamp(simd_ushort32 x, simd_ushort32 min, simd_ushort32 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_int2 simd_clamp(simd_int2 x, simd_int2 min, simd_int2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_int3 simd_clamp(simd_int3 x, simd_int3 min, simd_int3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_int4 simd_clamp(simd_int4 x, simd_int4 min, simd_int4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_int8 simd_clamp(simd_int8 x, simd_int8 min, simd_int8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_int16 simd_clamp(simd_int16 x, simd_int16 min, simd_int16 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uint2 simd_clamp(simd_uint2 x, simd_uint2 min, simd_uint2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uint3 simd_clamp(simd_uint3 x, simd_uint3 min, simd_uint3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uint4 simd_clamp(simd_uint4 x, simd_uint4 min, simd_uint4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uint8 simd_clamp(simd_uint8 x, simd_uint8 min, simd_uint8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_uint16 simd_clamp(simd_uint16 x, simd_uint16 min, simd_uint16 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC float simd_clamp(float x, float min, float max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_float2 simd_clamp(simd_float2 x, simd_float2 min, simd_float2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_float3 simd_clamp(simd_float3 x, simd_float3 min, simd_float3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_float4 simd_clamp(simd_float4 x, simd_float4 min, simd_float4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_float8 simd_clamp(simd_float8 x, simd_float8 min, simd_float8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_float16 simd_clamp(simd_float16 x, simd_float16 min, simd_float16 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_long2 simd_clamp(simd_long2 x, simd_long2 min, simd_long2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_long3 simd_clamp(simd_long3 x, simd_long3 min, simd_long3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_long4 simd_clamp(simd_long4 x, simd_long4 min, simd_long4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_long8 simd_clamp(simd_long8 x, simd_long8 min, simd_long8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ulong2 simd_clamp(simd_ulong2 x, simd_ulong2 min, simd_ulong2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ulong3 simd_clamp(simd_ulong3 x, simd_ulong3 min, simd_ulong3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ulong4 simd_clamp(simd_ulong4 x, simd_ulong4 min, simd_ulong4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_ulong8 simd_clamp(simd_ulong8 x, simd_ulong8 min, simd_ulong8 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC double simd_clamp(double x, double min, double max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_double2 simd_clamp(simd_double2 x, simd_double2 min, simd_double2 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_double3 simd_clamp(simd_double3 x, simd_double3 min, simd_double3 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_double4 simd_clamp(simd_double4 x, simd_double4 min, simd_double4 max) { - return simd_min(simd_max(x, min), max); -} - -static inline SIMD_CFUNC simd_double8 simd_clamp(simd_double8 x, simd_double8 min, simd_double8 max) { - return simd_min(simd_max(x, min), max); -} - - -static inline SIMD_CFUNC float simd_sign(float x) { - return x == 0 | x != x ? 0 : copysign(1,x); -} - -static inline SIMD_CFUNC simd_float2 simd_sign(simd_float2 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC simd_float3 simd_sign(simd_float3 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC simd_float4 simd_sign(simd_float4 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC simd_float8 simd_sign(simd_float8 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC simd_float16 simd_sign(simd_float16 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC double simd_sign(double x) { - return x == 0 | x != x ? 0 : copysign(1,x); -} - -static inline SIMD_CFUNC simd_double2 simd_sign(simd_double2 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC simd_double3 simd_sign(simd_double3 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC simd_double4 simd_sign(simd_double4 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC simd_double8 simd_sign(simd_double8 x) { - return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); -} - -static inline SIMD_CFUNC float simd_mix(float x, float y, float t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_float2 simd_mix(simd_float2 x, simd_float2 y, simd_float2 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_float3 simd_mix(simd_float3 x, simd_float3 y, simd_float3 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_float4 simd_mix(simd_float4 x, simd_float4 y, simd_float4 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_float8 simd_mix(simd_float8 x, simd_float8 y, simd_float8 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_float16 simd_mix(simd_float16 x, simd_float16 y, simd_float16 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC double simd_mix(double x, double y, double t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_double2 simd_mix(simd_double2 x, simd_double2 y, simd_double2 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_double3 simd_mix(simd_double3 x, simd_double3 y, simd_double3 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_double4 simd_mix(simd_double4 x, simd_double4 y, simd_double4 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC simd_double8 simd_mix(simd_double8 x, simd_double8 y, simd_double8 t) { - return x + t*(y - x); -} - -static inline SIMD_CFUNC float simd_recip(float x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float2 simd_recip(simd_float2 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float3 simd_recip(simd_float3 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float4 simd_recip(simd_float4 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float8 simd_recip(simd_float8 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float16 simd_recip(simd_float16 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC double simd_recip(double x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_double2 simd_recip(simd_double2 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_double3 simd_recip(simd_double3 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_double4 simd_recip(simd_double4 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_double8 simd_recip(simd_double8 x) { -#if __FAST_MATH__ - return simd_fast_recip(x); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC float simd_fast_recip(float x) { -#if defined __AVX512VL__ - simd_float4 x4 = simd_make_float4(x); - return ((simd_float4)_mm_rcp14_ss(x4, x4)).x; -#elif defined __SSE__ - return ((simd_float4)_mm_rcp_ss(simd_make_float4(x))).x; -#elif defined __ARM_NEON__ - return simd_fast_recip(simd_make_float2_undef(x)).x; -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float2 simd_fast_recip(simd_float2 x) { -#if defined __SSE__ - return simd_make_float2(simd_fast_recip(simd_make_float4_undef(x))); -#elif defined __ARM_NEON__ - simd_float2 r = vrecpe_f32(x); - return r * vrecps_f32(x, r); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float3 simd_fast_recip(simd_float3 x) { - return simd_make_float3(simd_fast_recip(simd_make_float4_undef(x))); -} - -static inline SIMD_CFUNC simd_float4 simd_fast_recip(simd_float4 x) { -#if defined __AVX512VL__ - return _mm_rcp14_ps(x); -#elif defined __SSE__ - return _mm_rcp_ps(x); -#elif defined __ARM_NEON__ - simd_float4 r = vrecpeq_f32(x); - return r * vrecpsq_f32(x, r); -#else - return simd_precise_recip(x); -#endif -} - -static inline SIMD_CFUNC simd_float8 simd_fast_recip(simd_float8 x) { -#if defined __AVX512VL__ - return _mm256_rcp14_ps(x); -#elif defined __AVX__ - return _mm256_rcp_ps(x); -#else - return simd_make_float8(simd_fast_recip(x.lo), simd_fast_recip(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_float16 simd_fast_recip(simd_float16 x) { -#if defined __AVX512F__ - return _mm512_rcp14_ps(x); -#else - return simd_make_float16(simd_fast_recip(x.lo), simd_fast_recip(x.hi)); -#endif -} - -static inline SIMD_CFUNC double simd_fast_recip(double x) { - return simd_precise_recip(x); -} - -static inline SIMD_CFUNC simd_double2 simd_fast_recip(simd_double2 x) { - return simd_precise_recip(x); -} - -static inline SIMD_CFUNC simd_double3 simd_fast_recip(simd_double3 x) { - return simd_precise_recip(x); -} - -static inline SIMD_CFUNC simd_double4 simd_fast_recip(simd_double4 x) { - return simd_precise_recip(x); -} - -static inline SIMD_CFUNC simd_double8 simd_fast_recip(simd_double8 x) { - return simd_precise_recip(x); -} - -static inline SIMD_CFUNC float simd_precise_recip(float x) { -#if defined __SSE__ - float r = simd_fast_recip(x); - return r*(2 - (x == 0 ? -INFINITY : x)*r); -#elif defined __ARM_NEON__ - return simd_precise_recip(simd_make_float2_undef(x)).x; -#else - return 1/x; -#endif -} - -static inline SIMD_CFUNC simd_float2 simd_precise_recip(simd_float2 x) { -#if defined __SSE__ - return simd_make_float2(simd_precise_recip(simd_make_float4_undef(x))); -#elif defined __ARM_NEON__ - simd_float2 r = simd_fast_recip(x); - return r*vrecps_f32(x, r); -#else - return 1/x; -#endif -} - -static inline SIMD_CFUNC simd_float3 simd_precise_recip(simd_float3 x) { - return simd_make_float3(simd_precise_recip(simd_make_float4_undef(x))); -} - -static inline SIMD_CFUNC simd_float4 simd_precise_recip(simd_float4 x) { -#if defined __SSE__ - simd_float4 r = simd_fast_recip(x); - return r*(2 - simd_bitselect(x, -INFINITY, x == 0)*r); -#elif defined __ARM_NEON__ - simd_float4 r = simd_fast_recip(x); - return r*vrecpsq_f32(x, r); -#else - return 1/x; -#endif -} - -static inline SIMD_CFUNC simd_float8 simd_precise_recip(simd_float8 x) { -#if defined __AVX__ - simd_float8 r = simd_fast_recip(x); - return r*(2 - simd_bitselect(x, -INFINITY, x == 0)*r); -#else - return simd_make_float8(simd_precise_recip(x.lo), simd_precise_recip(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_float16 simd_precise_recip(simd_float16 x) { -#if defined __AVX512F__ - simd_float16 r = simd_fast_recip(x); - return r*(2 - simd_bitselect(x, -INFINITY, x == 0)*r); -#else - return simd_make_float16(simd_precise_recip(x.lo), simd_precise_recip(x.hi)); -#endif -} - -static inline SIMD_CFUNC double simd_precise_recip(double x) { - return 1/x; -} - -static inline SIMD_CFUNC simd_double2 simd_precise_recip(simd_double2 x) { - return 1/x; -} - -static inline SIMD_CFUNC simd_double3 simd_precise_recip(simd_double3 x) { - return 1/x; -} - -static inline SIMD_CFUNC simd_double4 simd_precise_recip(simd_double4 x) { - return 1/x; -} - -static inline SIMD_CFUNC simd_double8 simd_precise_recip(simd_double8 x) { - return 1/x; -} - -static inline SIMD_CFUNC float simd_rsqrt(float x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float2 simd_rsqrt(simd_float2 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float3 simd_rsqrt(simd_float3 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float4 simd_rsqrt(simd_float4 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float8 simd_rsqrt(simd_float8 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float16 simd_rsqrt(simd_float16 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC double simd_rsqrt(double x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_double2 simd_rsqrt(simd_double2 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_double3 simd_rsqrt(simd_double3 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_double4 simd_rsqrt(simd_double4 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_double8 simd_rsqrt(simd_double8 x) { -#if __FAST_MATH__ - return simd_fast_rsqrt(x); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC float simd_fast_rsqrt(float x) { -#if defined __AVX512VL__ - simd_float4 x4 = simd_make_float4(x); - return ((simd_float4)_mm_rsqrt14_ss(x4, x4)).x; -#elif defined __SSE__ - return ((simd_float4)_mm_rsqrt_ss(simd_make_float4(x))).x; -#elif defined __ARM_NEON__ - return simd_fast_rsqrt(simd_make_float2_undef(x)).x; -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float2 simd_fast_rsqrt(simd_float2 x) { -#if defined __SSE__ - return simd_make_float2(simd_fast_rsqrt(simd_make_float4_undef(x))); -#elif defined __ARM_NEON__ - simd_float2 r = vrsqrte_f32(x); - return r * vrsqrts_f32(x, r*r); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float3 simd_fast_rsqrt(simd_float3 x) { - return simd_make_float3(simd_fast_rsqrt(simd_make_float4_undef(x))); -} - -static inline SIMD_CFUNC simd_float4 simd_fast_rsqrt(simd_float4 x) { -#if defined __AVX512VL__ - return _mm_rsqrt14_ps(x); -#elif defined __SSE__ - return _mm_rsqrt_ps(x); -#elif defined __ARM_NEON__ - simd_float4 r = vrsqrteq_f32(x); - return r * vrsqrtsq_f32(x, r*r); -#else - return simd_precise_rsqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float8 simd_fast_rsqrt(simd_float8 x) { -#if defined __AVX512VL__ - return _mm256_rsqrt14_ps(x); -#elif defined __AVX__ - return _mm256_rsqrt_ps(x); -#else - return simd_make_float8(simd_fast_rsqrt(x.lo), simd_fast_rsqrt(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_float16 simd_fast_rsqrt(simd_float16 x) { -#if defined __AVX512F__ - return _mm512_rsqrt14_ps(x); -#else - return simd_make_float16(simd_fast_rsqrt(x.lo), simd_fast_rsqrt(x.hi)); -#endif -} - -static inline SIMD_CFUNC double simd_fast_rsqrt(double x) { - return simd_precise_rsqrt(x); -} - -static inline SIMD_CFUNC simd_double2 simd_fast_rsqrt(simd_double2 x) { - return simd_precise_rsqrt(x); -} - -static inline SIMD_CFUNC simd_double3 simd_fast_rsqrt(simd_double3 x) { - return simd_precise_rsqrt(x); -} - -static inline SIMD_CFUNC simd_double4 simd_fast_rsqrt(simd_double4 x) { - return simd_precise_rsqrt(x); -} - -static inline SIMD_CFUNC simd_double8 simd_fast_rsqrt(simd_double8 x) { - return simd_precise_rsqrt(x); -} - -static inline SIMD_CFUNC float simd_precise_rsqrt(float x) { -#if defined __SSE__ - float r = simd_fast_rsqrt(x); - return r*(1.5f - 0.5f*(r == INFINITY ? -INFINITY : x)*r*r); -#elif defined __ARM_NEON__ - return simd_precise_rsqrt(simd_make_float2_undef(x)).x; -#else - return 1/sqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float2 simd_precise_rsqrt(simd_float2 x) { -#if defined __SSE__ - return simd_make_float2(simd_precise_rsqrt(simd_make_float4_undef(x))); -#elif defined __ARM_NEON__ - simd_float2 r = simd_fast_rsqrt(x); - return r*vrsqrts_f32(x, r*r); -#else - return 1/__tg_sqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float3 simd_precise_rsqrt(simd_float3 x) { - return simd_make_float3(simd_precise_rsqrt(simd_make_float4_undef(x))); -} - -static inline SIMD_CFUNC simd_float4 simd_precise_rsqrt(simd_float4 x) { -#if defined __SSE__ - simd_float4 r = simd_fast_rsqrt(x); - return r*(1.5 - 0.5*simd_bitselect(x, -INFINITY, r == INFINITY)*r*r); -#elif defined __ARM_NEON__ - simd_float4 r = simd_fast_rsqrt(x); - return r*vrsqrtsq_f32(x, r*r); -#else - return 1/__tg_sqrt(x); -#endif -} - -static inline SIMD_CFUNC simd_float8 simd_precise_rsqrt(simd_float8 x) { -#if defined __AVX__ - simd_float8 r = simd_fast_rsqrt(x); - return r*(1.5 - 0.5*simd_bitselect(x, -INFINITY, r == INFINITY)*r*r); -#else - return simd_make_float8(simd_precise_rsqrt(x.lo), simd_precise_rsqrt(x.hi)); -#endif -} - -static inline SIMD_CFUNC simd_float16 simd_precise_rsqrt(simd_float16 x) { -#if defined __AVX512F__ - simd_float16 r = simd_fast_rsqrt(x); - return r*(1.5 - 0.5*simd_bitselect(x, -INFINITY, r == INFINITY)*r*r); -#else - return simd_make_float16(simd_precise_rsqrt(x.lo), simd_precise_rsqrt(x.hi)); -#endif -} - -static inline SIMD_CFUNC double simd_precise_rsqrt(double x) { - return 1/sqrt(x); -} - -static inline SIMD_CFUNC simd_double2 simd_precise_rsqrt(simd_double2 x) { - return 1/__tg_sqrt(x); -} - -static inline SIMD_CFUNC simd_double3 simd_precise_rsqrt(simd_double3 x) { - return 1/__tg_sqrt(x); -} - -static inline SIMD_CFUNC simd_double4 simd_precise_rsqrt(simd_double4 x) { - return 1/__tg_sqrt(x); -} - -static inline SIMD_CFUNC simd_double8 simd_precise_rsqrt(simd_double8 x) { - return 1/__tg_sqrt(x); -} - -static inline SIMD_CFUNC float simd_fract(float x) { - return fmin(x - floor(x), 0x1.fffffep-1f); -} - -static inline SIMD_CFUNC simd_float2 simd_fract(simd_float2 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffep-1f); -} - -static inline SIMD_CFUNC simd_float3 simd_fract(simd_float3 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffep-1f); -} - -static inline SIMD_CFUNC simd_float4 simd_fract(simd_float4 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffep-1f); -} - -static inline SIMD_CFUNC simd_float8 simd_fract(simd_float8 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffep-1f); -} - -static inline SIMD_CFUNC simd_float16 simd_fract(simd_float16 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffep-1f); -} - -static inline SIMD_CFUNC double simd_fract(double x) { - return fmin(x - floor(x), 0x1.fffffffffffffp-1); -} - -static inline SIMD_CFUNC simd_double2 simd_fract(simd_double2 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffffffffffp-1); -} - -static inline SIMD_CFUNC simd_double3 simd_fract(simd_double3 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffffffffffp-1); -} - -static inline SIMD_CFUNC simd_double4 simd_fract(simd_double4 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffffffffffp-1); -} - -static inline SIMD_CFUNC simd_double8 simd_fract(simd_double8 x) { - return __tg_fmin(x - __tg_floor(x), 0x1.fffffffffffffp-1); -} - -static inline SIMD_CFUNC float simd_step(float edge, float x) { - return !(x < edge); -} - -static inline SIMD_CFUNC simd_float2 simd_step(simd_float2 edge, simd_float2 x) { - return simd_bitselect((simd_float2)1, 0, x < edge); -} - -static inline SIMD_CFUNC simd_float3 simd_step(simd_float3 edge, simd_float3 x) { - return simd_bitselect((simd_float3)1, 0, x < edge); -} - -static inline SIMD_CFUNC simd_float4 simd_step(simd_float4 edge, simd_float4 x) { - return simd_bitselect((simd_float4)1, 0, x < edge); -} - -static inline SIMD_CFUNC simd_float8 simd_step(simd_float8 edge, simd_float8 x) { - return simd_bitselect((simd_float8)1, 0, x < edge); -} - -static inline SIMD_CFUNC simd_float16 simd_step(simd_float16 edge, simd_float16 x) { - return simd_bitselect((simd_float16)1, 0, x < edge); -} - -static inline SIMD_CFUNC double simd_step(double edge, double x) { - return !(x < edge); -} - -static inline SIMD_CFUNC simd_double2 simd_step(simd_double2 edge, simd_double2 x) { - return simd_bitselect((simd_double2)1, 0, x < edge); -} - -static inline SIMD_CFUNC simd_double3 simd_step(simd_double3 edge, simd_double3 x) { - return simd_bitselect((simd_double3)1, 0, x < edge); -} - -static inline SIMD_CFUNC simd_double4 simd_step(simd_double4 edge, simd_double4 x) { - return simd_bitselect((simd_double4)1, 0, x < edge); -} - -static inline SIMD_CFUNC simd_double8 simd_step(simd_double8 edge, simd_double8 x) { - return simd_bitselect((simd_double8)1, 0, x < edge); -} - -static inline SIMD_CFUNC float simd_smoothstep(float edge0, float edge1, float x) { - float t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_float2 simd_smoothstep(simd_float2 edge0, simd_float2 edge1, simd_float2 x) { - simd_float2 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_float3 simd_smoothstep(simd_float3 edge0, simd_float3 edge1, simd_float3 x) { - simd_float3 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_float4 simd_smoothstep(simd_float4 edge0, simd_float4 edge1, simd_float4 x) { - simd_float4 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_float8 simd_smoothstep(simd_float8 edge0, simd_float8 edge1, simd_float8 x) { - simd_float8 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_float16 simd_smoothstep(simd_float16 edge0, simd_float16 edge1, simd_float16 x) { - simd_float16 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC double simd_smoothstep(double edge0, double edge1, double x) { - double t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_double2 simd_smoothstep(simd_double2 edge0, simd_double2 edge1, simd_double2 x) { - simd_double2 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_double3 simd_smoothstep(simd_double3 edge0, simd_double3 edge1, simd_double3 x) { - simd_double3 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_double4 simd_smoothstep(simd_double4 edge0, simd_double4 edge1, simd_double4 x) { - simd_double4 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC simd_double8 simd_smoothstep(simd_double8 edge0, simd_double8 edge1, simd_double8 x) { - simd_double8 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); - return t*t*(3 - 2*t); -} - -static inline SIMD_CFUNC char simd_reduce_add(simd_char2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC char simd_reduce_add(simd_char3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC char simd_reduce_add(simd_char4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC char simd_reduce_add(simd_char8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC char simd_reduce_add(simd_char16 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC char simd_reduce_add(simd_char32 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC char simd_reduce_add(simd_char64 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar16 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar32 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_add(simd_uchar64 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC short simd_reduce_add(simd_short2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC short simd_reduce_add(simd_short3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC short simd_reduce_add(simd_short4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC short simd_reduce_add(simd_short8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC short simd_reduce_add(simd_short16 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC short simd_reduce_add(simd_short32 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort16 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort32 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC int simd_reduce_add(simd_int2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC int simd_reduce_add(simd_int3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC int simd_reduce_add(simd_int4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC int simd_reduce_add(simd_int8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC int simd_reduce_add(simd_int16 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_add(simd_uint16 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC float simd_reduce_add(simd_float2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC float simd_reduce_add(simd_float3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC float simd_reduce_add(simd_float4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC float simd_reduce_add(simd_float8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC float simd_reduce_add(simd_float16 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_add(simd_long8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_add(simd_ulong8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC double simd_reduce_add(simd_double2 x) { - return x.x + x.y; -} - -static inline SIMD_CFUNC double simd_reduce_add(simd_double3 x) { - return x.x + x.y + x.z; -} - -static inline SIMD_CFUNC double simd_reduce_add(simd_double4 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC double simd_reduce_add(simd_double8 x) { - return simd_reduce_add(x.lo + x.hi); -} - -static inline SIMD_CFUNC char simd_reduce_min(simd_char2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC char simd_reduce_min(simd_char3 x) { - char t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC char simd_reduce_min(simd_char4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_min(simd_char8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_min(simd_char16 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_min(simd_char32 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_min(simd_char64 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar3 x) { - unsigned char t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar16 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar32 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar64 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_min(simd_short2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC short simd_reduce_min(simd_short3 x) { - short t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC short simd_reduce_min(simd_short4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_min(simd_short8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_min(simd_short16 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_min(simd_short32 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort3 x) { - unsigned short t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort16 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort32 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC int simd_reduce_min(simd_int2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC int simd_reduce_min(simd_int3 x) { - int t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC int simd_reduce_min(simd_int4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC int simd_reduce_min(simd_int8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC int simd_reduce_min(simd_int16 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint3 x) { - unsigned int t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint16 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC float simd_reduce_min(simd_float2 x) { - return fmin(x.x, x.y); -} - -static inline SIMD_CFUNC float simd_reduce_min(simd_float3 x) { - return fmin(fmin(x.x, x.z), x.y); -} - -static inline SIMD_CFUNC float simd_reduce_min(simd_float4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC float simd_reduce_min(simd_float8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC float simd_reduce_min(simd_float16 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long3 x) { - simd_long1 t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_min(simd_long8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong2 x) { - return x.y < x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong3 x) { - simd_ulong1 t = x.z < x.x ? x.z : x.x; - return x.y < t ? x.y : t; -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_min(simd_ulong8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC double simd_reduce_min(simd_double2 x) { - return fmin(x.x, x.y); -} - -static inline SIMD_CFUNC double simd_reduce_min(simd_double3 x) { - return fmin(fmin(x.x, x.z), x.y); -} - -static inline SIMD_CFUNC double simd_reduce_min(simd_double4 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC double simd_reduce_min(simd_double8 x) { - return simd_reduce_min(simd_min(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_max(simd_char2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC char simd_reduce_max(simd_char3 x) { - char t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC char simd_reduce_max(simd_char4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_max(simd_char8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_max(simd_char16 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_max(simd_char32 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC char simd_reduce_max(simd_char64 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar3 x) { - unsigned char t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar16 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar32 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar64 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_max(simd_short2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC short simd_reduce_max(simd_short3 x) { - short t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC short simd_reduce_max(simd_short4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_max(simd_short8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_max(simd_short16 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC short simd_reduce_max(simd_short32 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort3 x) { - unsigned short t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort16 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort32 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC int simd_reduce_max(simd_int2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC int simd_reduce_max(simd_int3 x) { - int t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC int simd_reduce_max(simd_int4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC int simd_reduce_max(simd_int8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC int simd_reduce_max(simd_int16 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint3 x) { - unsigned int t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint16 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC float simd_reduce_max(simd_float2 x) { - return fmax(x.x, x.y); -} - -static inline SIMD_CFUNC float simd_reduce_max(simd_float3 x) { - return fmax(fmax(x.x, x.z), x.y); -} - -static inline SIMD_CFUNC float simd_reduce_max(simd_float4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC float simd_reduce_max(simd_float8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC float simd_reduce_max(simd_float16 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long3 x) { - simd_long1 t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_long1 simd_reduce_max(simd_long8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong2 x) { - return x.y > x.x ? x.y : x.x; -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong3 x) { - simd_ulong1 t = x.z > x.x ? x.z : x.x; - return x.y > t ? x.y : t; -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC simd_ulong1 simd_reduce_max(simd_ulong8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC double simd_reduce_max(simd_double2 x) { - return fmax(x.x, x.y); -} - -static inline SIMD_CFUNC double simd_reduce_max(simd_double3 x) { - return fmax(fmax(x.x, x.z), x.y); -} - -static inline SIMD_CFUNC double simd_reduce_max(simd_double4 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -static inline SIMD_CFUNC double simd_reduce_max(simd_double8 x) { - return simd_reduce_max(simd_max(x.lo, x.hi)); -} - -#ifdef __cplusplus -} -#endif -#endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */ -#endif /* SIMD_COMMON_HEADER */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/conversion.h b/lib/libc/include/x86_64-macos.10-none/simd/conversion.h deleted file mode 100644 index cc6c533e8f..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/conversion.h +++ /dev/null @@ -1,1876 +0,0 @@ -/* Copyright (c) 2014-2017 Apple, Inc. All rights reserved. - * - * The interfaces declared in this header provide conversions between vector - * types. The following functions are available: - * - * simd_char(x) simd_uchar(x) - * simd_short(x) simd_ushort(x) - * simd_int(x) simd_uint(x) - * simd_long(x) simd_ulong(x) - * simd_float(x) - * simd_double(x) - * - * Each of these functions converts x to a vector whose elements have the - * type named by the function, with the same number of elements as x. Unlike - * a vector cast, these functions convert the elements to the new element - * type. These conversions behave exactly as C scalar conversions, except - * that conversions from integer vector types to signed integer vector types - * are guaranteed to wrap modulo 2^N (where N is the number of bits in an - * element of the result type). - * - * For integer vector types, saturating conversions are also available: - * - * simd_char_sat(x) simd_uchar_sat(x) - * simd_short_sat(x) simd_ushort_sat(x) - * simd_int_sat(x) simd_uint_sat(x) - * simd_long_sat(x) simd_ulong_sat(x) - * - * These conversions clamp x to the representable range of the result type - * before converting. - * - * Unlike most vector operations in , there are no abbreviated C++ - * names for these functions in the simd:: namespace. - */ - -#ifndef __SIMD_CONVERSION_HEADER__ -#define __SIMD_CONVERSION_HEADER__ - -#include -#if SIMD_COMPILER_HAS_REQUIRED_FEATURES -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -static simd_char2 SIMD_CFUNC simd_char(simd_char2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_char3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_char4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_char8 __x); -static simd_char16 SIMD_CFUNC simd_char(simd_char16 __x); -static simd_char32 SIMD_CFUNC simd_char(simd_char32 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_uchar2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_uchar3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_uchar4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_uchar8 __x); -static simd_char16 SIMD_CFUNC simd_char(simd_uchar16 __x); -static simd_char32 SIMD_CFUNC simd_char(simd_uchar32 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_short2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_short3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_short4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_short8 __x); -static simd_char16 SIMD_CFUNC simd_char(simd_short16 __x); -static simd_char32 SIMD_CFUNC simd_char(simd_short32 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_ushort2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_ushort3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_ushort4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_ushort8 __x); -static simd_char16 SIMD_CFUNC simd_char(simd_ushort16 __x); -static simd_char32 SIMD_CFUNC simd_char(simd_ushort32 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_int2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_int3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_int4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_int8 __x); -static simd_char16 SIMD_CFUNC simd_char(simd_int16 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_uint2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_uint3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_uint4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_uint8 __x); -static simd_char16 SIMD_CFUNC simd_char(simd_uint16 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_float2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_float3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_float4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_float8 __x); -static simd_char16 SIMD_CFUNC simd_char(simd_float16 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_long2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_long3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_long4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_long8 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_ulong2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_ulong3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_ulong4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_ulong8 __x); -static simd_char2 SIMD_CFUNC simd_char(simd_double2 __x); -static simd_char3 SIMD_CFUNC simd_char(simd_double3 __x); -static simd_char4 SIMD_CFUNC simd_char(simd_double4 __x); -static simd_char8 SIMD_CFUNC simd_char(simd_double8 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_char2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_char3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_char4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_char8 __x); -static simd_char16 SIMD_CFUNC simd_char_sat(simd_char16 __x); -static simd_char32 SIMD_CFUNC simd_char_sat(simd_char32 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_short2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_short3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_short4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_short8 __x); -static simd_char16 SIMD_CFUNC simd_char_sat(simd_short16 __x); -static simd_char32 SIMD_CFUNC simd_char_sat(simd_short32 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_int2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_int3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_int4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_int8 __x); -static simd_char16 SIMD_CFUNC simd_char_sat(simd_int16 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_float2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_float3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_float4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_float8 __x); -static simd_char16 SIMD_CFUNC simd_char_sat(simd_float16 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_long2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_long3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_long4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_long8 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_double2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_double3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_double4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_double8 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_uchar2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_uchar3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_uchar4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_uchar8 __x); -static simd_char16 SIMD_CFUNC simd_char_sat(simd_uchar16 __x); -static simd_char32 SIMD_CFUNC simd_char_sat(simd_uchar32 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_ushort2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_ushort3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_ushort4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_ushort8 __x); -static simd_char16 SIMD_CFUNC simd_char_sat(simd_ushort16 __x); -static simd_char32 SIMD_CFUNC simd_char_sat(simd_ushort32 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_uint2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_uint3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_uint4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_uint8 __x); -static simd_char16 SIMD_CFUNC simd_char_sat(simd_uint16 __x); -static simd_char2 SIMD_CFUNC simd_char_sat(simd_ulong2 __x); -static simd_char3 SIMD_CFUNC simd_char_sat(simd_ulong3 __x); -static simd_char4 SIMD_CFUNC simd_char_sat(simd_ulong4 __x); -static simd_char8 SIMD_CFUNC simd_char_sat(simd_ulong8 __x); -#define vector_char simd_char -#define vector_char_sat simd_char_sat - -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_char2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_char3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_char4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_char8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_char16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_char32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_uchar2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_uchar3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_uchar4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_uchar8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_uchar16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_uchar32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_short2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_short3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_short4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_short8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_short16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_short32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_ushort2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_ushort3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_ushort4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_ushort8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_ushort16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_ushort32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_int2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_int3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_int4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_int8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_int16 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_uint2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_uint3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_uint4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_uint8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_uint16 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_float2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_float3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_float4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_float8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_float16 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_long2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_long3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_long4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_long8 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_ulong2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_ulong3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_ulong4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_ulong8 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_double2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_double3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_double4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_double8 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_char2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_char3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_char4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_char8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_char16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_char32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_short2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_short3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_short4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_short8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_short16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_short32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_int2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_int3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_int4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_int8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_int16 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_float2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_float3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_float4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_float8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_float16 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_long2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_long3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_long4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_long8 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_double2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_double3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_double4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_double8 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_uchar2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_uchar3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_uchar4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_uchar8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_uchar16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_uchar32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_ushort2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_ushort3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_ushort4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_ushort8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_ushort16 __x); -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_ushort32 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_uint2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_uint3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_uint4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_uint8 __x); -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_uint16 __x); -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_ulong2 __x); -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_ulong3 __x); -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_ulong4 __x); -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_ulong8 __x); -#define vector_uchar simd_uchar -#define vector_uchar_sat simd_uchar_sat - -static simd_short2 SIMD_CFUNC simd_short(simd_char2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_char3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_char4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_char8 __x); -static simd_short16 SIMD_CFUNC simd_short(simd_char16 __x); -static simd_short32 SIMD_CFUNC simd_short(simd_char32 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_uchar2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_uchar3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_uchar4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_uchar8 __x); -static simd_short16 SIMD_CFUNC simd_short(simd_uchar16 __x); -static simd_short32 SIMD_CFUNC simd_short(simd_uchar32 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_short2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_short3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_short4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_short8 __x); -static simd_short16 SIMD_CFUNC simd_short(simd_short16 __x); -static simd_short32 SIMD_CFUNC simd_short(simd_short32 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_ushort2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_ushort3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_ushort4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_ushort8 __x); -static simd_short16 SIMD_CFUNC simd_short(simd_ushort16 __x); -static simd_short32 SIMD_CFUNC simd_short(simd_ushort32 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_int2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_int3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_int4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_int8 __x); -static simd_short16 SIMD_CFUNC simd_short(simd_int16 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_uint2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_uint3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_uint4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_uint8 __x); -static simd_short16 SIMD_CFUNC simd_short(simd_uint16 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_float2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_float3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_float4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_float8 __x); -static simd_short16 SIMD_CFUNC simd_short(simd_float16 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_long2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_long3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_long4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_long8 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_ulong2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_ulong3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_ulong4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_ulong8 __x); -static simd_short2 SIMD_CFUNC simd_short(simd_double2 __x); -static simd_short3 SIMD_CFUNC simd_short(simd_double3 __x); -static simd_short4 SIMD_CFUNC simd_short(simd_double4 __x); -static simd_short8 SIMD_CFUNC simd_short(simd_double8 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_char2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_char3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_char4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_char8 __x); -static simd_short16 SIMD_CFUNC simd_short_sat(simd_char16 __x); -static simd_short32 SIMD_CFUNC simd_short_sat(simd_char32 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_short2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_short3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_short4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_short8 __x); -static simd_short16 SIMD_CFUNC simd_short_sat(simd_short16 __x); -static simd_short32 SIMD_CFUNC simd_short_sat(simd_short32 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_int2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_int3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_int4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_int8 __x); -static simd_short16 SIMD_CFUNC simd_short_sat(simd_int16 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_float2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_float3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_float4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_float8 __x); -static simd_short16 SIMD_CFUNC simd_short_sat(simd_float16 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_long2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_long3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_long4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_long8 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_double2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_double3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_double4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_double8 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_uchar2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_uchar3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_uchar4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_uchar8 __x); -static simd_short16 SIMD_CFUNC simd_short_sat(simd_uchar16 __x); -static simd_short32 SIMD_CFUNC simd_short_sat(simd_uchar32 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_ushort2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_ushort3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_ushort4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_ushort8 __x); -static simd_short16 SIMD_CFUNC simd_short_sat(simd_ushort16 __x); -static simd_short32 SIMD_CFUNC simd_short_sat(simd_ushort32 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_uint2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_uint3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_uint4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_uint8 __x); -static simd_short16 SIMD_CFUNC simd_short_sat(simd_uint16 __x); -static simd_short2 SIMD_CFUNC simd_short_sat(simd_ulong2 __x); -static simd_short3 SIMD_CFUNC simd_short_sat(simd_ulong3 __x); -static simd_short4 SIMD_CFUNC simd_short_sat(simd_ulong4 __x); -static simd_short8 SIMD_CFUNC simd_short_sat(simd_ulong8 __x); -#define vector_short simd_short -#define vector_short_sat simd_short_sat - -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_char2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_char3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_char4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_char8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_char16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_char32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_uchar2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_uchar3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_uchar4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_uchar8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_uchar16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_uchar32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_short2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_short3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_short4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_short8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_short16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_short32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_ushort2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_ushort3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_ushort4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_ushort8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_ushort16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_ushort32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_int2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_int3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_int4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_int8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_int16 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_uint2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_uint3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_uint4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_uint8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_uint16 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_float2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_float3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_float4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_float8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_float16 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_long2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_long3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_long4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_long8 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_ulong2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_ulong3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_ulong4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_ulong8 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_double2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_double3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_double4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_double8 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_char2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_char3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_char4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_char8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_char16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_char32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_short2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_short3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_short4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_short8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_short16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_short32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_int2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_int3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_int4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_int8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_int16 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_float2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_float3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_float4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_float8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_float16 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_long2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_long3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_long4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_long8 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_double2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_double3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_double4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_double8 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_uchar2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_uchar3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_uchar4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_uchar8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_uchar16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_uchar32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_ushort2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_ushort3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_ushort4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_ushort8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_ushort16 __x); -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_ushort32 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_uint2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_uint3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_uint4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_uint8 __x); -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_uint16 __x); -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_ulong2 __x); -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_ulong3 __x); -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_ulong4 __x); -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_ulong8 __x); -#define vector_ushort simd_ushort -#define vector_ushort_sat simd_ushort_sat - -static simd_int2 SIMD_CFUNC simd_int(simd_char2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_char3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_char4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_char8 __x); -static simd_int16 SIMD_CFUNC simd_int(simd_char16 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_uchar2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_uchar3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_uchar4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_uchar8 __x); -static simd_int16 SIMD_CFUNC simd_int(simd_uchar16 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_short2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_short3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_short4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_short8 __x); -static simd_int16 SIMD_CFUNC simd_int(simd_short16 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_ushort2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_ushort3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_ushort4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_ushort8 __x); -static simd_int16 SIMD_CFUNC simd_int(simd_ushort16 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_int2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_int3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_int4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_int8 __x); -static simd_int16 SIMD_CFUNC simd_int(simd_int16 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_uint2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_uint3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_uint4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_uint8 __x); -static simd_int16 SIMD_CFUNC simd_int(simd_uint16 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_float2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_float3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_float4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_float8 __x); -static simd_int16 SIMD_CFUNC simd_int(simd_float16 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_long2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_long3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_long4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_long8 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_ulong2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_ulong3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_ulong4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_ulong8 __x); -static simd_int2 SIMD_CFUNC simd_int(simd_double2 __x); -static simd_int3 SIMD_CFUNC simd_int(simd_double3 __x); -static simd_int4 SIMD_CFUNC simd_int(simd_double4 __x); -static simd_int8 SIMD_CFUNC simd_int(simd_double8 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_char2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_char3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_char4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_char8 __x); -static simd_int16 SIMD_CFUNC simd_int_sat(simd_char16 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_short2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_short3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_short4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_short8 __x); -static simd_int16 SIMD_CFUNC simd_int_sat(simd_short16 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_int2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_int3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_int4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_int8 __x); -static simd_int16 SIMD_CFUNC simd_int_sat(simd_int16 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_float2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_float3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_float4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_float8 __x); -static simd_int16 SIMD_CFUNC simd_int_sat(simd_float16 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_long2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_long3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_long4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_long8 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_double2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_double3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_double4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_double8 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_uchar2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_uchar3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_uchar4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_uchar8 __x); -static simd_int16 SIMD_CFUNC simd_int_sat(simd_uchar16 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_ushort2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_ushort3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_ushort4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_ushort8 __x); -static simd_int16 SIMD_CFUNC simd_int_sat(simd_ushort16 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_uint2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_uint3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_uint4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_uint8 __x); -static simd_int16 SIMD_CFUNC simd_int_sat(simd_uint16 __x); -static simd_int2 SIMD_CFUNC simd_int_sat(simd_ulong2 __x); -static simd_int3 SIMD_CFUNC simd_int_sat(simd_ulong3 __x); -static simd_int4 SIMD_CFUNC simd_int_sat(simd_ulong4 __x); -static simd_int8 SIMD_CFUNC simd_int_sat(simd_ulong8 __x); -#define vector_int simd_int -#define vector_int_sat simd_int_sat - -static simd_uint2 SIMD_CFUNC simd_uint(simd_char2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_char3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_char4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_char8 __x); -static simd_uint16 SIMD_CFUNC simd_uint(simd_char16 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_uchar2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_uchar3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_uchar4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_uchar8 __x); -static simd_uint16 SIMD_CFUNC simd_uint(simd_uchar16 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_short2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_short3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_short4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_short8 __x); -static simd_uint16 SIMD_CFUNC simd_uint(simd_short16 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_ushort2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_ushort3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_ushort4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_ushort8 __x); -static simd_uint16 SIMD_CFUNC simd_uint(simd_ushort16 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_int2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_int3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_int4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_int8 __x); -static simd_uint16 SIMD_CFUNC simd_uint(simd_int16 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_uint2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_uint3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_uint4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_uint8 __x); -static simd_uint16 SIMD_CFUNC simd_uint(simd_uint16 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_float2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_float3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_float4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_float8 __x); -static simd_uint16 SIMD_CFUNC simd_uint(simd_float16 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_long2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_long3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_long4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_long8 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_ulong2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_ulong3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_ulong4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_ulong8 __x); -static simd_uint2 SIMD_CFUNC simd_uint(simd_double2 __x); -static simd_uint3 SIMD_CFUNC simd_uint(simd_double3 __x); -static simd_uint4 SIMD_CFUNC simd_uint(simd_double4 __x); -static simd_uint8 SIMD_CFUNC simd_uint(simd_double8 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_char2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_char3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_char4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_char8 __x); -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_char16 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_short2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_short3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_short4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_short8 __x); -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_short16 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_int2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_int3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_int4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_int8 __x); -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_int16 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_float2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_float3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_float4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_float8 __x); -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_float16 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_long2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_long3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_long4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_long8 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_double2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_double3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_double4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_double8 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_uchar2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_uchar3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_uchar4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_uchar8 __x); -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_uchar16 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_ushort2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_ushort3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_ushort4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_ushort8 __x); -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_ushort16 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_uint2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_uint3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_uint4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_uint8 __x); -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_uint16 __x); -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_ulong2 __x); -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_ulong3 __x); -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_ulong4 __x); -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_ulong8 __x); -#define vector_uint simd_uint -#define vector_uint_sat simd_uint_sat - -static simd_float2 SIMD_CFUNC simd_float(simd_char2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_char3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_char4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_char8 __x); -static simd_float16 SIMD_CFUNC simd_float(simd_char16 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_uchar2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_uchar3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_uchar4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_uchar8 __x); -static simd_float16 SIMD_CFUNC simd_float(simd_uchar16 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_short2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_short3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_short4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_short8 __x); -static simd_float16 SIMD_CFUNC simd_float(simd_short16 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_ushort2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_ushort3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_ushort4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_ushort8 __x); -static simd_float16 SIMD_CFUNC simd_float(simd_ushort16 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_int2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_int3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_int4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_int8 __x); -static simd_float16 SIMD_CFUNC simd_float(simd_int16 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_uint2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_uint3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_uint4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_uint8 __x); -static simd_float16 SIMD_CFUNC simd_float(simd_uint16 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_float2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_float3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_float4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_float8 __x); -static simd_float16 SIMD_CFUNC simd_float(simd_float16 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_long2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_long3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_long4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_long8 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_ulong2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_ulong3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_ulong4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_ulong8 __x); -static simd_float2 SIMD_CFUNC simd_float(simd_double2 __x); -static simd_float3 SIMD_CFUNC simd_float(simd_double3 __x); -static simd_float4 SIMD_CFUNC simd_float(simd_double4 __x); -static simd_float8 SIMD_CFUNC simd_float(simd_double8 __x); -#define vector_float simd_float - -static simd_long2 SIMD_CFUNC simd_long(simd_char2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_char3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_char4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_char8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_uchar2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_uchar3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_uchar4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_uchar8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_short2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_short3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_short4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_short8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_ushort2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_ushort3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_ushort4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_ushort8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_int2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_int3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_int4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_int8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_uint2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_uint3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_uint4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_uint8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_float2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_float3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_float4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_float8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_long2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_long3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_long4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_long8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_ulong2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_ulong3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_ulong4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_ulong8 __x); -static simd_long2 SIMD_CFUNC simd_long(simd_double2 __x); -static simd_long3 SIMD_CFUNC simd_long(simd_double3 __x); -static simd_long4 SIMD_CFUNC simd_long(simd_double4 __x); -static simd_long8 SIMD_CFUNC simd_long(simd_double8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_char2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_char3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_char4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_char8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_short2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_short3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_short4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_short8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_int2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_int3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_int4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_int8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_float2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_float3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_float4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_float8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_long2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_long3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_long4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_long8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_double2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_double3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_double4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_double8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_uchar2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_uchar3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_uchar4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_uchar8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_ushort2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_ushort3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_ushort4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_ushort8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_uint2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_uint3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_uint4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_uint8 __x); -static simd_long2 SIMD_CFUNC simd_long_sat(simd_ulong2 __x); -static simd_long3 SIMD_CFUNC simd_long_sat(simd_ulong3 __x); -static simd_long4 SIMD_CFUNC simd_long_sat(simd_ulong4 __x); -static simd_long8 SIMD_CFUNC simd_long_sat(simd_ulong8 __x); -#define vector_long simd_long -#define vector_long_sat simd_long_sat - -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_char2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_char3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_char4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_char8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_uchar2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_uchar3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_uchar4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_uchar8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_short2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_short3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_short4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_short8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_ushort2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_ushort3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_ushort4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_ushort8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_int2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_int3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_int4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_int8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_uint2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_uint3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_uint4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_uint8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_float2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_float3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_float4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_float8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_long2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_long3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_long4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_long8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_ulong2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_ulong3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_ulong4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_ulong8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_double2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_double3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_double4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_double8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_char2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_char3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_char4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_char8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_short2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_short3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_short4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_short8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_int2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_int3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_int4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_int8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_float2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_float3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_float4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_float8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_long2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_long3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_long4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_long8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_double2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_double3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_double4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_double8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_uchar2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_uchar3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_uchar4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_uchar8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_ushort2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_ushort3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_ushort4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_ushort8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_uint2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_uint3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_uint4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_uint8 __x); -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_ulong2 __x); -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_ulong3 __x); -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_ulong4 __x); -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_ulong8 __x); -#define vector_ulong simd_ulong -#define vector_ulong_sat simd_ulong_sat - -static simd_double2 SIMD_CFUNC simd_double(simd_char2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_char3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_char4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_char8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_uchar2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_uchar3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_uchar4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_uchar8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_short2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_short3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_short4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_short8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_ushort2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_ushort3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_ushort4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_ushort8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_int2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_int3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_int4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_int8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_uint2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_uint3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_uint4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_uint8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_float2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_float3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_float4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_float8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_long2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_long3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_long4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_long8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_ulong2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_ulong3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_ulong4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_ulong8 __x); -static simd_double2 SIMD_CFUNC simd_double(simd_double2 __x); -static simd_double3 SIMD_CFUNC simd_double(simd_double3 __x); -static simd_double4 SIMD_CFUNC simd_double(simd_double4 __x); -static simd_double8 SIMD_CFUNC simd_double(simd_double8 __x); -#define vector_double simd_double - -static simd_char2 SIMD_CFUNC vector2(char __x, char __y) { return ( simd_char2){__x, __y}; } -static simd_uchar2 SIMD_CFUNC vector2(unsigned char __x, unsigned char __y) { return ( simd_uchar2){__x, __y}; } -static simd_short2 SIMD_CFUNC vector2(short __x, short __y) { return ( simd_short2){__x, __y}; } -static simd_ushort2 SIMD_CFUNC vector2(unsigned short __x, unsigned short __y) { return (simd_ushort2){__x, __y}; } -static simd_int2 SIMD_CFUNC vector2(int __x, int __y) { return ( simd_int2){__x, __y}; } -static simd_uint2 SIMD_CFUNC vector2(unsigned int __x, unsigned int __y) { return ( simd_uint2){__x, __y}; } -static simd_float2 SIMD_CFUNC vector2(float __x, float __y) { return ( simd_float2){__x, __y}; } -static simd_long2 SIMD_CFUNC vector2(simd_long1 __x, simd_long1 __y) { return ( simd_long2){__x, __y}; } -static simd_ulong2 SIMD_CFUNC vector2(simd_ulong1 __x, simd_ulong1 __y) { return ( simd_ulong2){__x, __y}; } -static simd_double2 SIMD_CFUNC vector2(double __x, double __y) { return (simd_double2){__x, __y}; } - -static simd_char3 SIMD_CFUNC vector3(char __x, char __y, char __z) { return ( simd_char3){__x, __y, __z}; } -static simd_uchar3 SIMD_CFUNC vector3(unsigned char __x, unsigned char __y, unsigned char __z) { return ( simd_uchar3){__x, __y, __z}; } -static simd_short3 SIMD_CFUNC vector3(short __x, short __y, short __z) { return ( simd_short3){__x, __y, __z}; } -static simd_ushort3 SIMD_CFUNC vector3(unsigned short __x, unsigned short __y, unsigned short __z) { return (simd_ushort3){__x, __y, __z}; } -static simd_int3 SIMD_CFUNC vector3(int __x, int __y, int __z) { return ( simd_int3){__x, __y, __z}; } -static simd_uint3 SIMD_CFUNC vector3(unsigned int __x, unsigned int __y, unsigned int __z) { return ( simd_uint3){__x, __y, __z}; } -static simd_float3 SIMD_CFUNC vector3(float __x, float __y, float __z) { return ( simd_float3){__x, __y, __z}; } -static simd_long3 SIMD_CFUNC vector3(simd_long1 __x, simd_long1 __y, simd_long1 __z) { return ( simd_long3){__x, __y, __z}; } -static simd_ulong3 SIMD_CFUNC vector3(simd_ulong1 __x, simd_ulong1 __y, simd_ulong1 __z) { return ( simd_ulong3){__x, __y, __z}; } -static simd_double3 SIMD_CFUNC vector3(double __x, double __y, double __z) { return (simd_double3){__x, __y, __z}; } - -static simd_char3 SIMD_CFUNC vector3(simd_char2 __xy, char __z) { simd_char3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_uchar3 SIMD_CFUNC vector3(simd_uchar2 __xy, unsigned char __z) { simd_uchar3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_short3 SIMD_CFUNC vector3(simd_short2 __xy, short __z) { simd_short3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_ushort3 SIMD_CFUNC vector3(simd_ushort2 __xy, unsigned short __z) { simd_ushort3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_int3 SIMD_CFUNC vector3(simd_int2 __xy, int __z) { simd_int3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_uint3 SIMD_CFUNC vector3(simd_uint2 __xy, unsigned int __z) { simd_uint3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_float3 SIMD_CFUNC vector3(simd_float2 __xy, float __z) { simd_float3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_long3 SIMD_CFUNC vector3(simd_long2 __xy, simd_long1 __z) { simd_long3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_ulong3 SIMD_CFUNC vector3(simd_ulong2 __xy, simd_ulong1 __z) { simd_ulong3 __r; __r.xy = __xy; __r.z = __z; return __r; } -static simd_double3 SIMD_CFUNC vector3(simd_double2 __xy, double __z) { simd_double3 __r; __r.xy = __xy; __r.z = __z; return __r; } - -static simd_char4 SIMD_CFUNC vector4(char __x, char __y, char __z, char __w) { return ( simd_char4){__x, __y, __z, __w}; } -static simd_uchar4 SIMD_CFUNC vector4(unsigned char __x, unsigned char __y, unsigned char __z, unsigned char __w) { return ( simd_uchar4){__x, __y, __z, __w}; } -static simd_short4 SIMD_CFUNC vector4(short __x, short __y, short __z, short __w) { return ( simd_short4){__x, __y, __z, __w}; } -static simd_ushort4 SIMD_CFUNC vector4(unsigned short __x, unsigned short __y, unsigned short __z, unsigned short __w) { return (simd_ushort4){__x, __y, __z, __w}; } -static simd_int4 SIMD_CFUNC vector4(int __x, int __y, int __z, int __w) { return ( simd_int4){__x, __y, __z, __w}; } -static simd_uint4 SIMD_CFUNC vector4(unsigned int __x, unsigned int __y, unsigned int __z, unsigned int __w) { return ( simd_uint4){__x, __y, __z, __w}; } -static simd_float4 SIMD_CFUNC vector4(float __x, float __y, float __z, float __w) { return ( simd_float4){__x, __y, __z, __w}; } -static simd_long4 SIMD_CFUNC vector4(simd_long1 __x, simd_long1 __y, simd_long1 __z, simd_long1 __w) { return ( simd_long4){__x, __y, __z, __w}; } -static simd_ulong4 SIMD_CFUNC vector4(simd_ulong1 __x, simd_ulong1 __y, simd_ulong1 __z, simd_ulong1 __w) { return ( simd_ulong4){__x, __y, __z, __w}; } -static simd_double4 SIMD_CFUNC vector4(double __x, double __y, double __z, double __w) { return (simd_double4){__x, __y, __z, __w}; } - -static simd_char4 SIMD_CFUNC vector4(simd_char2 __xy, simd_char2 __zw) { simd_char4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_uchar4 SIMD_CFUNC vector4(simd_uchar2 __xy, simd_uchar2 __zw) { simd_uchar4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_short4 SIMD_CFUNC vector4(simd_short2 __xy, simd_short2 __zw) { simd_short4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_ushort4 SIMD_CFUNC vector4(simd_ushort2 __xy, simd_ushort2 __zw) { simd_ushort4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_int4 SIMD_CFUNC vector4(simd_int2 __xy, simd_int2 __zw) { simd_int4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_uint4 SIMD_CFUNC vector4(simd_uint2 __xy, simd_uint2 __zw) { simd_uint4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_float4 SIMD_CFUNC vector4(simd_float2 __xy, simd_float2 __zw) { simd_float4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_long4 SIMD_CFUNC vector4(simd_long2 __xy, simd_long2 __zw) { simd_long4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_ulong4 SIMD_CFUNC vector4(simd_ulong2 __xy, simd_ulong2 __zw) { simd_ulong4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } -static simd_double4 SIMD_CFUNC vector4(simd_double2 __xy, simd_double2 __zw) { simd_double4 __r; __r.xy = __xy; __r.zw = __zw; return __r; } - -static simd_char4 SIMD_CFUNC vector4(simd_char3 __xyz, char __w) { simd_char4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_uchar4 SIMD_CFUNC vector4(simd_uchar3 __xyz, unsigned char __w) { simd_uchar4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_short4 SIMD_CFUNC vector4(simd_short3 __xyz, short __w) { simd_short4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_ushort4 SIMD_CFUNC vector4(simd_ushort3 __xyz, unsigned short __w) { simd_ushort4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_int4 SIMD_CFUNC vector4(simd_int3 __xyz, int __w) { simd_int4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_uint4 SIMD_CFUNC vector4(simd_uint3 __xyz, unsigned int __w) { simd_uint4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_float4 SIMD_CFUNC vector4(simd_float3 __xyz, float __w) { simd_float4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_long4 SIMD_CFUNC vector4(simd_long3 __xyz, simd_long1 __w) { simd_long4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_ulong4 SIMD_CFUNC vector4(simd_ulong3 __xyz, simd_ulong1 __w) { simd_ulong4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } -static simd_double4 SIMD_CFUNC vector4(simd_double3 __xyz, double __w) { simd_double4 __r; __r.xyz = __xyz; __r.w = __w; return __r; } - -static simd_char8 SIMD_CFUNC vector8(simd_char4 __lo, simd_char4 __hi) { simd_char8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_uchar8 SIMD_CFUNC vector8(simd_uchar4 __lo, simd_uchar4 __hi) { simd_uchar8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_short8 SIMD_CFUNC vector8(simd_short4 __lo, simd_short4 __hi) { simd_short8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_ushort8 SIMD_CFUNC vector8(simd_ushort4 __lo, simd_ushort4 __hi) { simd_ushort8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_int8 SIMD_CFUNC vector8(simd_int4 __lo, simd_int4 __hi) { simd_int8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_uint8 SIMD_CFUNC vector8(simd_uint4 __lo, simd_uint4 __hi) { simd_uint8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_float8 SIMD_CFUNC vector8(simd_float4 __lo, simd_float4 __hi) { simd_float8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_long8 SIMD_CFUNC vector8(simd_long4 __lo, simd_long4 __hi) { simd_long8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_ulong8 SIMD_CFUNC vector8(simd_ulong4 __lo, simd_ulong4 __hi) { simd_ulong8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_double8 SIMD_CFUNC vector8(simd_double4 __lo, simd_double4 __hi) { simd_double8 __r; __r.lo = __lo; __r.hi = __hi; return __r; } - -static simd_char16 SIMD_CFUNC vector16(simd_char8 __lo, simd_char8 __hi) { simd_char16 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_uchar16 SIMD_CFUNC vector16(simd_uchar8 __lo, simd_uchar8 __hi) { simd_uchar16 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_short16 SIMD_CFUNC vector16(simd_short8 __lo, simd_short8 __hi) { simd_short16 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_ushort16 SIMD_CFUNC vector16(simd_ushort8 __lo, simd_ushort8 __hi) { simd_ushort16 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_int16 SIMD_CFUNC vector16(simd_int8 __lo, simd_int8 __hi) { simd_int16 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_uint16 SIMD_CFUNC vector16(simd_uint8 __lo, simd_uint8 __hi) { simd_uint16 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_float16 SIMD_CFUNC vector16(simd_float8 __lo, simd_float8 __hi) { simd_float16 __r; __r.lo = __lo; __r.hi = __hi; return __r; } - -static simd_char32 SIMD_CFUNC vector32(simd_char16 __lo, simd_char16 __hi) { simd_char32 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_uchar32 SIMD_CFUNC vector32(simd_uchar16 __lo, simd_uchar16 __hi) { simd_uchar32 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_short32 SIMD_CFUNC vector32(simd_short16 __lo, simd_short16 __hi) { simd_short32 __r; __r.lo = __lo; __r.hi = __hi; return __r; } -static simd_ushort32 SIMD_CFUNC vector32(simd_ushort16 __lo, simd_ushort16 __hi) { simd_ushort32 __r; __r.lo = __lo; __r.hi = __hi; return __r; } - -#pragma mark - Implementation - -static simd_char2 SIMD_CFUNC simd_char(simd_char2 __x) { return __x; } -static simd_char3 SIMD_CFUNC simd_char(simd_char3 __x) { return __x; } -static simd_char4 SIMD_CFUNC simd_char(simd_char4 __x) { return __x; } -static simd_char8 SIMD_CFUNC simd_char(simd_char8 __x) { return __x; } -static simd_char16 SIMD_CFUNC simd_char(simd_char16 __x) { return __x; } -static simd_char32 SIMD_CFUNC simd_char(simd_char32 __x) { return __x; } -static simd_char2 SIMD_CFUNC simd_char(simd_uchar2 __x) { return (simd_char2)__x; } -static simd_char3 SIMD_CFUNC simd_char(simd_uchar3 __x) { return (simd_char3)__x; } -static simd_char4 SIMD_CFUNC simd_char(simd_uchar4 __x) { return (simd_char4)__x; } -static simd_char8 SIMD_CFUNC simd_char(simd_uchar8 __x) { return (simd_char8)__x; } -static simd_char16 SIMD_CFUNC simd_char(simd_uchar16 __x) { return (simd_char16)__x; } -static simd_char32 SIMD_CFUNC simd_char(simd_uchar32 __x) { return (simd_char32)__x; } -static simd_char2 SIMD_CFUNC simd_char(simd_short2 __x) { return __builtin_convertvector(__x & 0xff, simd_char2); } -static simd_char3 SIMD_CFUNC simd_char(simd_short3 __x) { return __builtin_convertvector(__x & 0xff, simd_char3); } -static simd_char4 SIMD_CFUNC simd_char(simd_short4 __x) { return __builtin_convertvector(__x & 0xff, simd_char4); } -static simd_char8 SIMD_CFUNC simd_char(simd_short8 __x) { return __builtin_convertvector(__x & 0xff, simd_char8); } -static simd_char16 SIMD_CFUNC simd_char(simd_short16 __x) { return __builtin_convertvector(__x & 0xff, simd_char16); } -static simd_char32 SIMD_CFUNC simd_char(simd_short32 __x) { return __builtin_convertvector(__x & 0xff, simd_char32); } -static simd_char2 SIMD_CFUNC simd_char(simd_ushort2 __x) { return simd_char(simd_short(__x)); } -static simd_char3 SIMD_CFUNC simd_char(simd_ushort3 __x) { return simd_char(simd_short(__x)); } -static simd_char4 SIMD_CFUNC simd_char(simd_ushort4 __x) { return simd_char(simd_short(__x)); } -static simd_char8 SIMD_CFUNC simd_char(simd_ushort8 __x) { return simd_char(simd_short(__x)); } -static simd_char16 SIMD_CFUNC simd_char(simd_ushort16 __x) { return simd_char(simd_short(__x)); } -static simd_char32 SIMD_CFUNC simd_char(simd_ushort32 __x) { return simd_char(simd_short(__x)); } -static simd_char2 SIMD_CFUNC simd_char(simd_int2 __x) { return simd_char(simd_short(__x)); } -static simd_char3 SIMD_CFUNC simd_char(simd_int3 __x) { return simd_char(simd_short(__x)); } -static simd_char4 SIMD_CFUNC simd_char(simd_int4 __x) { return simd_char(simd_short(__x)); } -static simd_char8 SIMD_CFUNC simd_char(simd_int8 __x) { return simd_char(simd_short(__x)); } -static simd_char16 SIMD_CFUNC simd_char(simd_int16 __x) { return simd_char(simd_short(__x)); } -static simd_char2 SIMD_CFUNC simd_char(simd_uint2 __x) { return simd_char(simd_short(__x)); } -static simd_char3 SIMD_CFUNC simd_char(simd_uint3 __x) { return simd_char(simd_short(__x)); } -static simd_char4 SIMD_CFUNC simd_char(simd_uint4 __x) { return simd_char(simd_short(__x)); } -static simd_char8 SIMD_CFUNC simd_char(simd_uint8 __x) { return simd_char(simd_short(__x)); } -static simd_char16 SIMD_CFUNC simd_char(simd_uint16 __x) { return simd_char(simd_short(__x)); } -static simd_char2 SIMD_CFUNC simd_char(simd_float2 __x) { return simd_char(simd_short(__x)); } -static simd_char3 SIMD_CFUNC simd_char(simd_float3 __x) { return simd_char(simd_short(__x)); } -static simd_char4 SIMD_CFUNC simd_char(simd_float4 __x) { return simd_char(simd_short(__x)); } -static simd_char8 SIMD_CFUNC simd_char(simd_float8 __x) { return simd_char(simd_short(__x)); } -static simd_char16 SIMD_CFUNC simd_char(simd_float16 __x) { return simd_char(simd_short(__x)); } -static simd_char2 SIMD_CFUNC simd_char(simd_long2 __x) { return simd_char(simd_short(__x)); } -static simd_char3 SIMD_CFUNC simd_char(simd_long3 __x) { return simd_char(simd_short(__x)); } -static simd_char4 SIMD_CFUNC simd_char(simd_long4 __x) { return simd_char(simd_short(__x)); } -static simd_char8 SIMD_CFUNC simd_char(simd_long8 __x) { return simd_char(simd_short(__x)); } -static simd_char2 SIMD_CFUNC simd_char(simd_ulong2 __x) { return simd_char(simd_short(__x)); } -static simd_char3 SIMD_CFUNC simd_char(simd_ulong3 __x) { return simd_char(simd_short(__x)); } -static simd_char4 SIMD_CFUNC simd_char(simd_ulong4 __x) { return simd_char(simd_short(__x)); } -static simd_char8 SIMD_CFUNC simd_char(simd_ulong8 __x) { return simd_char(simd_short(__x)); } -static simd_char2 SIMD_CFUNC simd_char(simd_double2 __x) { return simd_char(simd_short(__x)); } -static simd_char3 SIMD_CFUNC simd_char(simd_double3 __x) { return simd_char(simd_short(__x)); } -static simd_char4 SIMD_CFUNC simd_char(simd_double4 __x) { return simd_char(simd_short(__x)); } -static simd_char8 SIMD_CFUNC simd_char(simd_double8 __x) { return simd_char(simd_short(__x)); } - -static simd_char2 SIMD_CFUNC simd_char_sat(simd_char2 __x) { return __x; } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_char3 __x) { return __x; } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_char4 __x) { return __x; } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_char8 __x) { return __x; } -static simd_char16 SIMD_CFUNC simd_char_sat(simd_char16 __x) { return __x; } -static simd_char32 SIMD_CFUNC simd_char_sat(simd_char32 __x) { return __x; } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_short2 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_short3 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_short4 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_short8 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char16 SIMD_CFUNC simd_char_sat(simd_short16 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char32 SIMD_CFUNC simd_char_sat(simd_short32 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_int2 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_int3 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_int4 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_int8 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char16 SIMD_CFUNC simd_char_sat(simd_int16 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_float2 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_float3 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_float4 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_float8 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char16 SIMD_CFUNC simd_char_sat(simd_float16 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_long2 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_long3 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_long4 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_long8 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_double2 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_double3 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_double4 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_double8 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_uchar2 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_uchar3 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_uchar4 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_uchar8 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char16 SIMD_CFUNC simd_char_sat(simd_uchar16 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char32 SIMD_CFUNC simd_char_sat(simd_uchar32 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_ushort2 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_ushort3 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_ushort4 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_ushort8 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char16 SIMD_CFUNC simd_char_sat(simd_ushort16 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char32 SIMD_CFUNC simd_char_sat(simd_ushort32 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_uint2 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_uint3 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_uint4 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_uint8 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char16 SIMD_CFUNC simd_char_sat(simd_uint16 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char2 SIMD_CFUNC simd_char_sat(simd_ulong2 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char3 SIMD_CFUNC simd_char_sat(simd_ulong3 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char4 SIMD_CFUNC simd_char_sat(simd_ulong4 __x) { return simd_char(simd_min(__x,0x7f)); } -static simd_char8 SIMD_CFUNC simd_char_sat(simd_ulong8 __x) { return simd_char(simd_min(__x,0x7f)); } - -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_char2 __x) { return (simd_uchar2)__x; } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_char3 __x) { return (simd_uchar3)__x; } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_char4 __x) { return (simd_uchar4)__x; } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_char8 __x) { return (simd_uchar8)__x; } -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_char16 __x) { return (simd_uchar16)__x; } -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_char32 __x) { return (simd_uchar32)__x; } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_uchar2 __x) { return __x; } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_uchar3 __x) { return __x; } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_uchar4 __x) { return __x; } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_uchar8 __x) { return __x; } -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_uchar16 __x) { return __x; } -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_uchar32 __x) { return __x; } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_short2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_short3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_short4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_short8 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_short16 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_short32 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_ushort2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_ushort3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_ushort4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_ushort8 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_ushort16 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar32 SIMD_CFUNC simd_uchar(simd_ushort32 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_int2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_int3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_int4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_int8 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_int16 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_uint2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_uint3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_uint4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_uint8 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_uint16 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_float2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_float3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_float4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_float8 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar16 SIMD_CFUNC simd_uchar(simd_float16 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_long2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_long3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_long4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_long8 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_ulong2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_ulong3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_ulong4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_ulong8 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar(simd_double2 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar(simd_double3 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar(simd_double4 __x) { return simd_uchar(simd_char(__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar(simd_double8 __x) { return simd_uchar(simd_char(__x)); } - -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_char2 __x) { return simd_uchar(simd_max(0,__x)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_char3 __x) { return simd_uchar(simd_max(0,__x)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_char4 __x) { return simd_uchar(simd_max(0,__x)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_char8 __x) { return simd_uchar(simd_max(0,__x)); } -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_char16 __x) { return simd_uchar(simd_max(0,__x)); } -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_char32 __x) { return simd_uchar(simd_max(0,__x)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_short2 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_short3 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_short4 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_short8 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_short16 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_short32 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_int2 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_int3 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_int4 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_int8 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_int16 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_float2 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_float3 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_float4 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_float8 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_float16 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_long2 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_long3 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_long4 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_long8 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_double2 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_double3 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_double4 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_double8 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_uchar2 __x) { return __x; } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_uchar3 __x) { return __x; } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_uchar4 __x) { return __x; } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_uchar8 __x) { return __x; } -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_uchar16 __x) { return __x; } -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_uchar32 __x) { return __x; } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_ushort2 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_ushort3 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_ushort4 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_ushort8 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_ushort16 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_ushort32 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_uint2 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_uint3 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_uint4 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_uint8 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_uint16 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar2 SIMD_CFUNC simd_uchar_sat(simd_ulong2 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_ulong3 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_ulong4 __x) { return simd_uchar(simd_min(__x,0xff)); } -static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_ulong8 __x) { return simd_uchar(simd_min(__x,0xff)); } - -static simd_short2 SIMD_CFUNC simd_short(simd_char2 __x) { return __builtin_convertvector(__x, simd_short2); } -static simd_short3 SIMD_CFUNC simd_short(simd_char3 __x) { return __builtin_convertvector(__x, simd_short3); } -static simd_short4 SIMD_CFUNC simd_short(simd_char4 __x) { return __builtin_convertvector(__x, simd_short4); } -static simd_short8 SIMD_CFUNC simd_short(simd_char8 __x) { return __builtin_convertvector(__x, simd_short8); } -static simd_short16 SIMD_CFUNC simd_short(simd_char16 __x) { return __builtin_convertvector(__x, simd_short16); } -static simd_short32 SIMD_CFUNC simd_short(simd_char32 __x) { return __builtin_convertvector(__x, simd_short32); } -static simd_short2 SIMD_CFUNC simd_short(simd_uchar2 __x) { return __builtin_convertvector(__x, simd_short2); } -static simd_short3 SIMD_CFUNC simd_short(simd_uchar3 __x) { return __builtin_convertvector(__x, simd_short3); } -static simd_short4 SIMD_CFUNC simd_short(simd_uchar4 __x) { return __builtin_convertvector(__x, simd_short4); } -static simd_short8 SIMD_CFUNC simd_short(simd_uchar8 __x) { return __builtin_convertvector(__x, simd_short8); } -static simd_short16 SIMD_CFUNC simd_short(simd_uchar16 __x) { return __builtin_convertvector(__x, simd_short16); } -static simd_short32 SIMD_CFUNC simd_short(simd_uchar32 __x) { return __builtin_convertvector(__x, simd_short32); } -static simd_short2 SIMD_CFUNC simd_short(simd_short2 __x) { return __x; } -static simd_short3 SIMD_CFUNC simd_short(simd_short3 __x) { return __x; } -static simd_short4 SIMD_CFUNC simd_short(simd_short4 __x) { return __x; } -static simd_short8 SIMD_CFUNC simd_short(simd_short8 __x) { return __x; } -static simd_short16 SIMD_CFUNC simd_short(simd_short16 __x) { return __x; } -static simd_short32 SIMD_CFUNC simd_short(simd_short32 __x) { return __x; } -static simd_short2 SIMD_CFUNC simd_short(simd_ushort2 __x) { return (simd_short2)__x; } -static simd_short3 SIMD_CFUNC simd_short(simd_ushort3 __x) { return (simd_short3)__x; } -static simd_short4 SIMD_CFUNC simd_short(simd_ushort4 __x) { return (simd_short4)__x; } -static simd_short8 SIMD_CFUNC simd_short(simd_ushort8 __x) { return (simd_short8)__x; } -static simd_short16 SIMD_CFUNC simd_short(simd_ushort16 __x) { return (simd_short16)__x; } -static simd_short32 SIMD_CFUNC simd_short(simd_ushort32 __x) { return (simd_short32)__x; } -static simd_short2 SIMD_CFUNC simd_short(simd_int2 __x) { return __builtin_convertvector(__x & 0xffff, simd_short2); } -static simd_short3 SIMD_CFUNC simd_short(simd_int3 __x) { return __builtin_convertvector(__x & 0xffff, simd_short3); } -static simd_short4 SIMD_CFUNC simd_short(simd_int4 __x) { return __builtin_convertvector(__x & 0xffff, simd_short4); } -static simd_short8 SIMD_CFUNC simd_short(simd_int8 __x) { return __builtin_convertvector(__x & 0xffff, simd_short8); } -static simd_short16 SIMD_CFUNC simd_short(simd_int16 __x) { return __builtin_convertvector(__x & 0xffff, simd_short16); } -static simd_short2 SIMD_CFUNC simd_short(simd_uint2 __x) { return simd_short(simd_int(__x)); } -static simd_short3 SIMD_CFUNC simd_short(simd_uint3 __x) { return simd_short(simd_int(__x)); } -static simd_short4 SIMD_CFUNC simd_short(simd_uint4 __x) { return simd_short(simd_int(__x)); } -static simd_short8 SIMD_CFUNC simd_short(simd_uint8 __x) { return simd_short(simd_int(__x)); } -static simd_short16 SIMD_CFUNC simd_short(simd_uint16 __x) { return simd_short(simd_int(__x)); } -static simd_short2 SIMD_CFUNC simd_short(simd_float2 __x) { return simd_short(simd_int(__x)); } -static simd_short3 SIMD_CFUNC simd_short(simd_float3 __x) { return simd_short(simd_int(__x)); } -static simd_short4 SIMD_CFUNC simd_short(simd_float4 __x) { return simd_short(simd_int(__x)); } -static simd_short8 SIMD_CFUNC simd_short(simd_float8 __x) { return simd_short(simd_int(__x)); } -static simd_short16 SIMD_CFUNC simd_short(simd_float16 __x) { return simd_short(simd_int(__x)); } -static simd_short2 SIMD_CFUNC simd_short(simd_long2 __x) { return simd_short(simd_int(__x)); } -static simd_short3 SIMD_CFUNC simd_short(simd_long3 __x) { return simd_short(simd_int(__x)); } -static simd_short4 SIMD_CFUNC simd_short(simd_long4 __x) { return simd_short(simd_int(__x)); } -static simd_short8 SIMD_CFUNC simd_short(simd_long8 __x) { return simd_short(simd_int(__x)); } -static simd_short2 SIMD_CFUNC simd_short(simd_ulong2 __x) { return simd_short(simd_int(__x)); } -static simd_short3 SIMD_CFUNC simd_short(simd_ulong3 __x) { return simd_short(simd_int(__x)); } -static simd_short4 SIMD_CFUNC simd_short(simd_ulong4 __x) { return simd_short(simd_int(__x)); } -static simd_short8 SIMD_CFUNC simd_short(simd_ulong8 __x) { return simd_short(simd_int(__x)); } -static simd_short2 SIMD_CFUNC simd_short(simd_double2 __x) { return simd_short(simd_int(__x)); } -static simd_short3 SIMD_CFUNC simd_short(simd_double3 __x) { return simd_short(simd_int(__x)); } -static simd_short4 SIMD_CFUNC simd_short(simd_double4 __x) { return simd_short(simd_int(__x)); } -static simd_short8 SIMD_CFUNC simd_short(simd_double8 __x) { return simd_short(simd_int(__x)); } - -static simd_short2 SIMD_CFUNC simd_short_sat(simd_char2 __x) { return simd_short(__x); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_char3 __x) { return simd_short(__x); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_char4 __x) { return simd_short(__x); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_char8 __x) { return simd_short(__x); } -static simd_short16 SIMD_CFUNC simd_short_sat(simd_char16 __x) { return simd_short(__x); } -static simd_short32 SIMD_CFUNC simd_short_sat(simd_char32 __x) { return simd_short(__x); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_short2 __x) { return __x; } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_short3 __x) { return __x; } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_short4 __x) { return __x; } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_short8 __x) { return __x; } -static simd_short16 SIMD_CFUNC simd_short_sat(simd_short16 __x) { return __x; } -static simd_short32 SIMD_CFUNC simd_short_sat(simd_short32 __x) { return __x; } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_int2 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_int3 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_int4 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_int8 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short16 SIMD_CFUNC simd_short_sat(simd_int16 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_float2 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_float3 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_float4 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_float8 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short16 SIMD_CFUNC simd_short_sat(simd_float16 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_long2 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_long3 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_long4 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_long8 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_double2 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_double3 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_double4 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_double8 __x) { return simd_short(simd_clamp(__x,-0x8000,0x7fff)); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_uchar2 __x) { return simd_short(__x); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_uchar3 __x) { return simd_short(__x); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_uchar4 __x) { return simd_short(__x); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_uchar8 __x) { return simd_short(__x); } -static simd_short16 SIMD_CFUNC simd_short_sat(simd_uchar16 __x) { return simd_short(__x); } -static simd_short32 SIMD_CFUNC simd_short_sat(simd_uchar32 __x) { return simd_short(__x); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_ushort2 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_ushort3 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_ushort4 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_ushort8 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short16 SIMD_CFUNC simd_short_sat(simd_ushort16 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short32 SIMD_CFUNC simd_short_sat(simd_ushort32 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_uint2 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_uint3 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_uint4 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_uint8 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short16 SIMD_CFUNC simd_short_sat(simd_uint16 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short2 SIMD_CFUNC simd_short_sat(simd_ulong2 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short3 SIMD_CFUNC simd_short_sat(simd_ulong3 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short4 SIMD_CFUNC simd_short_sat(simd_ulong4 __x) { return simd_short(simd_min(__x,0x7fff)); } -static simd_short8 SIMD_CFUNC simd_short_sat(simd_ulong8 __x) { return simd_short(simd_min(__x,0x7fff)); } - -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_char2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_char3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_char4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_char8 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_char16 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_char32 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_uchar2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_uchar3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_uchar4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_uchar8 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_uchar16 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_uchar32 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_short2 __x) { return (simd_ushort2)__x; } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_short3 __x) { return (simd_ushort3)__x; } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_short4 __x) { return (simd_ushort4)__x; } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_short8 __x) { return (simd_ushort8)__x; } -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_short16 __x) { return (simd_ushort16)__x; } -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_short32 __x) { return (simd_ushort32)__x; } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_ushort2 __x) { return __x; } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_ushort3 __x) { return __x; } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_ushort4 __x) { return __x; } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_ushort8 __x) { return __x; } -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_ushort16 __x) { return __x; } -static simd_ushort32 SIMD_CFUNC simd_ushort(simd_ushort32 __x) { return __x; } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_int2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_int3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_int4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_int8 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_int16 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_uint2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_uint3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_uint4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_uint8 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_uint16 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_float2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_float3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_float4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_float8 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort16 SIMD_CFUNC simd_ushort(simd_float16 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_long2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_long3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_long4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_long8 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_ulong2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_ulong3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_ulong4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_ulong8 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort2 SIMD_CFUNC simd_ushort(simd_double2 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort3 SIMD_CFUNC simd_ushort(simd_double3 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort4 SIMD_CFUNC simd_ushort(simd_double4 __x) { return simd_ushort(simd_short(__x)); } -static simd_ushort8 SIMD_CFUNC simd_ushort(simd_double8 __x) { return simd_ushort(simd_short(__x)); } - -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_char2 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_char3 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_char4 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_char8 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_char16 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_char32 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_short2 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_short3 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_short4 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_short8 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_short16 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_short32 __x) { return simd_ushort(simd_max(__x, 0)); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_int2 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_int3 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_int4 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_int8 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_int16 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_float2 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_float3 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_float4 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_float8 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_float16 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_long2 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_long3 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_long4 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_long8 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_double2 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_double3 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_double4 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_double8 __x) { return simd_ushort(simd_clamp(__x, 0, 0xffff)); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_uchar2 __x) { return simd_ushort(__x); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_uchar3 __x) { return simd_ushort(__x); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_uchar4 __x) { return simd_ushort(__x); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_uchar8 __x) { return simd_ushort(__x); } -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_uchar16 __x) { return simd_ushort(__x); } -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_uchar32 __x) { return simd_ushort(__x); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_ushort2 __x) { return __x; } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_ushort3 __x) { return __x; } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_ushort4 __x) { return __x; } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_ushort8 __x) { return __x; } -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_ushort16 __x) { return __x; } -static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_ushort32 __x) { return __x; } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_uint2 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_uint3 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_uint4 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_uint8 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_uint16 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_ulong2 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_ulong3 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_ulong4 __x) { return simd_ushort(simd_min(__x, 0xffff)); } -static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_ulong8 __x) { return simd_ushort(simd_min(__x, 0xffff)); } - -static simd_int2 SIMD_CFUNC simd_int(simd_char2 __x) { return __builtin_convertvector(__x, simd_int2); } -static simd_int3 SIMD_CFUNC simd_int(simd_char3 __x) { return __builtin_convertvector(__x, simd_int3); } -static simd_int4 SIMD_CFUNC simd_int(simd_char4 __x) { return __builtin_convertvector(__x, simd_int4); } -static simd_int8 SIMD_CFUNC simd_int(simd_char8 __x) { return __builtin_convertvector(__x, simd_int8); } -static simd_int16 SIMD_CFUNC simd_int(simd_char16 __x) { return __builtin_convertvector(__x, simd_int16); } -static simd_int2 SIMD_CFUNC simd_int(simd_uchar2 __x) { return __builtin_convertvector(__x, simd_int2); } -static simd_int3 SIMD_CFUNC simd_int(simd_uchar3 __x) { return __builtin_convertvector(__x, simd_int3); } -static simd_int4 SIMD_CFUNC simd_int(simd_uchar4 __x) { return __builtin_convertvector(__x, simd_int4); } -static simd_int8 SIMD_CFUNC simd_int(simd_uchar8 __x) { return __builtin_convertvector(__x, simd_int8); } -static simd_int16 SIMD_CFUNC simd_int(simd_uchar16 __x) { return __builtin_convertvector(__x, simd_int16); } -static simd_int2 SIMD_CFUNC simd_int(simd_short2 __x) { return __builtin_convertvector(__x, simd_int2); } -static simd_int3 SIMD_CFUNC simd_int(simd_short3 __x) { return __builtin_convertvector(__x, simd_int3); } -static simd_int4 SIMD_CFUNC simd_int(simd_short4 __x) { return __builtin_convertvector(__x, simd_int4); } -static simd_int8 SIMD_CFUNC simd_int(simd_short8 __x) { return __builtin_convertvector(__x, simd_int8); } -static simd_int16 SIMD_CFUNC simd_int(simd_short16 __x) { return __builtin_convertvector(__x, simd_int16); } -static simd_int2 SIMD_CFUNC simd_int(simd_ushort2 __x) { return __builtin_convertvector(__x, simd_int2); } -static simd_int3 SIMD_CFUNC simd_int(simd_ushort3 __x) { return __builtin_convertvector(__x, simd_int3); } -static simd_int4 SIMD_CFUNC simd_int(simd_ushort4 __x) { return __builtin_convertvector(__x, simd_int4); } -static simd_int8 SIMD_CFUNC simd_int(simd_ushort8 __x) { return __builtin_convertvector(__x, simd_int8); } -static simd_int16 SIMD_CFUNC simd_int(simd_ushort16 __x) { return __builtin_convertvector(__x, simd_int16); } -static simd_int2 SIMD_CFUNC simd_int(simd_int2 __x) { return __x; } -static simd_int3 SIMD_CFUNC simd_int(simd_int3 __x) { return __x; } -static simd_int4 SIMD_CFUNC simd_int(simd_int4 __x) { return __x; } -static simd_int8 SIMD_CFUNC simd_int(simd_int8 __x) { return __x; } -static simd_int16 SIMD_CFUNC simd_int(simd_int16 __x) { return __x; } -static simd_int2 SIMD_CFUNC simd_int(simd_uint2 __x) { return (simd_int2)__x; } -static simd_int3 SIMD_CFUNC simd_int(simd_uint3 __x) { return (simd_int3)__x; } -static simd_int4 SIMD_CFUNC simd_int(simd_uint4 __x) { return (simd_int4)__x; } -static simd_int8 SIMD_CFUNC simd_int(simd_uint8 __x) { return (simd_int8)__x; } -static simd_int16 SIMD_CFUNC simd_int(simd_uint16 __x) { return (simd_int16)__x; } -static simd_int2 SIMD_CFUNC simd_int(simd_float2 __x) { return __builtin_convertvector(__x, simd_int2); } -static simd_int3 SIMD_CFUNC simd_int(simd_float3 __x) { return __builtin_convertvector(__x, simd_int3); } -static simd_int4 SIMD_CFUNC simd_int(simd_float4 __x) { return __builtin_convertvector(__x, simd_int4); } -static simd_int8 SIMD_CFUNC simd_int(simd_float8 __x) { return __builtin_convertvector(__x, simd_int8); } -static simd_int16 SIMD_CFUNC simd_int(simd_float16 __x) { return __builtin_convertvector(__x, simd_int16); } -static simd_int2 SIMD_CFUNC simd_int(simd_long2 __x) { return __builtin_convertvector(__x & 0xffffffff, simd_int2); } -static simd_int3 SIMD_CFUNC simd_int(simd_long3 __x) { return __builtin_convertvector(__x & 0xffffffff, simd_int3); } -static simd_int4 SIMD_CFUNC simd_int(simd_long4 __x) { return __builtin_convertvector(__x & 0xffffffff, simd_int4); } -static simd_int8 SIMD_CFUNC simd_int(simd_long8 __x) { return __builtin_convertvector(__x & 0xffffffff, simd_int8); } -static simd_int2 SIMD_CFUNC simd_int(simd_ulong2 __x) { return simd_int(simd_long(__x)); } -static simd_int3 SIMD_CFUNC simd_int(simd_ulong3 __x) { return simd_int(simd_long(__x)); } -static simd_int4 SIMD_CFUNC simd_int(simd_ulong4 __x) { return simd_int(simd_long(__x)); } -static simd_int8 SIMD_CFUNC simd_int(simd_ulong8 __x) { return simd_int(simd_long(__x)); } -static simd_int2 SIMD_CFUNC simd_int(simd_double2 __x) { return __builtin_convertvector(__x, simd_int2); } -static simd_int3 SIMD_CFUNC simd_int(simd_double3 __x) { return __builtin_convertvector(__x, simd_int3); } -static simd_int4 SIMD_CFUNC simd_int(simd_double4 __x) { return __builtin_convertvector(__x, simd_int4); } -static simd_int8 SIMD_CFUNC simd_int(simd_double8 __x) { return __builtin_convertvector(__x, simd_int8); } - -static simd_int2 SIMD_CFUNC simd_int_sat(simd_char2 __x) { return simd_int(__x); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_char3 __x) { return simd_int(__x); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_char4 __x) { return simd_int(__x); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_char8 __x) { return simd_int(__x); } -static simd_int16 SIMD_CFUNC simd_int_sat(simd_char16 __x) { return simd_int(__x); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_short2 __x) { return simd_int(__x); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_short3 __x) { return simd_int(__x); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_short4 __x) { return simd_int(__x); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_short8 __x) { return simd_int(__x); } -static simd_int16 SIMD_CFUNC simd_int_sat(simd_short16 __x) { return simd_int(__x); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_int2 __x) { return __x; } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_int3 __x) { return __x; } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_int4 __x) { return __x; } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_int8 __x) { return __x; } -static simd_int16 SIMD_CFUNC simd_int_sat(simd_int16 __x) { return __x; } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_float2 __x) { return simd_bitselect(simd_int(simd_max(__x,-0x1.0p31f)), 0x7fffffff, __x >= 0x1.0p31f); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_float3 __x) { return simd_bitselect(simd_int(simd_max(__x,-0x1.0p31f)), 0x7fffffff, __x >= 0x1.0p31f); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_float4 __x) { return simd_bitselect(simd_int(simd_max(__x,-0x1.0p31f)), 0x7fffffff, __x >= 0x1.0p31f); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_float8 __x) { return simd_bitselect(simd_int(simd_max(__x,-0x1.0p31f)), 0x7fffffff, __x >= 0x1.0p31f); } -static simd_int16 SIMD_CFUNC simd_int_sat(simd_float16 __x) { return simd_bitselect(simd_int(simd_max(__x,-0x1.0p31f)), 0x7fffffff, __x >= 0x1.0p31f); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_long2 __x) { return simd_int(simd_clamp(__x,-0x80000000LL,0x7fffffffLL)); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_long3 __x) { return simd_int(simd_clamp(__x,-0x80000000LL,0x7fffffffLL)); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_long4 __x) { return simd_int(simd_clamp(__x,-0x80000000LL,0x7fffffffLL)); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_long8 __x) { return simd_int(simd_clamp(__x,-0x80000000LL,0x7fffffffLL)); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_double2 __x) { return simd_int(simd_clamp(__x,-0x1.0p31,0x1.fffffffcp30)); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_double3 __x) { return simd_int(simd_clamp(__x,-0x1.0p31,0x1.fffffffcp30)); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_double4 __x) { return simd_int(simd_clamp(__x,-0x1.0p31,0x1.fffffffcp30)); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_double8 __x) { return simd_int(simd_clamp(__x,-0x1.0p31,0x1.fffffffcp30)); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_uchar2 __x) { return simd_int(__x); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_uchar3 __x) { return simd_int(__x); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_uchar4 __x) { return simd_int(__x); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_uchar8 __x) { return simd_int(__x); } -static simd_int16 SIMD_CFUNC simd_int_sat(simd_uchar16 __x) { return simd_int(__x); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_ushort2 __x) { return simd_int(__x); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_ushort3 __x) { return simd_int(__x); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_ushort4 __x) { return simd_int(__x); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_ushort8 __x) { return simd_int(__x); } -static simd_int16 SIMD_CFUNC simd_int_sat(simd_ushort16 __x) { return simd_int(__x); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_uint2 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_uint3 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_uint4 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_uint8 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int16 SIMD_CFUNC simd_int_sat(simd_uint16 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int2 SIMD_CFUNC simd_int_sat(simd_ulong2 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int3 SIMD_CFUNC simd_int_sat(simd_ulong3 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int4 SIMD_CFUNC simd_int_sat(simd_ulong4 __x) { return simd_int(simd_min(__x,0x7fffffff)); } -static simd_int8 SIMD_CFUNC simd_int_sat(simd_ulong8 __x) { return simd_int(simd_min(__x,0x7fffffff)); } - -static simd_uint2 SIMD_CFUNC simd_uint(simd_char2 __x) { return simd_uint(simd_int(__x)); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_char3 __x) { return simd_uint(simd_int(__x)); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_char4 __x) { return simd_uint(simd_int(__x)); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_char8 __x) { return simd_uint(simd_int(__x)); } -static simd_uint16 SIMD_CFUNC simd_uint(simd_char16 __x) { return simd_uint(simd_int(__x)); } -static simd_uint2 SIMD_CFUNC simd_uint(simd_uchar2 __x) { return simd_uint(simd_int(__x)); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_uchar3 __x) { return simd_uint(simd_int(__x)); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_uchar4 __x) { return simd_uint(simd_int(__x)); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_uchar8 __x) { return simd_uint(simd_int(__x)); } -static simd_uint16 SIMD_CFUNC simd_uint(simd_uchar16 __x) { return simd_uint(simd_int(__x)); } -static simd_uint2 SIMD_CFUNC simd_uint(simd_short2 __x) { return simd_uint(simd_int(__x)); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_short3 __x) { return simd_uint(simd_int(__x)); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_short4 __x) { return simd_uint(simd_int(__x)); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_short8 __x) { return simd_uint(simd_int(__x)); } -static simd_uint16 SIMD_CFUNC simd_uint(simd_short16 __x) { return simd_uint(simd_int(__x)); } -static simd_uint2 SIMD_CFUNC simd_uint(simd_ushort2 __x) { return simd_uint(simd_int(__x)); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_ushort3 __x) { return simd_uint(simd_int(__x)); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_ushort4 __x) { return simd_uint(simd_int(__x)); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_ushort8 __x) { return simd_uint(simd_int(__x)); } -static simd_uint16 SIMD_CFUNC simd_uint(simd_ushort16 __x) { return simd_uint(simd_int(__x)); } -static simd_uint2 SIMD_CFUNC simd_uint(simd_int2 __x) { return (simd_uint2)__x; } -static simd_uint3 SIMD_CFUNC simd_uint(simd_int3 __x) { return (simd_uint3)__x; } -static simd_uint4 SIMD_CFUNC simd_uint(simd_int4 __x) { return (simd_uint4)__x; } -static simd_uint8 SIMD_CFUNC simd_uint(simd_int8 __x) { return (simd_uint8)__x; } -static simd_uint16 SIMD_CFUNC simd_uint(simd_int16 __x) { return (simd_uint16)__x; } -static simd_uint2 SIMD_CFUNC simd_uint(simd_uint2 __x) { return __x; } -static simd_uint3 SIMD_CFUNC simd_uint(simd_uint3 __x) { return __x; } -static simd_uint4 SIMD_CFUNC simd_uint(simd_uint4 __x) { return __x; } -static simd_uint8 SIMD_CFUNC simd_uint(simd_uint8 __x) { return __x; } -static simd_uint16 SIMD_CFUNC simd_uint(simd_uint16 __x) { return __x; } -static simd_uint2 SIMD_CFUNC simd_uint(simd_float2 __x) { simd_int2 __big = __x > 0x1.0p31f; return simd_uint(simd_int(__x - simd_bitselect((simd_float2)0,0x1.0p31f,__big))) + simd_bitselect((simd_uint2)0,0x80000000,__big); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_float3 __x) { simd_int3 __big = __x > 0x1.0p31f; return simd_uint(simd_int(__x - simd_bitselect((simd_float3)0,0x1.0p31f,__big))) + simd_bitselect((simd_uint3)0,0x80000000,__big); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_float4 __x) { simd_int4 __big = __x > 0x1.0p31f; return simd_uint(simd_int(__x - simd_bitselect((simd_float4)0,0x1.0p31f,__big))) + simd_bitselect((simd_uint4)0,0x80000000,__big); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_float8 __x) { simd_int8 __big = __x > 0x1.0p31f; return simd_uint(simd_int(__x - simd_bitselect((simd_float8)0,0x1.0p31f,__big))) + simd_bitselect((simd_uint8)0,0x80000000,__big); } -static simd_uint16 SIMD_CFUNC simd_uint(simd_float16 __x) { simd_int16 __big = __x > 0x1.0p31f; return simd_uint(simd_int(__x - simd_bitselect((simd_float16)0,0x1.0p31f,__big))) + simd_bitselect((simd_uint16)0,0x80000000,__big); } -static simd_uint2 SIMD_CFUNC simd_uint(simd_long2 __x) { return simd_uint(simd_int(__x)); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_long3 __x) { return simd_uint(simd_int(__x)); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_long4 __x) { return simd_uint(simd_int(__x)); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_long8 __x) { return simd_uint(simd_int(__x)); } -static simd_uint2 SIMD_CFUNC simd_uint(simd_ulong2 __x) { return simd_uint(simd_int(__x)); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_ulong3 __x) { return simd_uint(simd_int(__x)); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_ulong4 __x) { return simd_uint(simd_int(__x)); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_ulong8 __x) { return simd_uint(simd_int(__x)); } -static simd_uint2 SIMD_CFUNC simd_uint(simd_double2 __x) { simd_long2 __big = __x > 0x1.fffffffcp30; return simd_uint(simd_int(__x - simd_bitselect((simd_double2)0,0x1.0p31,__big))) + simd_bitselect((simd_uint2)0,0x80000000,simd_int(__big)); } -static simd_uint3 SIMD_CFUNC simd_uint(simd_double3 __x) { simd_long3 __big = __x > 0x1.fffffffcp30; return simd_uint(simd_int(__x - simd_bitselect((simd_double3)0,0x1.0p31,__big))) + simd_bitselect((simd_uint3)0,0x80000000,simd_int(__big)); } -static simd_uint4 SIMD_CFUNC simd_uint(simd_double4 __x) { simd_long4 __big = __x > 0x1.fffffffcp30; return simd_uint(simd_int(__x - simd_bitselect((simd_double4)0,0x1.0p31,__big))) + simd_bitselect((simd_uint4)0,0x80000000,simd_int(__big)); } -static simd_uint8 SIMD_CFUNC simd_uint(simd_double8 __x) { simd_long8 __big = __x > 0x1.fffffffcp30; return simd_uint(simd_int(__x - simd_bitselect((simd_double8)0,0x1.0p31,__big))) + simd_bitselect((simd_uint8)0,0x80000000,simd_int(__big)); } - -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_char2 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_char3 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_char4 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_char8 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_char16 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_short2 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_short3 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_short4 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_short8 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_short16 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_int2 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_int3 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_int4 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_int8 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_int16 __x) { return simd_uint(simd_max(__x,0)); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_float2 __x) { return simd_bitselect(simd_uint(simd_max(__x,0)), 0xffffffff, __x >= 0x1.0p32f); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_float3 __x) { return simd_bitselect(simd_uint(simd_max(__x,0)), 0xffffffff, __x >= 0x1.0p32f); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_float4 __x) { return simd_bitselect(simd_uint(simd_max(__x,0)), 0xffffffff, __x >= 0x1.0p32f); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_float8 __x) { return simd_bitselect(simd_uint(simd_max(__x,0)), 0xffffffff, __x >= 0x1.0p32f); } -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_float16 __x) { return simd_bitselect(simd_uint(simd_max(__x,0)), 0xffffffff, __x >= 0x1.0p32f); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_long2 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_long3 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_long4 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_long8 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_double2 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_double3 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_double4 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_double8 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_uchar2 __x) { return simd_uint(__x); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_uchar3 __x) { return simd_uint(__x); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_uchar4 __x) { return simd_uint(__x); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_uchar8 __x) { return simd_uint(__x); } -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_uchar16 __x) { return simd_uint(__x); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_ushort2 __x) { return simd_uint(__x); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_ushort3 __x) { return simd_uint(__x); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_ushort4 __x) { return simd_uint(__x); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_ushort8 __x) { return simd_uint(__x); } -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_ushort16 __x) { return simd_uint(__x); } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_uint2 __x) { return __x; } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_uint3 __x) { return __x; } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_uint4 __x) { return __x; } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_uint8 __x) { return __x; } -static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_uint16 __x) { return __x; } -static simd_uint2 SIMD_CFUNC simd_uint_sat(simd_ulong2 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_ulong3 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_ulong4 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } -static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_ulong8 __x) { return simd_uint(simd_clamp(__x,0,0xffffffff)); } - -static simd_float2 SIMD_CFUNC simd_float(simd_char2 __x) { return (simd_float2)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float3 SIMD_CFUNC simd_float(simd_char3 __x) { return (simd_float3)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float4 SIMD_CFUNC simd_float(simd_char4 __x) { return (simd_float4)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float8 SIMD_CFUNC simd_float(simd_char8 __x) { return (simd_float8)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float16 SIMD_CFUNC simd_float(simd_char16 __x) { return (simd_float16)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float2 SIMD_CFUNC simd_float(simd_uchar2 __x) { return (simd_float2)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float3 SIMD_CFUNC simd_float(simd_uchar3 __x) { return (simd_float3)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float4 SIMD_CFUNC simd_float(simd_uchar4 __x) { return (simd_float4)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float8 SIMD_CFUNC simd_float(simd_uchar8 __x) { return (simd_float8)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float16 SIMD_CFUNC simd_float(simd_uchar16 __x) { return (simd_float16)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float2 SIMD_CFUNC simd_float(simd_short2 __x) { return (simd_float2)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float3 SIMD_CFUNC simd_float(simd_short3 __x) { return (simd_float3)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float4 SIMD_CFUNC simd_float(simd_short4 __x) { return (simd_float4)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float8 SIMD_CFUNC simd_float(simd_short8 __x) { return (simd_float8)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float16 SIMD_CFUNC simd_float(simd_short16 __x) { return (simd_float16)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float2 SIMD_CFUNC simd_float(simd_ushort2 __x) { return (simd_float2)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float3 SIMD_CFUNC simd_float(simd_ushort3 __x) { return (simd_float3)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float4 SIMD_CFUNC simd_float(simd_ushort4 __x) { return (simd_float4)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float8 SIMD_CFUNC simd_float(simd_ushort8 __x) { return (simd_float8)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float16 SIMD_CFUNC simd_float(simd_ushort16 __x) { return (simd_float16)(simd_int(__x) + 0x4b400000) - 0x1.8p23f; } -static simd_float2 SIMD_CFUNC simd_float(simd_int2 __x) { return __builtin_convertvector(__x,simd_float2); } -static simd_float3 SIMD_CFUNC simd_float(simd_int3 __x) { return __builtin_convertvector(__x,simd_float3); } -static simd_float4 SIMD_CFUNC simd_float(simd_int4 __x) { return __builtin_convertvector(__x,simd_float4); } -static simd_float8 SIMD_CFUNC simd_float(simd_int8 __x) { return __builtin_convertvector(__x,simd_float8); } -static simd_float16 SIMD_CFUNC simd_float(simd_int16 __x) { return __builtin_convertvector(__x,simd_float16); } -static simd_float2 SIMD_CFUNC simd_float(simd_uint2 __x) { return __builtin_convertvector(__x,simd_float2); } -static simd_float3 SIMD_CFUNC simd_float(simd_uint3 __x) { return __builtin_convertvector(__x,simd_float3); } -static simd_float4 SIMD_CFUNC simd_float(simd_uint4 __x) { return __builtin_convertvector(__x,simd_float4); } -static simd_float8 SIMD_CFUNC simd_float(simd_uint8 __x) { return __builtin_convertvector(__x,simd_float8); } -static simd_float16 SIMD_CFUNC simd_float(simd_uint16 __x) { return __builtin_convertvector(__x,simd_float16); } -static simd_float2 SIMD_CFUNC simd_float(simd_float2 __x) { return __x; } -static simd_float3 SIMD_CFUNC simd_float(simd_float3 __x) { return __x; } -static simd_float4 SIMD_CFUNC simd_float(simd_float4 __x) { return __x; } -static simd_float8 SIMD_CFUNC simd_float(simd_float8 __x) { return __x; } -static simd_float16 SIMD_CFUNC simd_float(simd_float16 __x) { return __x; } -static simd_float2 SIMD_CFUNC simd_float(simd_long2 __x) { return __builtin_convertvector(__x,simd_float2); } -static simd_float3 SIMD_CFUNC simd_float(simd_long3 __x) { return __builtin_convertvector(__x,simd_float3); } -static simd_float4 SIMD_CFUNC simd_float(simd_long4 __x) { return __builtin_convertvector(__x,simd_float4); } -static simd_float8 SIMD_CFUNC simd_float(simd_long8 __x) { return __builtin_convertvector(__x,simd_float8); } -static simd_float2 SIMD_CFUNC simd_float(simd_ulong2 __x) { return __builtin_convertvector(__x,simd_float2); } -static simd_float3 SIMD_CFUNC simd_float(simd_ulong3 __x) { return __builtin_convertvector(__x,simd_float3); } -static simd_float4 SIMD_CFUNC simd_float(simd_ulong4 __x) { return __builtin_convertvector(__x,simd_float4); } -static simd_float8 SIMD_CFUNC simd_float(simd_ulong8 __x) { return __builtin_convertvector(__x,simd_float8); } -static simd_float2 SIMD_CFUNC simd_float(simd_double2 __x) { return __builtin_convertvector(__x,simd_float2); } -static simd_float3 SIMD_CFUNC simd_float(simd_double3 __x) { return __builtin_convertvector(__x,simd_float3); } -static simd_float4 SIMD_CFUNC simd_float(simd_double4 __x) { return __builtin_convertvector(__x,simd_float4); } -static simd_float8 SIMD_CFUNC simd_float(simd_double8 __x) { return __builtin_convertvector(__x,simd_float8); } - -static simd_long2 SIMD_CFUNC simd_long(simd_char2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_char3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_char4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_char8 __x) { return __builtin_convertvector(__x,simd_long8); } -static simd_long2 SIMD_CFUNC simd_long(simd_uchar2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_uchar3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_uchar4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_uchar8 __x) { return __builtin_convertvector(__x,simd_long8); } -static simd_long2 SIMD_CFUNC simd_long(simd_short2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_short3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_short4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_short8 __x) { return __builtin_convertvector(__x,simd_long8); } -static simd_long2 SIMD_CFUNC simd_long(simd_ushort2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_ushort3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_ushort4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_ushort8 __x) { return __builtin_convertvector(__x,simd_long8); } -static simd_long2 SIMD_CFUNC simd_long(simd_int2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_int3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_int4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_int8 __x) { return __builtin_convertvector(__x,simd_long8); } -static simd_long2 SIMD_CFUNC simd_long(simd_uint2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_uint3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_uint4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_uint8 __x) { return __builtin_convertvector(__x,simd_long8); } -static simd_long2 SIMD_CFUNC simd_long(simd_float2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_float3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_float4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_float8 __x) { return __builtin_convertvector(__x,simd_long8); } -static simd_long2 SIMD_CFUNC simd_long(simd_long2 __x) { return __x; } -static simd_long3 SIMD_CFUNC simd_long(simd_long3 __x) { return __x; } -static simd_long4 SIMD_CFUNC simd_long(simd_long4 __x) { return __x; } -static simd_long8 SIMD_CFUNC simd_long(simd_long8 __x) { return __x; } -static simd_long2 SIMD_CFUNC simd_long(simd_ulong2 __x) { return (simd_long2)__x; } -static simd_long3 SIMD_CFUNC simd_long(simd_ulong3 __x) { return (simd_long3)__x; } -static simd_long4 SIMD_CFUNC simd_long(simd_ulong4 __x) { return (simd_long4)__x; } -static simd_long8 SIMD_CFUNC simd_long(simd_ulong8 __x) { return (simd_long8)__x; } -static simd_long2 SIMD_CFUNC simd_long(simd_double2 __x) { return __builtin_convertvector(__x,simd_long2); } -static simd_long3 SIMD_CFUNC simd_long(simd_double3 __x) { return __builtin_convertvector(__x,simd_long3); } -static simd_long4 SIMD_CFUNC simd_long(simd_double4 __x) { return __builtin_convertvector(__x,simd_long4); } -static simd_long8 SIMD_CFUNC simd_long(simd_double8 __x) { return __builtin_convertvector(__x,simd_long8); } - -static simd_long2 SIMD_CFUNC simd_long_sat(simd_char2 __x) { return simd_long(__x); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_char3 __x) { return simd_long(__x); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_char4 __x) { return simd_long(__x); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_char8 __x) { return simd_long(__x); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_short2 __x) { return simd_long(__x); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_short3 __x) { return simd_long(__x); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_short4 __x) { return simd_long(__x); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_short8 __x) { return simd_long(__x); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_int2 __x) { return simd_long(__x); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_int3 __x) { return simd_long(__x); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_int4 __x) { return simd_long(__x); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_int8 __x) { return simd_long(__x); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_float2 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63f)), 0x7fffffffffffffff, simd_long(__x >= 0x1.0p63f)); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_float3 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63f)), 0x7fffffffffffffff, simd_long(__x >= 0x1.0p63f)); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_float4 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63f)), 0x7fffffffffffffff, simd_long(__x >= 0x1.0p63f)); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_float8 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63f)), 0x7fffffffffffffff, simd_long(__x >= 0x1.0p63f)); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_long2 __x) { return __x; } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_long3 __x) { return __x; } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_long4 __x) { return __x; } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_long8 __x) { return __x; } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_double2 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63)), 0x7fffffffffffffff, __x >= 0x1.0p63); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_double3 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63)), 0x7fffffffffffffff, __x >= 0x1.0p63); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_double4 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63)), 0x7fffffffffffffff, __x >= 0x1.0p63); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_double8 __x) { return simd_bitselect(simd_long(simd_max(__x,-0x1.0p63)), 0x7fffffffffffffff, __x >= 0x1.0p63); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_uchar2 __x) { return simd_long(__x); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_uchar3 __x) { return simd_long(__x); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_uchar4 __x) { return simd_long(__x); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_uchar8 __x) { return simd_long(__x); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_ushort2 __x) { return simd_long(__x); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_ushort3 __x) { return simd_long(__x); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_ushort4 __x) { return simd_long(__x); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_ushort8 __x) { return simd_long(__x); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_uint2 __x) { return simd_long(__x); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_uint3 __x) { return simd_long(__x); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_uint4 __x) { return simd_long(__x); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_uint8 __x) { return simd_long(__x); } -static simd_long2 SIMD_CFUNC simd_long_sat(simd_ulong2 __x) { return simd_long(simd_min(__x,0x7fffffffffffffff)); } -static simd_long3 SIMD_CFUNC simd_long_sat(simd_ulong3 __x) { return simd_long(simd_min(__x,0x7fffffffffffffff)); } -static simd_long4 SIMD_CFUNC simd_long_sat(simd_ulong4 __x) { return simd_long(simd_min(__x,0x7fffffffffffffff)); } -static simd_long8 SIMD_CFUNC simd_long_sat(simd_ulong8 __x) { return simd_long(simd_min(__x,0x7fffffffffffffff)); } - -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_char2 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_char3 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_char4 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_char8 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_uchar2 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_uchar3 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_uchar4 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_uchar8 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_short2 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_short3 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_short4 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_short8 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_ushort2 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_ushort3 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_ushort4 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_ushort8 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_int2 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_int3 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_int4 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_int8 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_uint2 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_uint3 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_uint4 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_uint8 __x) { return simd_ulong(simd_long(__x)); } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_float2 __x) { simd_int2 __big = __x >= 0x1.0p63f; return simd_ulong(simd_long(__x - simd_bitselect((simd_float2)0,0x1.0p63f,__big))) + simd_bitselect((simd_ulong2)0,0x8000000000000000,simd_long(__big)); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_float3 __x) { simd_int3 __big = __x >= 0x1.0p63f; return simd_ulong(simd_long(__x - simd_bitselect((simd_float3)0,0x1.0p63f,__big))) + simd_bitselect((simd_ulong3)0,0x8000000000000000,simd_long(__big)); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_float4 __x) { simd_int4 __big = __x >= 0x1.0p63f; return simd_ulong(simd_long(__x - simd_bitselect((simd_float4)0,0x1.0p63f,__big))) + simd_bitselect((simd_ulong4)0,0x8000000000000000,simd_long(__big)); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_float8 __x) { simd_int8 __big = __x >= 0x1.0p63f; return simd_ulong(simd_long(__x - simd_bitselect((simd_float8)0,0x1.0p63f,__big))) + simd_bitselect((simd_ulong8)0,0x8000000000000000,simd_long(__big)); } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_long2 __x) { return (simd_ulong2)__x; } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_long3 __x) { return (simd_ulong3)__x; } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_long4 __x) { return (simd_ulong4)__x; } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_long8 __x) { return (simd_ulong8)__x; } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_ulong2 __x) { return __x; } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_ulong3 __x) { return __x; } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_ulong4 __x) { return __x; } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_ulong8 __x) { return __x; } -static simd_ulong2 SIMD_CFUNC simd_ulong(simd_double2 __x) { simd_long2 __big = __x >= 0x1.0p63; return simd_ulong(simd_long(__x - simd_bitselect((simd_double2)0,0x1.0p63,__big))) + simd_bitselect((simd_ulong2)0,0x8000000000000000,__big); } -static simd_ulong3 SIMD_CFUNC simd_ulong(simd_double3 __x) { simd_long3 __big = __x >= 0x1.0p63; return simd_ulong(simd_long(__x - simd_bitselect((simd_double3)0,0x1.0p63,__big))) + simd_bitselect((simd_ulong3)0,0x8000000000000000,__big); } -static simd_ulong4 SIMD_CFUNC simd_ulong(simd_double4 __x) { simd_long4 __big = __x >= 0x1.0p63; return simd_ulong(simd_long(__x - simd_bitselect((simd_double4)0,0x1.0p63,__big))) + simd_bitselect((simd_ulong4)0,0x8000000000000000,__big); } -static simd_ulong8 SIMD_CFUNC simd_ulong(simd_double8 __x) { simd_long8 __big = __x >= 0x1.0p63; return simd_ulong(simd_long(__x - simd_bitselect((simd_double8)0,0x1.0p63,__big))) + simd_bitselect((simd_ulong8)0,0x8000000000000000,__big); } - -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_char2 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_char3 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_char4 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_char8 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_short2 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_short3 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_short4 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_short8 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_int2 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_int3 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_int4 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_int8 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_float2 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.f)), 0xffffffffffffffff, simd_long(__x >= 0x1.0p64f)); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_float3 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.f)), 0xffffffffffffffff, simd_long(__x >= 0x1.0p64f)); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_float4 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.f)), 0xffffffffffffffff, simd_long(__x >= 0x1.0p64f)); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_float8 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.f)), 0xffffffffffffffff, simd_long(__x >= 0x1.0p64f)); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_long2 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_long3 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_long4 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_long8 __x) { return simd_ulong(simd_max(__x,0)); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_double2 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.0)), 0xffffffffffffffff, __x >= 0x1.0p64); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_double3 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.0)), 0xffffffffffffffff, __x >= 0x1.0p64); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_double4 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.0)), 0xffffffffffffffff, __x >= 0x1.0p64); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_double8 __x) { return simd_bitselect(simd_ulong(simd_max(__x,0.0)), 0xffffffffffffffff, __x >= 0x1.0p64); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_uchar2 __x) { return simd_ulong(__x); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_uchar3 __x) { return simd_ulong(__x); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_uchar4 __x) { return simd_ulong(__x); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_uchar8 __x) { return simd_ulong(__x); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_ushort2 __x) { return simd_ulong(__x); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_ushort3 __x) { return simd_ulong(__x); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_ushort4 __x) { return simd_ulong(__x); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_ushort8 __x) { return simd_ulong(__x); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_uint2 __x) { return simd_ulong(__x); } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_uint3 __x) { return simd_ulong(__x); } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_uint4 __x) { return simd_ulong(__x); } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_uint8 __x) { return simd_ulong(__x); } -static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_ulong2 __x) { return __x; } -static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_ulong3 __x) { return __x; } -static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_ulong4 __x) { return __x; } -static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_ulong8 __x) { return __x; } - -static simd_double2 SIMD_CFUNC simd_double(simd_char2 __x) { return simd_double(simd_int(__x)); } -static simd_double3 SIMD_CFUNC simd_double(simd_char3 __x) { return simd_double(simd_int(__x)); } -static simd_double4 SIMD_CFUNC simd_double(simd_char4 __x) { return simd_double(simd_int(__x)); } -static simd_double8 SIMD_CFUNC simd_double(simd_char8 __x) { return simd_double(simd_int(__x)); } -static simd_double2 SIMD_CFUNC simd_double(simd_uchar2 __x) { return simd_double(simd_int(__x)); } -static simd_double3 SIMD_CFUNC simd_double(simd_uchar3 __x) { return simd_double(simd_int(__x)); } -static simd_double4 SIMD_CFUNC simd_double(simd_uchar4 __x) { return simd_double(simd_int(__x)); } -static simd_double8 SIMD_CFUNC simd_double(simd_uchar8 __x) { return simd_double(simd_int(__x)); } -static simd_double2 SIMD_CFUNC simd_double(simd_short2 __x) { return simd_double(simd_int(__x)); } -static simd_double3 SIMD_CFUNC simd_double(simd_short3 __x) { return simd_double(simd_int(__x)); } -static simd_double4 SIMD_CFUNC simd_double(simd_short4 __x) { return simd_double(simd_int(__x)); } -static simd_double8 SIMD_CFUNC simd_double(simd_short8 __x) { return simd_double(simd_int(__x)); } -static simd_double2 SIMD_CFUNC simd_double(simd_ushort2 __x) { return simd_double(simd_int(__x)); } -static simd_double3 SIMD_CFUNC simd_double(simd_ushort3 __x) { return simd_double(simd_int(__x)); } -static simd_double4 SIMD_CFUNC simd_double(simd_ushort4 __x) { return simd_double(simd_int(__x)); } -static simd_double8 SIMD_CFUNC simd_double(simd_ushort8 __x) { return simd_double(simd_int(__x)); } -static simd_double2 SIMD_CFUNC simd_double(simd_int2 __x) { return __builtin_convertvector(__x, simd_double2); } -static simd_double3 SIMD_CFUNC simd_double(simd_int3 __x) { return __builtin_convertvector(__x, simd_double3); } -static simd_double4 SIMD_CFUNC simd_double(simd_int4 __x) { return __builtin_convertvector(__x, simd_double4); } -static simd_double8 SIMD_CFUNC simd_double(simd_int8 __x) { return __builtin_convertvector(__x, simd_double8); } -static simd_double2 SIMD_CFUNC simd_double(simd_uint2 __x) { return __builtin_convertvector(__x, simd_double2); } -static simd_double3 SIMD_CFUNC simd_double(simd_uint3 __x) { return __builtin_convertvector(__x, simd_double3); } -static simd_double4 SIMD_CFUNC simd_double(simd_uint4 __x) { return __builtin_convertvector(__x, simd_double4); } -static simd_double8 SIMD_CFUNC simd_double(simd_uint8 __x) { return __builtin_convertvector(__x, simd_double8); } -static simd_double2 SIMD_CFUNC simd_double(simd_float2 __x) { return __builtin_convertvector(__x, simd_double2); } -static simd_double3 SIMD_CFUNC simd_double(simd_float3 __x) { return __builtin_convertvector(__x, simd_double3); } -static simd_double4 SIMD_CFUNC simd_double(simd_float4 __x) { return __builtin_convertvector(__x, simd_double4); } -static simd_double8 SIMD_CFUNC simd_double(simd_float8 __x) { return __builtin_convertvector(__x, simd_double8); } -static simd_double2 SIMD_CFUNC simd_double(simd_long2 __x) { return __builtin_convertvector(__x, simd_double2); } -static simd_double3 SIMD_CFUNC simd_double(simd_long3 __x) { return __builtin_convertvector(__x, simd_double3); } -static simd_double4 SIMD_CFUNC simd_double(simd_long4 __x) { return __builtin_convertvector(__x, simd_double4); } -static simd_double8 SIMD_CFUNC simd_double(simd_long8 __x) { return __builtin_convertvector(__x, simd_double8); } -static simd_double2 SIMD_CFUNC simd_double(simd_ulong2 __x) { return __builtin_convertvector(__x, simd_double2); } -static simd_double3 SIMD_CFUNC simd_double(simd_ulong3 __x) { return __builtin_convertvector(__x, simd_double3); } -static simd_double4 SIMD_CFUNC simd_double(simd_ulong4 __x) { return __builtin_convertvector(__x, simd_double4); } -static simd_double8 SIMD_CFUNC simd_double(simd_ulong8 __x) { return __builtin_convertvector(__x, simd_double8); } -static simd_double2 SIMD_CFUNC simd_double(simd_double2 __x) { return __builtin_convertvector(__x, simd_double2); } -static simd_double3 SIMD_CFUNC simd_double(simd_double3 __x) { return __builtin_convertvector(__x, simd_double3); } -static simd_double4 SIMD_CFUNC simd_double(simd_double4 __x) { return __builtin_convertvector(__x, simd_double4); } -static simd_double8 SIMD_CFUNC simd_double(simd_double8 __x) { return __builtin_convertvector(__x, simd_double8); } - -#ifdef __cplusplus -} -#endif -#endif // SIMD_COMPILER_HAS_REQUIRED_FEATURES -#endif // __SIMD_CONVERSION_HEADER__ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/logic.h b/lib/libc/include/x86_64-macos.10-none/simd/logic.h deleted file mode 100644 index 38bd9bf58c..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/logic.h +++ /dev/null @@ -1,1315 +0,0 @@ -/*! @header - * The interfaces declared in this header provide logical and bitwise - * operations on vectors. Some of these function operate elementwise, - * and some produce a scalar result that depends on all lanes of the input. - * - * For functions returning a boolean value, the return type in C and - * Objective-C is _Bool; for C++ it is bool. - * - * Function Result - * ------------------------------------------------------------------ - * simd_all(comparison) True if and only if the comparison is true - * in every vector lane. e.g.: - * - * if (simd_all(x == 0.0f)) { - * // executed if every lane of x - * // contains zero. - * } - * - * The precise function of simd_all is to - * return the high-order bit of the result - * of a horizontal bitwise AND of all vector - * lanes. - * - * simd_any(comparison) True if and only if the comparison is true - * in at least one vector lane. e.g.: - * - * if (simd_any(x < 0.0f)) { - * // executed if any lane of x - * // contains a negative value. - * } - * - * The precise function of simd_all is to - * return the high-order bit of the result - * of a horizontal bitwise OR of all vector - * lanes. - * - * simd_select(x,y,mask) For each lane in the result, selects the - * corresponding element of x if the high- - * order bit of the corresponding element of - * mask is 0, and the corresponding element - * of y otherwise. - * - * simd_bitselect(x,y,mask) For each bit in the result, selects the - * corresponding bit of x if the corresponding - * bit of mask is clear, and the corresponding - * of y otherwise. - * - * In C++, these functions are available under the simd:: namespace: - * - * C++ Function Equivalent C Function - * -------------------------------------------------------------------- - * simd::all(comparison) simd_all(comparison) - * simd::any(comparison) simd_any(comparison) - * simd::select(x,y,mask) simd_select(x,y,mask) - * simd::bitselect(x,y,mask) simd_bitselect(x,y,mask) - * - * @copyright 2014-2017 Apple, Inc. All rights reserved. - * @unsorted */ - -#ifndef SIMD_LOGIC_HEADER -#define SIMD_LOGIC_HEADER - -#include -#if SIMD_COMPILER_HAS_REQUIRED_FEATURES -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_char2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_char3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_char4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_char8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_char16 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_char32 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_char64 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar16 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar32 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar64 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_short2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_short3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_short4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_short8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_short16 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_short32 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort16 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort32 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_int2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_int3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_int4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_int8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_int16 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uint2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uint3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uint4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uint8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_uint16 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_long2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_long3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_long4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_long8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong2 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong3 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong4 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong8 x); -/*! @abstract True if and only if the high-order bit of any lane of the - * vector is set. - * @discussion Deprecated. Use simd_any instead. */ -#define vector_any simd_any - -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_char2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_char3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_char4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_char8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_char16 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_char32 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_char64 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar16 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar32 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar64 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_short2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_short3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_short4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_short8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_short16 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_short32 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort16 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort32 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_int2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_int3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_int4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_int8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_int16 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uint2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uint3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uint4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uint8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_uint16 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_long2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_long3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_long4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_long8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong2 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong3 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong4 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. */ -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong8 x); -/*! @abstract True if and only if the high-order bit of every lane of the - * vector is set. - * @discussion Deprecated. Use simd_all instead. */ -#define vector_all simd_all - -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_float2 simd_select(simd_float2 x, simd_float2 y, simd_int2 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_float3 simd_select(simd_float3 x, simd_float3 y, simd_int3 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_float4 simd_select(simd_float4 x, simd_float4 y, simd_int4 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_float8 simd_select(simd_float8 x, simd_float8 y, simd_int8 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_float16 simd_select(simd_float16 x, simd_float16 y, simd_int16 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_double2 simd_select(simd_double2 x, simd_double2 y, simd_long2 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_double3 simd_select(simd_double3 x, simd_double3 y, simd_long3 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_double4 simd_select(simd_double4 x, simd_double4 y, simd_long4 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ -static inline SIMD_CFUNC simd_double8 simd_select(simd_double8 x, simd_double8 y, simd_long8 mask); -/*! @abstract For each lane in the result, selects the corresponding element - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. - * @discussion Deprecated. Use simd_select instead. */ -#define vector_select simd_select - -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_char2 simd_bitselect(simd_char2 x, simd_char2 y, simd_char2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_char3 simd_bitselect(simd_char3 x, simd_char3 y, simd_char3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_char4 simd_bitselect(simd_char4 x, simd_char4 y, simd_char4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_char8 simd_bitselect(simd_char8 x, simd_char8 y, simd_char8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_char16 simd_bitselect(simd_char16 x, simd_char16 y, simd_char16 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_char32 simd_bitselect(simd_char32 x, simd_char32 y, simd_char32 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_char64 simd_bitselect(simd_char64 x, simd_char64 y, simd_char64 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uchar2 simd_bitselect(simd_uchar2 x, simd_uchar2 y, simd_char2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uchar3 simd_bitselect(simd_uchar3 x, simd_uchar3 y, simd_char3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uchar4 simd_bitselect(simd_uchar4 x, simd_uchar4 y, simd_char4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uchar8 simd_bitselect(simd_uchar8 x, simd_uchar8 y, simd_char8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uchar16 simd_bitselect(simd_uchar16 x, simd_uchar16 y, simd_char16 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uchar32 simd_bitselect(simd_uchar32 x, simd_uchar32 y, simd_char32 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uchar64 simd_bitselect(simd_uchar64 x, simd_uchar64 y, simd_char64 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_short2 simd_bitselect(simd_short2 x, simd_short2 y, simd_short2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_short3 simd_bitselect(simd_short3 x, simd_short3 y, simd_short3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_short4 simd_bitselect(simd_short4 x, simd_short4 y, simd_short4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_short8 simd_bitselect(simd_short8 x, simd_short8 y, simd_short8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_short16 simd_bitselect(simd_short16 x, simd_short16 y, simd_short16 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_short32 simd_bitselect(simd_short32 x, simd_short32 y, simd_short32 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ushort2 simd_bitselect(simd_ushort2 x, simd_ushort2 y, simd_short2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ushort3 simd_bitselect(simd_ushort3 x, simd_ushort3 y, simd_short3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ushort4 simd_bitselect(simd_ushort4 x, simd_ushort4 y, simd_short4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ushort8 simd_bitselect(simd_ushort8 x, simd_ushort8 y, simd_short8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ushort16 simd_bitselect(simd_ushort16 x, simd_ushort16 y, simd_short16 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ushort32 simd_bitselect(simd_ushort32 x, simd_ushort32 y, simd_short32 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_int2 simd_bitselect(simd_int2 x, simd_int2 y, simd_int2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_int3 simd_bitselect(simd_int3 x, simd_int3 y, simd_int3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_int4 simd_bitselect(simd_int4 x, simd_int4 y, simd_int4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_int8 simd_bitselect(simd_int8 x, simd_int8 y, simd_int8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_int16 simd_bitselect(simd_int16 x, simd_int16 y, simd_int16 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uint2 simd_bitselect(simd_uint2 x, simd_uint2 y, simd_int2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uint3 simd_bitselect(simd_uint3 x, simd_uint3 y, simd_int3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uint4 simd_bitselect(simd_uint4 x, simd_uint4 y, simd_int4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uint8 simd_bitselect(simd_uint8 x, simd_uint8 y, simd_int8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_uint16 simd_bitselect(simd_uint16 x, simd_uint16 y, simd_int16 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_float2 simd_bitselect(simd_float2 x, simd_float2 y, simd_int2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_float3 simd_bitselect(simd_float3 x, simd_float3 y, simd_int3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_float4 simd_bitselect(simd_float4 x, simd_float4 y, simd_int4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_float8 simd_bitselect(simd_float8 x, simd_float8 y, simd_int8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_float16 simd_bitselect(simd_float16 x, simd_float16 y, simd_int16 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_long2 simd_bitselect(simd_long2 x, simd_long2 y, simd_long2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_long3 simd_bitselect(simd_long3 x, simd_long3 y, simd_long3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_long4 simd_bitselect(simd_long4 x, simd_long4 y, simd_long4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_long8 simd_bitselect(simd_long8 x, simd_long8 y, simd_long8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ulong2 simd_bitselect(simd_ulong2 x, simd_ulong2 y, simd_long2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ulong3 simd_bitselect(simd_ulong3 x, simd_ulong3 y, simd_long3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ulong4 simd_bitselect(simd_ulong4 x, simd_ulong4 y, simd_long4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_ulong8 simd_bitselect(simd_ulong8 x, simd_ulong8 y, simd_long8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_double2 simd_bitselect(simd_double2 x, simd_double2 y, simd_long2 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_double3 simd_bitselect(simd_double3 x, simd_double3 y, simd_long3 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_double4 simd_bitselect(simd_double4 x, simd_double4 y, simd_long4 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ -static inline SIMD_CFUNC simd_double8 simd_bitselect(simd_double8 x, simd_double8 y, simd_long8 mask); -/*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. - * @discussion Deprecated. Use simd_bitselect instead. */ -#define vector_bitselect simd_bitselect - -#ifdef __cplusplus -} /* extern "C" */ - -namespace simd { - /*! @abstract True if and only if the high-order bit of every lane is set. */ - template static SIMD_CPPFUNC simd_bool all(const inttypeN predicate) { return ::simd_all(predicate); } - /*! @abstract True if and only if the high-order bit of any lane is set. */ - template static SIMD_CPPFUNC simd_bool any(const inttypeN predicate) { return ::simd_any(predicate); } - /*! @abstract Each lane of the result is selected from the corresponding lane - * of x or y according to whether the high-order bit of the corresponding - * lane of mask is 0 or 1, respectively. */ - template static SIMD_CPPFUNC fptypeN select(const fptypeN x, const fptypeN y, const inttypeN predicate) { return ::simd_select(x,y,predicate); } - /*! @abstract For each bit in the result, selects the corresponding bit of x - * or y according to whether the corresponding bit of mask is 0 or 1, - * respectively. */ - template static SIMD_CPPFUNC typeN bitselect(const typeN x, const typeN y, const inttypeN mask) { return ::simd_bitselect(x,y,mask); } -} - -extern "C" { -#endif /* __cplusplus */ - -#pragma mark - Implementations - -static inline SIMD_CFUNC simd_bool simd_any(simd_char2 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x3); -#elif defined __arm64__ - return simd_any(x.xyxy); -#else - union { uint16_t i; simd_char2 v; } u = { .v = x }; - return (u.i & 0x8080); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_char3 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x7); -#elif defined __arm64__ - return simd_any(x.xyzz); -#else - union { uint32_t i; simd_char3 v; } u = { .v = x }; - return (u.i & 0x808080); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_char4 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xf); -#elif defined __arm64__ - return simd_any(x.xyzwxyzw); -#else - union { uint32_t i; simd_char4 v; } u = { .v = x }; - return (u.i & 0x80808080); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_char8 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xff); -#elif defined __arm64__ - return vmaxv_u8(x) & 0x80; -#else - union { uint64_t i; simd_char8 v; } u = { .v = x }; - return (u.i & 0x8080808080808080); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_char16 x) { -#if defined __SSE2__ - return _mm_movemask_epi8(x); -#elif defined __arm64__ - return vmaxvq_u8(x) & 0x80; -#else - return simd_any(x.lo | x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_char32 x) { -#if defined __AVX2__ - return _mm256_movemask_epi8(x); -#else - return simd_any(x.lo | x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_char64 x) { - return simd_any(x.lo | x.hi); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar2 x) { - return simd_any((simd_char2)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar3 x) { - return simd_any((simd_char3)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar4 x) { - return simd_any((simd_char4)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar8 x) { - return simd_any((simd_char8)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar16 x) { - return simd_any((simd_char16)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar32 x) { - return simd_any((simd_char32)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uchar64 x) { - return simd_any((simd_char64)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_short2 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xa); -#elif defined __arm64__ - return simd_any(x.xyxy); -#else - union { uint32_t i; simd_short2 v; } u = { .v = x }; - return (u.i & 0x80008000); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_short3 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0x2a); -#elif defined __arm64__ - return simd_any(x.xyzz); -#else - union { uint64_t i; simd_short3 v; } u = { .v = x }; - return (u.i & 0x800080008000); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_short4 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xaa); -#elif defined __arm64__ - return vmaxv_u16(x) & 0x8000; -#else - union { uint64_t i; simd_short4 v; } u = { .v = x }; - return (u.i & 0x8000800080008000); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_short8 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(x) & 0xaaaa); -#elif defined __arm64__ - return vmaxvq_u16(x) & 0x8000; -#else - return simd_any(x.lo | x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_short16 x) { -#if defined __AVX2__ - return (_mm256_movemask_epi8(x) & 0xaaaaaaaa); -#else - return simd_any(x.lo | x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_short32 x) { - return simd_any(x.lo | x.hi); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort2 x) { - return simd_any((simd_short2)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort3 x) { - return simd_any((simd_short3)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort4 x) { - return simd_any((simd_short4)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort8 x) { - return simd_any((simd_short8)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort16 x) { - return simd_any((simd_short16)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ushort32 x) { - return simd_any((simd_short32)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_int2 x) { -#if defined __SSE2__ - return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x3); -#elif defined __arm64__ - return vmaxv_u32(x) & 0x80000000; -#else - union { uint64_t i; simd_int2 v; } u = { .v = x }; - return (u.i & 0x8000000080000000); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_int3 x) { -#if defined __SSE2__ - return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x7); -#elif defined __arm64__ - return simd_any(x.xyzz); -#else - return (x.x | x.y | x.z) & 0x80000000; -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_int4 x) { -#if defined __SSE2__ - return _mm_movemask_ps(x); -#elif defined __arm64__ - return vmaxvq_u32(x) & 0x80000000; -#else - return simd_any(x.lo | x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_int8 x) { -#if defined __AVX__ - return _mm256_movemask_ps(x); -#else - return simd_any(x.lo | x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_int16 x) { - return simd_any(x.lo | x.hi); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uint2 x) { - return simd_any((simd_int2)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uint3 x) { - return simd_any((simd_int3)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uint4 x) { - return simd_any((simd_int4)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uint8 x) { - return simd_any((simd_int8)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_uint16 x) { - return simd_any((simd_int16)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_long2 x) { -#if defined __SSE2__ - return _mm_movemask_pd(x); -#elif defined __arm64__ - return (x.x | x.y) & 0x8000000000000000U; -#else - return (x.x | x.y) & 0x8000000000000000U; -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_long3 x) { -#if defined __AVX__ - return (_mm256_movemask_pd(simd_make_long4_undef(x)) & 0x7); -#else - return (x.x | x.y | x.z) & 0x8000000000000000U; -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_long4 x) { -#if defined __AVX__ - return _mm256_movemask_pd(x); -#else - return simd_any(x.lo | x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_any(simd_long8 x) { - return simd_any(x.lo | x.hi); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong2 x) { - return simd_any((simd_long2)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong3 x) { - return simd_any((simd_long3)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong4 x) { - return simd_any((simd_long4)x); -} -static inline SIMD_CFUNC simd_bool simd_any(simd_ulong8 x) { - return simd_any((simd_long8)x); -} - -static inline SIMD_CFUNC simd_bool simd_all(simd_char2 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x3) == 0x3; -#elif defined __arm64__ - return simd_all(x.xyxy); -#else - union { uint16_t i; simd_char2 v; } u = { .v = x }; - return (u.i & 0x8080) == 0x8080; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_char3 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0x7) == 0x7; -#elif defined __arm64__ - return simd_all(x.xyzz); -#else - union { uint32_t i; simd_char3 v; } u = { .v = x }; - return (u.i & 0x808080) == 0x808080; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_char4 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xf) == 0xf; -#elif defined __arm64__ - return simd_all(x.xyzwxyzw); -#else - union { uint32_t i; simd_char4 v; } u = { .v = x }; - return (u.i & 0x80808080) == 0x80808080; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_char8 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_char16_undef(x)) & 0xff) == 0xff; -#elif defined __arm64__ - return vminv_u8(x) & 0x80; -#else - union { uint64_t i; simd_char8 v; } u = { .v = x }; - return (u.i & 0x8080808080808080) == 0x8080808080808080; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_char16 x) { -#if defined __SSE2__ - return _mm_movemask_epi8(x) == 0xffff; -#elif defined __arm64__ - return vminvq_u8(x) & 0x80; -#else - return simd_all(x.lo & x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_char32 x) { -#if defined __AVX2__ - return _mm256_movemask_epi8(x) == 0xffffffff; -#else - return simd_all(x.lo & x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_char64 x) { - return simd_all(x.lo & x.hi); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar2 x) { - return simd_all((simd_char2)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar3 x) { - return simd_all((simd_char3)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar4 x) { - return simd_all((simd_char4)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar8 x) { - return simd_all((simd_char8)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar16 x) { - return simd_all((simd_char16)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar32 x) { - return simd_all((simd_char32)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uchar64 x) { - return simd_all((simd_char64)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_short2 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xa) == 0xa; -#elif defined __arm64__ - return simd_all(x.xyxy); -#else - union { uint32_t i; simd_short2 v; } u = { .v = x }; - return (u.i & 0x80008000) == 0x80008000; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_short3 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0x2a) == 0x2a; -#elif defined __arm64__ - return simd_all(x.xyzz); -#else - union { uint64_t i; simd_short3 v; } u = { .v = x }; - return (u.i & 0x800080008000) == 0x800080008000; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_short4 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(simd_make_short8_undef(x)) & 0xaa) == 0xaa; -#elif defined __arm64__ - return vminv_u16(x) & 0x8000; -#else - union { uint64_t i; simd_short4 v; } u = { .v = x }; - return (u.i & 0x8000800080008000) == 0x8000800080008000; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_short8 x) { -#if defined __SSE2__ - return (_mm_movemask_epi8(x) & 0xaaaa) == 0xaaaa; -#elif defined __arm64__ - return vminvq_u16(x) & 0x8000; -#else - return simd_all(x.lo & x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_short16 x) { -#if defined __AVX2__ - return (_mm256_movemask_epi8(x) & 0xaaaaaaaa) == 0xaaaaaaaa; -#else - return simd_all(x.lo & x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_short32 x) { - return simd_all(x.lo & x.hi); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort2 x) { - return simd_all((simd_short2)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort3 x) { - return simd_all((simd_short3)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort4 x) { - return simd_all((simd_short4)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort8 x) { - return simd_all((simd_short8)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort16 x) { - return simd_all((simd_short16)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ushort32 x) { - return simd_all((simd_short32)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_int2 x) { -#if defined __SSE2__ - return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x3) == 0x3; -#elif defined __arm64__ - return vminv_u32(x) & 0x80000000; -#else - union { uint64_t i; simd_int2 v; } u = { .v = x }; - return (u.i & 0x8000000080000000) == 0x8000000080000000; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_int3 x) { -#if defined __SSE2__ - return (_mm_movemask_ps(simd_make_int4_undef(x)) & 0x7) == 0x7; -#elif defined __arm64__ - return simd_all(x.xyzz); -#else - return (x.x & x.y & x.z) & 0x80000000; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_int4 x) { -#if defined __SSE2__ - return _mm_movemask_ps(x) == 0xf; -#elif defined __arm64__ - return vminvq_u32(x) & 0x80000000; -#else - return simd_all(x.lo & x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_int8 x) { -#if defined __AVX__ - return _mm256_movemask_ps(x) == 0xff; -#else - return simd_all(x.lo & x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_int16 x) { - return simd_all(x.lo & x.hi); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uint2 x) { - return simd_all((simd_int2)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uint3 x) { - return simd_all((simd_int3)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uint4 x) { - return simd_all((simd_int4)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uint8 x) { - return simd_all((simd_int8)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_uint16 x) { - return simd_all((simd_int16)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_long2 x) { -#if defined __SSE2__ - return _mm_movemask_pd(x) == 0x3; -#elif defined __arm64__ - return (x.x & x.y) & 0x8000000000000000U; -#else - return (x.x & x.y) & 0x8000000000000000U; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_long3 x) { -#if defined __AVX__ - return (_mm256_movemask_pd(simd_make_long4_undef(x)) & 0x7) == 0x7; -#else - return (x.x & x.y & x.z) & 0x8000000000000000U; -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_long4 x) { -#if defined __AVX__ - return _mm256_movemask_pd(x) == 0xf; -#else - return simd_all(x.lo & x.hi); -#endif -} -static inline SIMD_CFUNC simd_bool simd_all(simd_long8 x) { - return simd_all(x.lo & x.hi); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong2 x) { - return simd_all((simd_long2)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong3 x) { - return simd_all((simd_long3)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong4 x) { - return simd_all((simd_long4)x); -} -static inline SIMD_CFUNC simd_bool simd_all(simd_ulong8 x) { - return simd_all((simd_long8)x); -} - -static inline SIMD_CFUNC simd_float2 simd_select(simd_float2 x, simd_float2 y, simd_int2 mask) { - return simd_make_float2(simd_select(simd_make_float4_undef(x), simd_make_float4_undef(y), simd_make_int4_undef(mask))); -} -static inline SIMD_CFUNC simd_float3 simd_select(simd_float3 x, simd_float3 y, simd_int3 mask) { - return simd_make_float3(simd_select(simd_make_float4_undef(x), simd_make_float4_undef(y), simd_make_int4_undef(mask))); -} -static inline SIMD_CFUNC simd_float4 simd_select(simd_float4 x, simd_float4 y, simd_int4 mask) { -#if defined __SSE4_1__ - return _mm_blendv_ps(x, y, mask); -#else - return simd_bitselect(x, y, mask >> 31); -#endif -} -static inline SIMD_CFUNC simd_float8 simd_select(simd_float8 x, simd_float8 y, simd_int8 mask) { -#if defined __AVX__ - return _mm256_blendv_ps(x, y, mask); -#else - return simd_bitselect(x, y, mask >> 31); -#endif -} -static inline SIMD_CFUNC simd_float16 simd_select(simd_float16 x, simd_float16 y, simd_int16 mask) { - return simd_bitselect(x, y, mask >> 31); -} -static inline SIMD_CFUNC simd_double2 simd_select(simd_double2 x, simd_double2 y, simd_long2 mask) { -#if defined __SSE4_1__ - return _mm_blendv_pd(x, y, mask); -#else - return simd_bitselect(x, y, mask >> 63); -#endif -} -static inline SIMD_CFUNC simd_double3 simd_select(simd_double3 x, simd_double3 y, simd_long3 mask) { - return simd_make_double3(simd_select(simd_make_double4_undef(x), simd_make_double4_undef(y), simd_make_long4_undef(mask))); -} -static inline SIMD_CFUNC simd_double4 simd_select(simd_double4 x, simd_double4 y, simd_long4 mask) { -#if defined __AVX__ - return _mm256_blendv_pd(x, y, mask); -#else - return simd_bitselect(x, y, mask >> 63); -#endif -} -static inline SIMD_CFUNC simd_double8 simd_select(simd_double8 x, simd_double8 y, simd_long8 mask) { - return simd_bitselect(x, y, mask >> 63); -} - -static inline SIMD_CFUNC simd_char2 simd_bitselect(simd_char2 x, simd_char2 y, simd_char2 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_char3 simd_bitselect(simd_char3 x, simd_char3 y, simd_char3 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_char4 simd_bitselect(simd_char4 x, simd_char4 y, simd_char4 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_char8 simd_bitselect(simd_char8 x, simd_char8 y, simd_char8 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_char16 simd_bitselect(simd_char16 x, simd_char16 y, simd_char16 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_char32 simd_bitselect(simd_char32 x, simd_char32 y, simd_char32 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_char64 simd_bitselect(simd_char64 x, simd_char64 y, simd_char64 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_uchar2 simd_bitselect(simd_uchar2 x, simd_uchar2 y, simd_char2 mask) { - return (simd_uchar2)simd_bitselect((simd_char2)x, (simd_char2)y, mask); -} -static inline SIMD_CFUNC simd_uchar3 simd_bitselect(simd_uchar3 x, simd_uchar3 y, simd_char3 mask) { - return (simd_uchar3)simd_bitselect((simd_char3)x, (simd_char3)y, mask); -} -static inline SIMD_CFUNC simd_uchar4 simd_bitselect(simd_uchar4 x, simd_uchar4 y, simd_char4 mask) { - return (simd_uchar4)simd_bitselect((simd_char4)x, (simd_char4)y, mask); -} -static inline SIMD_CFUNC simd_uchar8 simd_bitselect(simd_uchar8 x, simd_uchar8 y, simd_char8 mask) { - return (simd_uchar8)simd_bitselect((simd_char8)x, (simd_char8)y, mask); -} -static inline SIMD_CFUNC simd_uchar16 simd_bitselect(simd_uchar16 x, simd_uchar16 y, simd_char16 mask) { - return (simd_uchar16)simd_bitselect((simd_char16)x, (simd_char16)y, mask); -} -static inline SIMD_CFUNC simd_uchar32 simd_bitselect(simd_uchar32 x, simd_uchar32 y, simd_char32 mask) { - return (simd_uchar32)simd_bitselect((simd_char32)x, (simd_char32)y, mask); -} -static inline SIMD_CFUNC simd_uchar64 simd_bitselect(simd_uchar64 x, simd_uchar64 y, simd_char64 mask) { - return (simd_uchar64)simd_bitselect((simd_char64)x, (simd_char64)y, mask); -} -static inline SIMD_CFUNC simd_short2 simd_bitselect(simd_short2 x, simd_short2 y, simd_short2 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_short3 simd_bitselect(simd_short3 x, simd_short3 y, simd_short3 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_short4 simd_bitselect(simd_short4 x, simd_short4 y, simd_short4 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_short8 simd_bitselect(simd_short8 x, simd_short8 y, simd_short8 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_short16 simd_bitselect(simd_short16 x, simd_short16 y, simd_short16 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_short32 simd_bitselect(simd_short32 x, simd_short32 y, simd_short32 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_ushort2 simd_bitselect(simd_ushort2 x, simd_ushort2 y, simd_short2 mask) { - return (simd_ushort2)simd_bitselect((simd_short2)x, (simd_short2)y, mask); -} -static inline SIMD_CFUNC simd_ushort3 simd_bitselect(simd_ushort3 x, simd_ushort3 y, simd_short3 mask) { - return (simd_ushort3)simd_bitselect((simd_short3)x, (simd_short3)y, mask); -} -static inline SIMD_CFUNC simd_ushort4 simd_bitselect(simd_ushort4 x, simd_ushort4 y, simd_short4 mask) { - return (simd_ushort4)simd_bitselect((simd_short4)x, (simd_short4)y, mask); -} -static inline SIMD_CFUNC simd_ushort8 simd_bitselect(simd_ushort8 x, simd_ushort8 y, simd_short8 mask) { - return (simd_ushort8)simd_bitselect((simd_short8)x, (simd_short8)y, mask); -} -static inline SIMD_CFUNC simd_ushort16 simd_bitselect(simd_ushort16 x, simd_ushort16 y, simd_short16 mask) { - return (simd_ushort16)simd_bitselect((simd_short16)x, (simd_short16)y, mask); -} -static inline SIMD_CFUNC simd_ushort32 simd_bitselect(simd_ushort32 x, simd_ushort32 y, simd_short32 mask) { - return (simd_ushort32)simd_bitselect((simd_short32)x, (simd_short32)y, mask); -} -static inline SIMD_CFUNC simd_int2 simd_bitselect(simd_int2 x, simd_int2 y, simd_int2 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_int3 simd_bitselect(simd_int3 x, simd_int3 y, simd_int3 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_int4 simd_bitselect(simd_int4 x, simd_int4 y, simd_int4 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_int8 simd_bitselect(simd_int8 x, simd_int8 y, simd_int8 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_int16 simd_bitselect(simd_int16 x, simd_int16 y, simd_int16 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_uint2 simd_bitselect(simd_uint2 x, simd_uint2 y, simd_int2 mask) { - return (simd_uint2)simd_bitselect((simd_int2)x, (simd_int2)y, mask); -} -static inline SIMD_CFUNC simd_uint3 simd_bitselect(simd_uint3 x, simd_uint3 y, simd_int3 mask) { - return (simd_uint3)simd_bitselect((simd_int3)x, (simd_int3)y, mask); -} -static inline SIMD_CFUNC simd_uint4 simd_bitselect(simd_uint4 x, simd_uint4 y, simd_int4 mask) { - return (simd_uint4)simd_bitselect((simd_int4)x, (simd_int4)y, mask); -} -static inline SIMD_CFUNC simd_uint8 simd_bitselect(simd_uint8 x, simd_uint8 y, simd_int8 mask) { - return (simd_uint8)simd_bitselect((simd_int8)x, (simd_int8)y, mask); -} -static inline SIMD_CFUNC simd_uint16 simd_bitselect(simd_uint16 x, simd_uint16 y, simd_int16 mask) { - return (simd_uint16)simd_bitselect((simd_int16)x, (simd_int16)y, mask); -} -static inline SIMD_CFUNC simd_float2 simd_bitselect(simd_float2 x, simd_float2 y, simd_int2 mask) { - return (simd_float2)simd_bitselect((simd_int2)x, (simd_int2)y, mask); -} -static inline SIMD_CFUNC simd_float3 simd_bitselect(simd_float3 x, simd_float3 y, simd_int3 mask) { - return (simd_float3)simd_bitselect((simd_int3)x, (simd_int3)y, mask); -} -static inline SIMD_CFUNC simd_float4 simd_bitselect(simd_float4 x, simd_float4 y, simd_int4 mask) { - return (simd_float4)simd_bitselect((simd_int4)x, (simd_int4)y, mask); -} -static inline SIMD_CFUNC simd_float8 simd_bitselect(simd_float8 x, simd_float8 y, simd_int8 mask) { - return (simd_float8)simd_bitselect((simd_int8)x, (simd_int8)y, mask); -} -static inline SIMD_CFUNC simd_float16 simd_bitselect(simd_float16 x, simd_float16 y, simd_int16 mask) { - return (simd_float16)simd_bitselect((simd_int16)x, (simd_int16)y, mask); -} -static inline SIMD_CFUNC simd_long2 simd_bitselect(simd_long2 x, simd_long2 y, simd_long2 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_long3 simd_bitselect(simd_long3 x, simd_long3 y, simd_long3 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_long4 simd_bitselect(simd_long4 x, simd_long4 y, simd_long4 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_long8 simd_bitselect(simd_long8 x, simd_long8 y, simd_long8 mask) { - return (x & ~mask) | (y & mask); -} -static inline SIMD_CFUNC simd_ulong2 simd_bitselect(simd_ulong2 x, simd_ulong2 y, simd_long2 mask) { - return (simd_ulong2)simd_bitselect((simd_long2)x, (simd_long2)y, mask); -} -static inline SIMD_CFUNC simd_ulong3 simd_bitselect(simd_ulong3 x, simd_ulong3 y, simd_long3 mask) { - return (simd_ulong3)simd_bitselect((simd_long3)x, (simd_long3)y, mask); -} -static inline SIMD_CFUNC simd_ulong4 simd_bitselect(simd_ulong4 x, simd_ulong4 y, simd_long4 mask) { - return (simd_ulong4)simd_bitselect((simd_long4)x, (simd_long4)y, mask); -} -static inline SIMD_CFUNC simd_ulong8 simd_bitselect(simd_ulong8 x, simd_ulong8 y, simd_long8 mask) { - return (simd_ulong8)simd_bitselect((simd_long8)x, (simd_long8)y, mask); -} -static inline SIMD_CFUNC simd_double2 simd_bitselect(simd_double2 x, simd_double2 y, simd_long2 mask) { - return (simd_double2)simd_bitselect((simd_long2)x, (simd_long2)y, mask); -} -static inline SIMD_CFUNC simd_double3 simd_bitselect(simd_double3 x, simd_double3 y, simd_long3 mask) { - return (simd_double3)simd_bitselect((simd_long3)x, (simd_long3)y, mask); -} -static inline SIMD_CFUNC simd_double4 simd_bitselect(simd_double4 x, simd_double4 y, simd_long4 mask) { - return (simd_double4)simd_bitselect((simd_long4)x, (simd_long4)y, mask); -} -static inline SIMD_CFUNC simd_double8 simd_bitselect(simd_double8 x, simd_double8 y, simd_long8 mask) { - return (simd_double8)simd_bitselect((simd_long8)x, (simd_long8)y, mask); -} - -#ifdef __cplusplus -} -#endif -#endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */ -#endif /* __SIMD_LOGIC_HEADER__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/matrix.h b/lib/libc/include/x86_64-macos.10-none/simd/matrix.h deleted file mode 100644 index a62384e133..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/matrix.h +++ /dev/null @@ -1,1786 +0,0 @@ -/* Copyright (c) 2014-2017 Apple, Inc. All rights reserved. - * - * Function Result - * ------------------------------------------------------------------ - * - * simd_diagonal_matrix(x) A square matrix with the vector x - * as its diagonal. - * - * simd_matrix(c0, c1, ... ) A matrix with the specified vectors - * as columns. - * - * simd_matrix_from_rows(r0, r1, ... ) A matrix with the specified vectors - * as rows. - * - * simd_mul(a,x) Scalar product a*x. - * - * simd_linear_combination(a,x,b,y) a*x + b*y. - * - * simd_add(x,y) Macro wrapping linear_combination - * to compute x + y. - * - * simd_sub(x,y) Macro wrapping linear_combination - * to compute x - y. - * - * simd_transpose(x) Transpose of the matrix x. - * - * simd_inverse(x) Inverse of x if x is non-singular. If - * x is singular, the result is undefined. - * - * simd_mul(x,y) If x is a matrix, returns the matrix - * product x*y, where y is either a matrix - * or a column vector. If x is a vector, - * returns the product x*y where x is - * interpreted as a row vector. - * - * simd_equal(x,y) Returns true if and only if every - * element of x is exactly equal to the - * corresponding element of y. - * - * simd_almost_equal_elements(x,y,tol) - * Returns true if and only if for each - * entry xij in x, the corresponding - * element yij in y satisfies - * |xij - yij| <= tol. - * - * simd_almost_equal_elements_relative(x,y,tol) - * Returns true if and only if for each - * entry xij in x, the corresponding - * element yij in y satisfies - * |xij - yij| <= tol*|xij|. - * - * The header also defines a few useful global matrix objects: - * matrix_identity_floatNxM and matrix_identity_doubleNxM, may be used to get - * an identity matrix of the specified size. - * - * In C++, we are able to use namespacing to make the functions more concise; - * we also overload some common arithmetic operators to work with the matrix - * types: - * - * C++ Function Equivalent C Function - * -------------------------------------------------------------------- - * simd::inverse simd_inverse - * simd::transpose simd_transpose - * operator+ simd_add - * operator- simd_sub - * operator+= N/A - * operator-= N/A - * operator* simd_mul or simd_mul - * operator*= simd_mul or simd_mul - * operator== simd_equal - * operator!= !simd_equal - * simd::almost_equal_elements simd_almost_equal_elements - * simd::almost_equal_elements_relative simd_almost_equal_elements_relative - * - * provides constructors for C++ matrix types. - */ - -#ifndef SIMD_MATRIX_HEADER -#define SIMD_MATRIX_HEADER - -#include -#if SIMD_COMPILER_HAS_REQUIRED_FEATURES -#include -#include -#include -#include - -#ifdef __cplusplus - extern "C" { -#endif - -extern const simd_float2x2 matrix_identity_float2x2 __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -extern const simd_float3x3 matrix_identity_float3x3 __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -extern const simd_float4x4 matrix_identity_float4x4 __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -extern const simd_double2x2 matrix_identity_double2x2 __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -extern const simd_double3x3 matrix_identity_double3x3 __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -extern const simd_double4x4 matrix_identity_double4x4 __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); - -static simd_float2x2 SIMD_CFUNC simd_diagonal_matrix(simd_float2 __x); -static simd_float3x3 SIMD_CFUNC simd_diagonal_matrix(simd_float3 __x); -static simd_float4x4 SIMD_CFUNC simd_diagonal_matrix(simd_float4 __x); -static simd_double2x2 SIMD_CFUNC simd_diagonal_matrix(simd_double2 __x); -static simd_double3x3 SIMD_CFUNC simd_diagonal_matrix(simd_double3 __x); -static simd_double4x4 SIMD_CFUNC simd_diagonal_matrix(simd_double4 __x); -#define matrix_from_diagonal simd_diagonal_matrix - -static simd_float2x2 SIMD_CFUNC simd_matrix(simd_float2 col0, simd_float2 col1); -static simd_float3x2 SIMD_CFUNC simd_matrix(simd_float2 col0, simd_float2 col1, simd_float2 col2); -static simd_float4x2 SIMD_CFUNC simd_matrix(simd_float2 col0, simd_float2 col1, simd_float2 col2, simd_float2 col3); -static simd_float2x3 SIMD_CFUNC simd_matrix(simd_float3 col0, simd_float3 col1); -static simd_float3x3 SIMD_CFUNC simd_matrix(simd_float3 col0, simd_float3 col1, simd_float3 col2); -static simd_float4x3 SIMD_CFUNC simd_matrix(simd_float3 col0, simd_float3 col1, simd_float3 col2, simd_float3 col3); -static simd_float2x4 SIMD_CFUNC simd_matrix(simd_float4 col0, simd_float4 col1); -static simd_float3x4 SIMD_CFUNC simd_matrix(simd_float4 col0, simd_float4 col1, simd_float4 col2); -static simd_float4x4 SIMD_CFUNC simd_matrix(simd_float4 col0, simd_float4 col1, simd_float4 col2, simd_float4 col3); -static simd_double2x2 SIMD_CFUNC simd_matrix(simd_double2 col0, simd_double2 col1); -static simd_double3x2 SIMD_CFUNC simd_matrix(simd_double2 col0, simd_double2 col1, simd_double2 col2); -static simd_double4x2 SIMD_CFUNC simd_matrix(simd_double2 col0, simd_double2 col1, simd_double2 col2, simd_double2 col3); -static simd_double2x3 SIMD_CFUNC simd_matrix(simd_double3 col0, simd_double3 col1); -static simd_double3x3 SIMD_CFUNC simd_matrix(simd_double3 col0, simd_double3 col1, simd_double3 col2); -static simd_double4x3 SIMD_CFUNC simd_matrix(simd_double3 col0, simd_double3 col1, simd_double3 col2, simd_double3 col3); -static simd_double2x4 SIMD_CFUNC simd_matrix(simd_double4 col0, simd_double4 col1); -static simd_double3x4 SIMD_CFUNC simd_matrix(simd_double4 col0, simd_double4 col1, simd_double4 col2); -static simd_double4x4 SIMD_CFUNC simd_matrix(simd_double4 col0, simd_double4 col1, simd_double4 col2, simd_double4 col3); -#define matrix_from_columns simd_matrix - -static simd_float2x2 SIMD_CFUNC simd_matrix_from_rows(simd_float2 row0, simd_float2 row1); -static simd_float2x3 SIMD_CFUNC simd_matrix_from_rows(simd_float2 row0, simd_float2 row1, simd_float2 row2); -static simd_float2x4 SIMD_CFUNC simd_matrix_from_rows(simd_float2 row0, simd_float2 row1, simd_float2 row2, simd_float2 row3); -static simd_float3x2 SIMD_CFUNC simd_matrix_from_rows(simd_float3 row0, simd_float3 row1); -static simd_float3x3 SIMD_CFUNC simd_matrix_from_rows(simd_float3 row0, simd_float3 row1, simd_float3 row2); -static simd_float3x4 SIMD_CFUNC simd_matrix_from_rows(simd_float3 row0, simd_float3 row1, simd_float3 row2, simd_float3 row3); -static simd_float4x2 SIMD_CFUNC simd_matrix_from_rows(simd_float4 row0, simd_float4 row1); -static simd_float4x3 SIMD_CFUNC simd_matrix_from_rows(simd_float4 row0, simd_float4 row1, simd_float4 row2); -static simd_float4x4 SIMD_CFUNC simd_matrix_from_rows(simd_float4 row0, simd_float4 row1, simd_float4 row2, simd_float4 row3); -static simd_double2x2 SIMD_CFUNC simd_matrix_from_rows(simd_double2 row0, simd_double2 row1); -static simd_double2x3 SIMD_CFUNC simd_matrix_from_rows(simd_double2 row0, simd_double2 row1, simd_double2 row2); -static simd_double2x4 SIMD_CFUNC simd_matrix_from_rows(simd_double2 row0, simd_double2 row1, simd_double2 row2, simd_double2 row3); -static simd_double3x2 SIMD_CFUNC simd_matrix_from_rows(simd_double3 row0, simd_double3 row1); -static simd_double3x3 SIMD_CFUNC simd_matrix_from_rows(simd_double3 row0, simd_double3 row1, simd_double3 row2); -static simd_double3x4 SIMD_CFUNC simd_matrix_from_rows(simd_double3 row0, simd_double3 row1, simd_double3 row2, simd_double3 row3); -static simd_double4x2 SIMD_CFUNC simd_matrix_from_rows(simd_double4 row0, simd_double4 row1); -static simd_double4x3 SIMD_CFUNC simd_matrix_from_rows(simd_double4 row0, simd_double4 row1, simd_double4 row2); -static simd_double4x4 SIMD_CFUNC simd_matrix_from_rows(simd_double4 row0, simd_double4 row1, simd_double4 row2, simd_double4 row3); -#define matrix_from_rows simd_matrix_from_rows - -static simd_float3x3 SIMD_NOINLINE simd_matrix3x3(simd_quatf q); -static simd_float4x4 SIMD_NOINLINE simd_matrix4x4(simd_quatf q); -static simd_double3x3 SIMD_NOINLINE simd_matrix3x3(simd_quatd q); -static simd_double4x4 SIMD_NOINLINE simd_matrix4x4(simd_quatd q); - -static simd_float2x2 SIMD_CFUNC simd_mul(float __a, simd_float2x2 __x); -static simd_float3x2 SIMD_CFUNC simd_mul(float __a, simd_float3x2 __x); -static simd_float4x2 SIMD_CFUNC simd_mul(float __a, simd_float4x2 __x); -static simd_float2x3 SIMD_CFUNC simd_mul(float __a, simd_float2x3 __x); -static simd_float3x3 SIMD_CFUNC simd_mul(float __a, simd_float3x3 __x); -static simd_float4x3 SIMD_CFUNC simd_mul(float __a, simd_float4x3 __x); -static simd_float2x4 SIMD_CFUNC simd_mul(float __a, simd_float2x4 __x); -static simd_float3x4 SIMD_CFUNC simd_mul(float __a, simd_float3x4 __x); -static simd_float4x4 SIMD_CFUNC simd_mul(float __a, simd_float4x4 __x); -static simd_double2x2 SIMD_CFUNC simd_mul(double __a, simd_double2x2 __x); -static simd_double3x2 SIMD_CFUNC simd_mul(double __a, simd_double3x2 __x); -static simd_double4x2 SIMD_CFUNC simd_mul(double __a, simd_double4x2 __x); -static simd_double2x3 SIMD_CFUNC simd_mul(double __a, simd_double2x3 __x); -static simd_double3x3 SIMD_CFUNC simd_mul(double __a, simd_double3x3 __x); -static simd_double4x3 SIMD_CFUNC simd_mul(double __a, simd_double4x3 __x); -static simd_double2x4 SIMD_CFUNC simd_mul(double __a, simd_double2x4 __x); -static simd_double3x4 SIMD_CFUNC simd_mul(double __a, simd_double3x4 __x); -static simd_double4x4 SIMD_CFUNC simd_mul(double __a, simd_double4x4 __x); - -static simd_float2x2 SIMD_CFUNC simd_linear_combination(float __a, simd_float2x2 __x, float __b, simd_float2x2 __y); -static simd_float3x2 SIMD_CFUNC simd_linear_combination(float __a, simd_float3x2 __x, float __b, simd_float3x2 __y); -static simd_float4x2 SIMD_CFUNC simd_linear_combination(float __a, simd_float4x2 __x, float __b, simd_float4x2 __y); -static simd_float2x3 SIMD_CFUNC simd_linear_combination(float __a, simd_float2x3 __x, float __b, simd_float2x3 __y); -static simd_float3x3 SIMD_CFUNC simd_linear_combination(float __a, simd_float3x3 __x, float __b, simd_float3x3 __y); -static simd_float4x3 SIMD_CFUNC simd_linear_combination(float __a, simd_float4x3 __x, float __b, simd_float4x3 __y); -static simd_float2x4 SIMD_CFUNC simd_linear_combination(float __a, simd_float2x4 __x, float __b, simd_float2x4 __y); -static simd_float3x4 SIMD_CFUNC simd_linear_combination(float __a, simd_float3x4 __x, float __b, simd_float3x4 __y); -static simd_float4x4 SIMD_CFUNC simd_linear_combination(float __a, simd_float4x4 __x, float __b, simd_float4x4 __y); -static simd_double2x2 SIMD_CFUNC simd_linear_combination(double __a, simd_double2x2 __x, double __b, simd_double2x2 __y); -static simd_double3x2 SIMD_CFUNC simd_linear_combination(double __a, simd_double3x2 __x, double __b, simd_double3x2 __y); -static simd_double4x2 SIMD_CFUNC simd_linear_combination(double __a, simd_double4x2 __x, double __b, simd_double4x2 __y); -static simd_double2x3 SIMD_CFUNC simd_linear_combination(double __a, simd_double2x3 __x, double __b, simd_double2x3 __y); -static simd_double3x3 SIMD_CFUNC simd_linear_combination(double __a, simd_double3x3 __x, double __b, simd_double3x3 __y); -static simd_double4x3 SIMD_CFUNC simd_linear_combination(double __a, simd_double4x3 __x, double __b, simd_double4x3 __y); -static simd_double2x4 SIMD_CFUNC simd_linear_combination(double __a, simd_double2x4 __x, double __b, simd_double2x4 __y); -static simd_double3x4 SIMD_CFUNC simd_linear_combination(double __a, simd_double3x4 __x, double __b, simd_double3x4 __y); -static simd_double4x4 SIMD_CFUNC simd_linear_combination(double __a, simd_double4x4 __x, double __b, simd_double4x4 __y); -#define matrix_linear_combination simd_linear_combination - -static simd_float2x2 SIMD_CFUNC simd_add(simd_float2x2 __x, simd_float2x2 __y); -static simd_float3x2 SIMD_CFUNC simd_add(simd_float3x2 __x, simd_float3x2 __y); -static simd_float4x2 SIMD_CFUNC simd_add(simd_float4x2 __x, simd_float4x2 __y); -static simd_float2x3 SIMD_CFUNC simd_add(simd_float2x3 __x, simd_float2x3 __y); -static simd_float3x3 SIMD_CFUNC simd_add(simd_float3x3 __x, simd_float3x3 __y); -static simd_float4x3 SIMD_CFUNC simd_add(simd_float4x3 __x, simd_float4x3 __y); -static simd_float2x4 SIMD_CFUNC simd_add(simd_float2x4 __x, simd_float2x4 __y); -static simd_float3x4 SIMD_CFUNC simd_add(simd_float3x4 __x, simd_float3x4 __y); -static simd_float4x4 SIMD_CFUNC simd_add(simd_float4x4 __x, simd_float4x4 __y); -static simd_double2x2 SIMD_CFUNC simd_add(simd_double2x2 __x, simd_double2x2 __y); -static simd_double3x2 SIMD_CFUNC simd_add(simd_double3x2 __x, simd_double3x2 __y); -static simd_double4x2 SIMD_CFUNC simd_add(simd_double4x2 __x, simd_double4x2 __y); -static simd_double2x3 SIMD_CFUNC simd_add(simd_double2x3 __x, simd_double2x3 __y); -static simd_double3x3 SIMD_CFUNC simd_add(simd_double3x3 __x, simd_double3x3 __y); -static simd_double4x3 SIMD_CFUNC simd_add(simd_double4x3 __x, simd_double4x3 __y); -static simd_double2x4 SIMD_CFUNC simd_add(simd_double2x4 __x, simd_double2x4 __y); -static simd_double3x4 SIMD_CFUNC simd_add(simd_double3x4 __x, simd_double3x4 __y); -static simd_double4x4 SIMD_CFUNC simd_add(simd_double4x4 __x, simd_double4x4 __y); -#define matrix_add simd_add - -static simd_float2x2 SIMD_CFUNC simd_sub(simd_float2x2 __x, simd_float2x2 __y); -static simd_float3x2 SIMD_CFUNC simd_sub(simd_float3x2 __x, simd_float3x2 __y); -static simd_float4x2 SIMD_CFUNC simd_sub(simd_float4x2 __x, simd_float4x2 __y); -static simd_float2x3 SIMD_CFUNC simd_sub(simd_float2x3 __x, simd_float2x3 __y); -static simd_float3x3 SIMD_CFUNC simd_sub(simd_float3x3 __x, simd_float3x3 __y); -static simd_float4x3 SIMD_CFUNC simd_sub(simd_float4x3 __x, simd_float4x3 __y); -static simd_float2x4 SIMD_CFUNC simd_sub(simd_float2x4 __x, simd_float2x4 __y); -static simd_float3x4 SIMD_CFUNC simd_sub(simd_float3x4 __x, simd_float3x4 __y); -static simd_float4x4 SIMD_CFUNC simd_sub(simd_float4x4 __x, simd_float4x4 __y); -static simd_double2x2 SIMD_CFUNC simd_sub(simd_double2x2 __x, simd_double2x2 __y); -static simd_double3x2 SIMD_CFUNC simd_sub(simd_double3x2 __x, simd_double3x2 __y); -static simd_double4x2 SIMD_CFUNC simd_sub(simd_double4x2 __x, simd_double4x2 __y); -static simd_double2x3 SIMD_CFUNC simd_sub(simd_double2x3 __x, simd_double2x3 __y); -static simd_double3x3 SIMD_CFUNC simd_sub(simd_double3x3 __x, simd_double3x3 __y); -static simd_double4x3 SIMD_CFUNC simd_sub(simd_double4x3 __x, simd_double4x3 __y); -static simd_double2x4 SIMD_CFUNC simd_sub(simd_double2x4 __x, simd_double2x4 __y); -static simd_double3x4 SIMD_CFUNC simd_sub(simd_double3x4 __x, simd_double3x4 __y); -static simd_double4x4 SIMD_CFUNC simd_sub(simd_double4x4 __x, simd_double4x4 __y); -#define matrix_sub simd_sub - -static simd_float2x2 SIMD_CFUNC simd_transpose(simd_float2x2 __x); -static simd_float2x3 SIMD_CFUNC simd_transpose(simd_float3x2 __x); -static simd_float2x4 SIMD_CFUNC simd_transpose(simd_float4x2 __x); -static simd_float3x2 SIMD_CFUNC simd_transpose(simd_float2x3 __x); -static simd_float3x3 SIMD_CFUNC simd_transpose(simd_float3x3 __x); -static simd_float3x4 SIMD_CFUNC simd_transpose(simd_float4x3 __x); -static simd_float4x2 SIMD_CFUNC simd_transpose(simd_float2x4 __x); -static simd_float4x3 SIMD_CFUNC simd_transpose(simd_float3x4 __x); -static simd_float4x4 SIMD_CFUNC simd_transpose(simd_float4x4 __x); -static simd_double2x2 SIMD_CFUNC simd_transpose(simd_double2x2 __x); -static simd_double2x3 SIMD_CFUNC simd_transpose(simd_double3x2 __x); -static simd_double2x4 SIMD_CFUNC simd_transpose(simd_double4x2 __x); -static simd_double3x2 SIMD_CFUNC simd_transpose(simd_double2x3 __x); -static simd_double3x3 SIMD_CFUNC simd_transpose(simd_double3x3 __x); -static simd_double3x4 SIMD_CFUNC simd_transpose(simd_double4x3 __x); -static simd_double4x2 SIMD_CFUNC simd_transpose(simd_double2x4 __x); -static simd_double4x3 SIMD_CFUNC simd_transpose(simd_double3x4 __x); -static simd_double4x4 SIMD_CFUNC simd_transpose(simd_double4x4 __x); -#define matrix_transpose simd_transpose - -static float SIMD_CFUNC simd_determinant(simd_float2x2 __x); -static float SIMD_CFUNC simd_determinant(simd_float3x3 __x); -static float SIMD_CFUNC simd_determinant(simd_float4x4 __x); -static double SIMD_CFUNC simd_determinant(simd_double2x2 __x); -static double SIMD_CFUNC simd_determinant(simd_double3x3 __x); -static double SIMD_CFUNC simd_determinant(simd_double4x4 __x); -#define matrix_determinant simd_determinant - -static simd_float2x2 SIMD_CFUNC simd_inverse(simd_float2x2 __x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -static simd_float3x3 SIMD_CFUNC simd_inverse(simd_float3x3 __x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -static simd_float4x4 SIMD_CFUNC simd_inverse(simd_float4x4 __x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -static simd_double2x2 SIMD_CFUNC simd_inverse(simd_double2x2 __x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -static simd_double3x3 SIMD_CFUNC simd_inverse(simd_double3x3 __x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -static simd_double4x4 SIMD_CFUNC simd_inverse(simd_double4x4 __x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)); -#define matrix_invert simd_inverse - -static simd_float2 SIMD_CFUNC simd_mul(simd_float2x2 __x, simd_float2 __y); -static simd_float2 SIMD_CFUNC simd_mul(simd_float3x2 __x, simd_float3 __y); -static simd_float2 SIMD_CFUNC simd_mul(simd_float4x2 __x, simd_float4 __y); -static simd_float3 SIMD_CFUNC simd_mul(simd_float2x3 __x, simd_float2 __y); -static simd_float3 SIMD_CFUNC simd_mul(simd_float3x3 __x, simd_float3 __y); -static simd_float3 SIMD_CFUNC simd_mul(simd_float4x3 __x, simd_float4 __y); -static simd_float4 SIMD_CFUNC simd_mul(simd_float2x4 __x, simd_float2 __y); -static simd_float4 SIMD_CFUNC simd_mul(simd_float3x4 __x, simd_float3 __y); -static simd_float4 SIMD_CFUNC simd_mul(simd_float4x4 __x, simd_float4 __y); -static simd_double2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double2 __y); -static simd_double2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double3 __y); -static simd_double2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double4 __y); -static simd_double3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double2 __y); -static simd_double3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double3 __y); -static simd_double3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double4 __y); -static simd_double4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double2 __y); -static simd_double4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double3 __y); -static simd_double4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double4 __y); -static simd_float2 SIMD_CFUNC simd_mul(simd_float2 __x, simd_float2x2 __y); -static simd_float3 SIMD_CFUNC simd_mul(simd_float2 __x, simd_float3x2 __y); -static simd_float4 SIMD_CFUNC simd_mul(simd_float2 __x, simd_float4x2 __y); -static simd_float2 SIMD_CFUNC simd_mul(simd_float3 __x, simd_float2x3 __y); -static simd_float3 SIMD_CFUNC simd_mul(simd_float3 __x, simd_float3x3 __y); -static simd_float4 SIMD_CFUNC simd_mul(simd_float3 __x, simd_float4x3 __y); -static simd_float2 SIMD_CFUNC simd_mul(simd_float4 __x, simd_float2x4 __y); -static simd_float3 SIMD_CFUNC simd_mul(simd_float4 __x, simd_float3x4 __y); -static simd_float4 SIMD_CFUNC simd_mul(simd_float4 __x, simd_float4x4 __y); -static simd_double2 SIMD_CFUNC simd_mul(simd_double2 __x, simd_double2x2 __y); -static simd_double3 SIMD_CFUNC simd_mul(simd_double2 __x, simd_double3x2 __y); -static simd_double4 SIMD_CFUNC simd_mul(simd_double2 __x, simd_double4x2 __y); -static simd_double2 SIMD_CFUNC simd_mul(simd_double3 __x, simd_double2x3 __y); -static simd_double3 SIMD_CFUNC simd_mul(simd_double3 __x, simd_double3x3 __y); -static simd_double4 SIMD_CFUNC simd_mul(simd_double3 __x, simd_double4x3 __y); -static simd_double2 SIMD_CFUNC simd_mul(simd_double4 __x, simd_double2x4 __y); -static simd_double3 SIMD_CFUNC simd_mul(simd_double4 __x, simd_double3x4 __y); -static simd_double4 SIMD_CFUNC simd_mul(simd_double4 __x, simd_double4x4 __y); -static simd_float2x2 SIMD_CFUNC simd_mul(simd_float2x2 __x, simd_float2x2 __y); -static simd_float3x2 SIMD_CFUNC simd_mul(simd_float2x2 __x, simd_float3x2 __y); -static simd_float4x2 SIMD_CFUNC simd_mul(simd_float2x2 __x, simd_float4x2 __y); -static simd_float2x3 SIMD_CFUNC simd_mul(simd_float2x3 __x, simd_float2x2 __y); -static simd_float3x3 SIMD_CFUNC simd_mul(simd_float2x3 __x, simd_float3x2 __y); -static simd_float4x3 SIMD_CFUNC simd_mul(simd_float2x3 __x, simd_float4x2 __y); -static simd_float2x4 SIMD_CFUNC simd_mul(simd_float2x4 __x, simd_float2x2 __y); -static simd_float3x4 SIMD_CFUNC simd_mul(simd_float2x4 __x, simd_float3x2 __y); -static simd_float4x4 SIMD_CFUNC simd_mul(simd_float2x4 __x, simd_float4x2 __y); -static simd_double2x2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double2x2 __y); -static simd_double3x2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double3x2 __y); -static simd_double4x2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double4x2 __y); -static simd_double2x3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double2x2 __y); -static simd_double3x3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double3x2 __y); -static simd_double4x3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double4x2 __y); -static simd_double2x4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double2x2 __y); -static simd_double3x4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double3x2 __y); -static simd_double4x4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double4x2 __y); -static simd_float2x2 SIMD_CFUNC simd_mul(simd_float3x2 __x, simd_float2x3 __y); -static simd_float3x2 SIMD_CFUNC simd_mul(simd_float3x2 __x, simd_float3x3 __y); -static simd_float4x2 SIMD_CFUNC simd_mul(simd_float3x2 __x, simd_float4x3 __y); -static simd_float2x3 SIMD_CFUNC simd_mul(simd_float3x3 __x, simd_float2x3 __y); -static simd_float3x3 SIMD_CFUNC simd_mul(simd_float3x3 __x, simd_float3x3 __y); -static simd_float4x3 SIMD_CFUNC simd_mul(simd_float3x3 __x, simd_float4x3 __y); -static simd_float2x4 SIMD_CFUNC simd_mul(simd_float3x4 __x, simd_float2x3 __y); -static simd_float3x4 SIMD_CFUNC simd_mul(simd_float3x4 __x, simd_float3x3 __y); -static simd_float4x4 SIMD_CFUNC simd_mul(simd_float3x4 __x, simd_float4x3 __y); -static simd_double2x2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double2x3 __y); -static simd_double3x2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double3x3 __y); -static simd_double4x2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double4x3 __y); -static simd_double2x3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double2x3 __y); -static simd_double3x3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double3x3 __y); -static simd_double4x3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double4x3 __y); -static simd_double2x4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double2x3 __y); -static simd_double3x4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double3x3 __y); -static simd_double4x4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double4x3 __y); -static simd_float2x2 SIMD_CFUNC simd_mul(simd_float4x2 __x, simd_float2x4 __y); -static simd_float3x2 SIMD_CFUNC simd_mul(simd_float4x2 __x, simd_float3x4 __y); -static simd_float4x2 SIMD_CFUNC simd_mul(simd_float4x2 __x, simd_float4x4 __y); -static simd_float2x3 SIMD_CFUNC simd_mul(simd_float4x3 __x, simd_float2x4 __y); -static simd_float3x3 SIMD_CFUNC simd_mul(simd_float4x3 __x, simd_float3x4 __y); -static simd_float4x3 SIMD_CFUNC simd_mul(simd_float4x3 __x, simd_float4x4 __y); -static simd_float2x4 SIMD_CFUNC simd_mul(simd_float4x4 __x, simd_float2x4 __y); -static simd_float3x4 SIMD_CFUNC simd_mul(simd_float4x4 __x, simd_float3x4 __y); -static simd_float4x4 SIMD_CFUNC simd_mul(simd_float4x4 __x, simd_float4x4 __y); -static simd_double2x2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double2x4 __y); -static simd_double3x2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double3x4 __y); -static simd_double4x2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double4x4 __y); -static simd_double2x3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double2x4 __y); -static simd_double3x3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double3x4 __y); -static simd_double4x3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double4x4 __y); -static simd_double2x4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double2x4 __y); -static simd_double3x4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double3x4 __y); -static simd_double4x4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double4x4 __y); - -static simd_bool SIMD_CFUNC simd_equal(simd_float2x2 __x, simd_float2x2 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float2x3 __x, simd_float2x3 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float2x4 __x, simd_float2x4 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float3x2 __x, simd_float3x2 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float3x3 __x, simd_float3x3 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float3x4 __x, simd_float3x4 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float4x2 __x, simd_float4x2 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float4x3 __x, simd_float4x3 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_float4x4 __x, simd_float4x4 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double2x2 __x, simd_double2x2 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double2x3 __x, simd_double2x3 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double2x4 __x, simd_double2x4 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double3x2 __x, simd_double3x2 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double3x3 __x, simd_double3x3 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double3x4 __x, simd_double3x4 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double4x2 __x, simd_double4x2 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double4x3 __x, simd_double4x3 __y); -static simd_bool SIMD_CFUNC simd_equal(simd_double4x4 __x, simd_double4x4 __y); -#define matrix_equal simd_equal - -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float2x2 __x, simd_float2x2 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float2x3 __x, simd_float2x3 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float2x4 __x, simd_float2x4 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float3x2 __x, simd_float3x2 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float3x3 __x, simd_float3x3 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float3x4 __x, simd_float3x4 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float4x2 __x, simd_float4x2 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float4x3 __x, simd_float4x3 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float4x4 __x, simd_float4x4 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double2x2 __x, simd_double2x2 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double2x3 __x, simd_double2x3 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double2x4 __x, simd_double2x4 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double3x2 __x, simd_double3x2 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double3x3 __x, simd_double3x3 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double3x4 __x, simd_double3x4 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double4x2 __x, simd_double4x2 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double4x3 __x, simd_double4x3 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double4x4 __x, simd_double4x4 __y, double __tol); -#define matrix_almost_equal_elements simd_almost_equal_elements - -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float2x2 __x, simd_float2x2 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float2x3 __x, simd_float2x3 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float2x4 __x, simd_float2x4 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float3x2 __x, simd_float3x2 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float3x3 __x, simd_float3x3 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float3x4 __x, simd_float3x4 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float4x2 __x, simd_float4x2 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float4x3 __x, simd_float4x3 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float4x4 __x, simd_float4x4 __y, float __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double2x2 __x, simd_double2x2 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double2x3 __x, simd_double2x3 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double2x4 __x, simd_double2x4 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double3x2 __x, simd_double3x2 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double3x3 __x, simd_double3x3 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double3x4 __x, simd_double3x4 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double4x2 __x, simd_double4x2 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double4x3 __x, simd_double4x3 __y, double __tol); -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double4x4 __x, simd_double4x4 __y, double __tol); -#define matrix_almost_equal_elements_relative simd_almost_equal_elements_relative - -#ifdef __cplusplus -} /* extern "C" */ - -namespace simd { - static SIMD_CPPFUNC float2x2 operator+(const float2x2 x, const float2x2 y) { return float2x2(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float2x3 operator+(const float2x3 x, const float2x3 y) { return float2x3(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float2x4 operator+(const float2x4 x, const float2x4 y) { return float2x4(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float3x2 operator+(const float3x2 x, const float3x2 y) { return float3x2(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float3x3 operator+(const float3x3 x, const float3x3 y) { return float3x3(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float3x4 operator+(const float3x4 x, const float3x4 y) { return float3x4(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float4x2 operator+(const float4x2 x, const float4x2 y) { return float4x2(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float4x3 operator+(const float4x3 x, const float4x3 y) { return float4x3(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC float4x4 operator+(const float4x4 x, const float4x4 y) { return float4x4(::simd_linear_combination(1, x, 1, y)); } - - static SIMD_CPPFUNC float2x2 operator-(const float2x2 x, const float2x2 y) { return float2x2(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float2x3 operator-(const float2x3 x, const float2x3 y) { return float2x3(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float2x4 operator-(const float2x4 x, const float2x4 y) { return float2x4(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float3x2 operator-(const float3x2 x, const float3x2 y) { return float3x2(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float3x3 operator-(const float3x3 x, const float3x3 y) { return float3x3(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float3x4 operator-(const float3x4 x, const float3x4 y) { return float3x4(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float4x2 operator-(const float4x2 x, const float4x2 y) { return float4x2(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float4x3 operator-(const float4x3 x, const float4x3 y) { return float4x3(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC float4x4 operator-(const float4x4 x, const float4x4 y) { return float4x4(::simd_linear_combination(1, x, -1, y)); } - - static SIMD_CPPFUNC float2x2& operator+=(float2x2& x, const float2x2 y) { x = x + y; return x; } - static SIMD_CPPFUNC float2x3& operator+=(float2x3& x, const float2x3 y) { x = x + y; return x; } - static SIMD_CPPFUNC float2x4& operator+=(float2x4& x, const float2x4 y) { x = x + y; return x; } - static SIMD_CPPFUNC float3x2& operator+=(float3x2& x, const float3x2 y) { x = x + y; return x; } - static SIMD_CPPFUNC float3x3& operator+=(float3x3& x, const float3x3 y) { x = x + y; return x; } - static SIMD_CPPFUNC float3x4& operator+=(float3x4& x, const float3x4 y) { x = x + y; return x; } - static SIMD_CPPFUNC float4x2& operator+=(float4x2& x, const float4x2 y) { x = x + y; return x; } - static SIMD_CPPFUNC float4x3& operator+=(float4x3& x, const float4x3 y) { x = x + y; return x; } - static SIMD_CPPFUNC float4x4& operator+=(float4x4& x, const float4x4 y) { x = x + y; return x; } - - static SIMD_CPPFUNC float2x2& operator-=(float2x2& x, const float2x2 y) { x = x - y; return x; } - static SIMD_CPPFUNC float2x3& operator-=(float2x3& x, const float2x3 y) { x = x - y; return x; } - static SIMD_CPPFUNC float2x4& operator-=(float2x4& x, const float2x4 y) { x = x - y; return x; } - static SIMD_CPPFUNC float3x2& operator-=(float3x2& x, const float3x2 y) { x = x - y; return x; } - static SIMD_CPPFUNC float3x3& operator-=(float3x3& x, const float3x3 y) { x = x - y; return x; } - static SIMD_CPPFUNC float3x4& operator-=(float3x4& x, const float3x4 y) { x = x - y; return x; } - static SIMD_CPPFUNC float4x2& operator-=(float4x2& x, const float4x2 y) { x = x - y; return x; } - static SIMD_CPPFUNC float4x3& operator-=(float4x3& x, const float4x3 y) { x = x - y; return x; } - static SIMD_CPPFUNC float4x4& operator-=(float4x4& x, const float4x4 y) { x = x - y; return x; } - - static SIMD_CPPFUNC float2x2 transpose(const float2x2 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float2x3 transpose(const float3x2 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float2x4 transpose(const float4x2 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float3x2 transpose(const float2x3 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float3x3 transpose(const float3x3 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float3x4 transpose(const float4x3 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float4x2 transpose(const float2x4 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float4x3 transpose(const float3x4 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC float4x4 transpose(const float4x4 x) { return ::simd_transpose(x); } - - static SIMD_CPPFUNC float determinant(const float2x2 x) { return ::simd_determinant(x); } - static SIMD_CPPFUNC float determinant(const float3x3 x) { return ::simd_determinant(x); } - static SIMD_CPPFUNC float determinant(const float4x4 x) { return ::simd_determinant(x); } - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgcc-compat" - static SIMD_CPPFUNC float2x2 inverse(const float2x2 x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) { return ::simd_inverse(x); } - static SIMD_CPPFUNC float3x3 inverse(const float3x3 x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) { return ::simd_inverse(x); } - static SIMD_CPPFUNC float4x4 inverse(const float4x4 x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) { return ::simd_inverse(x); } -#pragma clang diagnostic pop - - static SIMD_CPPFUNC float2x2 operator*(const float a, const float2x2 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float2x3 operator*(const float a, const float2x3 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float2x4 operator*(const float a, const float2x4 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float3x2 operator*(const float a, const float3x2 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float3x3 operator*(const float a, const float3x3 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float3x4 operator*(const float a, const float3x4 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float4x2 operator*(const float a, const float4x2 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float4x3 operator*(const float a, const float4x3 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float4x4 operator*(const float a, const float4x4 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float2x2 operator*(const float2x2 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float2x3 operator*(const float2x3 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float2x4 operator*(const float2x4 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float3x2 operator*(const float3x2 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float3x3 operator*(const float3x3 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float3x4 operator*(const float3x4 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float4x2 operator*(const float4x2 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float4x3 operator*(const float4x3 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float4x4 operator*(const float4x4 x, const float a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC float2x2& operator*=(float2x2& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float2x3& operator*=(float2x3& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float2x4& operator*=(float2x4& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float3x2& operator*=(float3x2& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float3x3& operator*=(float3x3& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float3x4& operator*=(float3x4& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float4x2& operator*=(float4x2& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float4x3& operator*=(float4x3& x, const float a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC float4x4& operator*=(float4x4& x, const float a) { x = ::simd_mul(a, x); return x; } - - static SIMD_CPPFUNC float2 operator*(const float2 x, const float2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3 operator*(const float2 x, const float3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4 operator*(const float2 x, const float4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2 operator*(const float3 x, const float2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3 operator*(const float3 x, const float3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4 operator*(const float3 x, const float4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2 operator*(const float4 x, const float2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3 operator*(const float4 x, const float3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4 operator*(const float4 x, const float4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2 operator*(const float2x2 x, const float2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2 operator*(const float3x2 x, const float3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2 operator*(const float4x2 x, const float4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3 operator*(const float2x3 x, const float2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3 operator*(const float3x3 x, const float3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3 operator*(const float4x3 x, const float4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4 operator*(const float2x4 x, const float2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4 operator*(const float3x4 x, const float3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4 operator*(const float4x4 x, const float4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2& operator*=(float2& x, const float2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float3& operator*=(float3& x, const float3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float4& operator*=(float4& x, const float4x4 y) { x = ::simd_mul(x, y); return x; } - - static SIMD_CPPFUNC float2x2 operator*(const float2x2 x, const float2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x2 operator*(const float2x2 x, const float3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x2 operator*(const float2x2 x, const float4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x3 operator*(const float2x3 x, const float2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x3 operator*(const float2x3 x, const float3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x3 operator*(const float2x3 x, const float4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x4 operator*(const float2x4 x, const float2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x4 operator*(const float2x4 x, const float3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x4 operator*(const float2x4 x, const float4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x2 operator*(const float3x2 x, const float2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x2 operator*(const float3x2 x, const float3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x2 operator*(const float3x2 x, const float4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x3 operator*(const float3x3 x, const float2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x3 operator*(const float3x3 x, const float3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x3 operator*(const float3x3 x, const float4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x4 operator*(const float3x4 x, const float2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x4 operator*(const float3x4 x, const float3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x4 operator*(const float3x4 x, const float4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x2 operator*(const float4x2 x, const float2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x2 operator*(const float4x2 x, const float3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x2 operator*(const float4x2 x, const float4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x3 operator*(const float4x3 x, const float2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x3 operator*(const float4x3 x, const float3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x3 operator*(const float4x3 x, const float4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x4 operator*(const float4x4 x, const float2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float3x4 operator*(const float4x4 x, const float3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float4x4 operator*(const float4x4 x, const float4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC float2x2& operator*=(float2x2& x, const float2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float2x3& operator*=(float2x3& x, const float2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float2x4& operator*=(float2x4& x, const float2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float3x2& operator*=(float3x2& x, const float3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float3x3& operator*=(float3x3& x, const float3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float3x4& operator*=(float3x4& x, const float3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float4x2& operator*=(float4x2& x, const float4x4 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float4x3& operator*=(float4x3& x, const float4x4 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC float4x4& operator*=(float4x4& x, const float4x4 y) { x = ::simd_mul(x, y); return x; } - - static SIMD_CPPFUNC bool operator==(const float2x2& x, const float2x2& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float2x3& x, const float2x3& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float2x4& x, const float2x4& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float3x2& x, const float3x2& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float3x3& x, const float3x3& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float3x4& x, const float3x4& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float4x2& x, const float4x2& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float4x3& x, const float4x3& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const float4x4& x, const float4x4& y) { return ::simd_equal(x, y); } - - static SIMD_CPPFUNC bool operator!=(const float2x2& x, const float2x2& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float2x3& x, const float2x3& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float2x4& x, const float2x4& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float3x2& x, const float3x2& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float3x3& x, const float3x3& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float3x4& x, const float3x4& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float4x2& x, const float4x2& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float4x3& x, const float4x3& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const float4x4& x, const float4x4& y) { return !(x == y); } - - static SIMD_CPPFUNC bool almost_equal_elements(const float2x2 x, const float2x2 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float2x3 x, const float2x3 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float2x4 x, const float2x4 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float3x2 x, const float3x2 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float3x3 x, const float3x3 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float3x4 x, const float3x4 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float4x2 x, const float4x2 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float4x3 x, const float4x3 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const float4x4 x, const float4x4 y, const float tol) { return ::simd_almost_equal_elements(x, y, tol); } - - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float2x2 x, const float2x2 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float2x3 x, const float2x3 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float2x4 x, const float2x4 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float3x2 x, const float3x2 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float3x3 x, const float3x3 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float3x4 x, const float3x4 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float4x2 x, const float4x2 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float4x3 x, const float4x3 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const float4x4 x, const float4x4 y, const float tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - - static SIMD_CPPFUNC double2x2 operator+(const double2x2 x, const double2x2 y) { return double2x2(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double2x3 operator+(const double2x3 x, const double2x3 y) { return double2x3(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double2x4 operator+(const double2x4 x, const double2x4 y) { return double2x4(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double3x2 operator+(const double3x2 x, const double3x2 y) { return double3x2(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double3x3 operator+(const double3x3 x, const double3x3 y) { return double3x3(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double3x4 operator+(const double3x4 x, const double3x4 y) { return double3x4(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double4x2 operator+(const double4x2 x, const double4x2 y) { return double4x2(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double4x3 operator+(const double4x3 x, const double4x3 y) { return double4x3(::simd_linear_combination(1, x, 1, y)); } - static SIMD_CPPFUNC double4x4 operator+(const double4x4 x, const double4x4 y) { return double4x4(::simd_linear_combination(1, x, 1, y)); } - - static SIMD_CPPFUNC double2x2 operator-(const double2x2 x, const double2x2 y) { return double2x2(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double2x3 operator-(const double2x3 x, const double2x3 y) { return double2x3(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double2x4 operator-(const double2x4 x, const double2x4 y) { return double2x4(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double3x2 operator-(const double3x2 x, const double3x2 y) { return double3x2(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double3x3 operator-(const double3x3 x, const double3x3 y) { return double3x3(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double3x4 operator-(const double3x4 x, const double3x4 y) { return double3x4(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double4x2 operator-(const double4x2 x, const double4x2 y) { return double4x2(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double4x3 operator-(const double4x3 x, const double4x3 y) { return double4x3(::simd_linear_combination(1, x, -1, y)); } - static SIMD_CPPFUNC double4x4 operator-(const double4x4 x, const double4x4 y) { return double4x4(::simd_linear_combination(1, x, -1, y)); } - - static SIMD_CPPFUNC double2x2& operator+=(double2x2& x, const double2x2 y) { x = x + y; return x; } - static SIMD_CPPFUNC double2x3& operator+=(double2x3& x, const double2x3 y) { x = x + y; return x; } - static SIMD_CPPFUNC double2x4& operator+=(double2x4& x, const double2x4 y) { x = x + y; return x; } - static SIMD_CPPFUNC double3x2& operator+=(double3x2& x, const double3x2 y) { x = x + y; return x; } - static SIMD_CPPFUNC double3x3& operator+=(double3x3& x, const double3x3 y) { x = x + y; return x; } - static SIMD_CPPFUNC double3x4& operator+=(double3x4& x, const double3x4 y) { x = x + y; return x; } - static SIMD_CPPFUNC double4x2& operator+=(double4x2& x, const double4x2 y) { x = x + y; return x; } - static SIMD_CPPFUNC double4x3& operator+=(double4x3& x, const double4x3 y) { x = x + y; return x; } - static SIMD_CPPFUNC double4x4& operator+=(double4x4& x, const double4x4 y) { x = x + y; return x; } - - static SIMD_CPPFUNC double2x2& operator-=(double2x2& x, const double2x2 y) { x = x - y; return x; } - static SIMD_CPPFUNC double2x3& operator-=(double2x3& x, const double2x3 y) { x = x - y; return x; } - static SIMD_CPPFUNC double2x4& operator-=(double2x4& x, const double2x4 y) { x = x - y; return x; } - static SIMD_CPPFUNC double3x2& operator-=(double3x2& x, const double3x2 y) { x = x - y; return x; } - static SIMD_CPPFUNC double3x3& operator-=(double3x3& x, const double3x3 y) { x = x - y; return x; } - static SIMD_CPPFUNC double3x4& operator-=(double3x4& x, const double3x4 y) { x = x - y; return x; } - static SIMD_CPPFUNC double4x2& operator-=(double4x2& x, const double4x2 y) { x = x - y; return x; } - static SIMD_CPPFUNC double4x3& operator-=(double4x3& x, const double4x3 y) { x = x - y; return x; } - static SIMD_CPPFUNC double4x4& operator-=(double4x4& x, const double4x4 y) { x = x - y; return x; } - - static SIMD_CPPFUNC double2x2 transpose(const double2x2 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double2x3 transpose(const double3x2 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double2x4 transpose(const double4x2 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double3x2 transpose(const double2x3 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double3x3 transpose(const double3x3 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double3x4 transpose(const double4x3 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double4x2 transpose(const double2x4 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double4x3 transpose(const double3x4 x) { return ::simd_transpose(x); } - static SIMD_CPPFUNC double4x4 transpose(const double4x4 x) { return ::simd_transpose(x); } - - static SIMD_CPPFUNC double determinant(const double2x2 x) { return ::simd_determinant(x); } - static SIMD_CPPFUNC double determinant(const double3x3 x) { return ::simd_determinant(x); } - static SIMD_CPPFUNC double determinant(const double4x4 x) { return ::simd_determinant(x); } - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgcc-compat" - static SIMD_CPPFUNC double2x2 inverse(const double2x2 x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) { return ::simd_inverse(x); } - static SIMD_CPPFUNC double3x3 inverse(const double3x3 x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) { return ::simd_inverse(x); } - static SIMD_CPPFUNC double4x4 inverse(const double4x4 x) __API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) { return ::simd_inverse(x); } -#pragma clang diagnostic pop - - static SIMD_CPPFUNC double2x2 operator*(const double a, const double2x2 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double2x3 operator*(const double a, const double2x3 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double2x4 operator*(const double a, const double2x4 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double3x2 operator*(const double a, const double3x2 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double3x3 operator*(const double a, const double3x3 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double3x4 operator*(const double a, const double3x4 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double4x2 operator*(const double a, const double4x2 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double4x3 operator*(const double a, const double4x3 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double4x4 operator*(const double a, const double4x4 x) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double2x2 operator*(const double2x2 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double2x3 operator*(const double2x3 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double2x4 operator*(const double2x4 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double3x2 operator*(const double3x2 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double3x3 operator*(const double3x3 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double3x4 operator*(const double3x4 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double4x2 operator*(const double4x2 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double4x3 operator*(const double4x3 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double4x4 operator*(const double4x4 x, const double a) { return ::simd_mul(a, x); } - static SIMD_CPPFUNC double2x2& operator*=(double2x2& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double2x3& operator*=(double2x3& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double2x4& operator*=(double2x4& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double3x2& operator*=(double3x2& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double3x3& operator*=(double3x3& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double3x4& operator*=(double3x4& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double4x2& operator*=(double4x2& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double4x3& operator*=(double4x3& x, const double a) { x = ::simd_mul(a, x); return x; } - static SIMD_CPPFUNC double4x4& operator*=(double4x4& x, const double a) { x = ::simd_mul(a, x); return x; } - - static SIMD_CPPFUNC double2 operator*(const double2 x, const double2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3 operator*(const double2 x, const double3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4 operator*(const double2 x, const double4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2 operator*(const double3 x, const double2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3 operator*(const double3 x, const double3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4 operator*(const double3 x, const double4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2 operator*(const double4 x, const double2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3 operator*(const double4 x, const double3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4 operator*(const double4 x, const double4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2 operator*(const double2x2 x, const double2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2 operator*(const double3x2 x, const double3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2 operator*(const double4x2 x, const double4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3 operator*(const double2x3 x, const double2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3 operator*(const double3x3 x, const double3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3 operator*(const double4x3 x, const double4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4 operator*(const double2x4 x, const double2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4 operator*(const double3x4 x, const double3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4 operator*(const double4x4 x, const double4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2& operator*=(double2& x, const double2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double3& operator*=(double3& x, const double3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double4& operator*=(double4& x, const double4x4 y) { x = ::simd_mul(x, y); return x; } - - static SIMD_CPPFUNC double2x2 operator*(const double2x2 x, const double2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x2 operator*(const double2x2 x, const double3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x2 operator*(const double2x2 x, const double4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x3 operator*(const double2x3 x, const double2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x3 operator*(const double2x3 x, const double3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x3 operator*(const double2x3 x, const double4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x4 operator*(const double2x4 x, const double2x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x4 operator*(const double2x4 x, const double3x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x4 operator*(const double2x4 x, const double4x2 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x2 operator*(const double3x2 x, const double2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x2 operator*(const double3x2 x, const double3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x2 operator*(const double3x2 x, const double4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x3 operator*(const double3x3 x, const double2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x3 operator*(const double3x3 x, const double3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x3 operator*(const double3x3 x, const double4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x4 operator*(const double3x4 x, const double2x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x4 operator*(const double3x4 x, const double3x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x4 operator*(const double3x4 x, const double4x3 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x2 operator*(const double4x2 x, const double2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x2 operator*(const double4x2 x, const double3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x2 operator*(const double4x2 x, const double4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x3 operator*(const double4x3 x, const double2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x3 operator*(const double4x3 x, const double3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x3 operator*(const double4x3 x, const double4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x4 operator*(const double4x4 x, const double2x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double3x4 operator*(const double4x4 x, const double3x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double4x4 operator*(const double4x4 x, const double4x4 y) { return ::simd_mul(x, y); } - static SIMD_CPPFUNC double2x2& operator*=(double2x2& x, const double2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double2x3& operator*=(double2x3& x, const double2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double2x4& operator*=(double2x4& x, const double2x2 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double3x2& operator*=(double3x2& x, const double3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double3x3& operator*=(double3x3& x, const double3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double3x4& operator*=(double3x4& x, const double3x3 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double4x2& operator*=(double4x2& x, const double4x4 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double4x3& operator*=(double4x3& x, const double4x4 y) { x = ::simd_mul(x, y); return x; } - static SIMD_CPPFUNC double4x4& operator*=(double4x4& x, const double4x4 y) { x = ::simd_mul(x, y); return x; } - - static SIMD_CPPFUNC bool operator==(const double2x2& x, const double2x2& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double2x3& x, const double2x3& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double2x4& x, const double2x4& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double3x2& x, const double3x2& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double3x3& x, const double3x3& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double3x4& x, const double3x4& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double4x2& x, const double4x2& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double4x3& x, const double4x3& y) { return ::simd_equal(x, y); } - static SIMD_CPPFUNC bool operator==(const double4x4& x, const double4x4& y) { return ::simd_equal(x, y); } - - static SIMD_CPPFUNC bool operator!=(const double2x2& x, const double2x2& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double2x3& x, const double2x3& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double2x4& x, const double2x4& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double3x2& x, const double3x2& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double3x3& x, const double3x3& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double3x4& x, const double3x4& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double4x2& x, const double4x2& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double4x3& x, const double4x3& y) { return !(x == y); } - static SIMD_CPPFUNC bool operator!=(const double4x4& x, const double4x4& y) { return !(x == y); } - - static SIMD_CPPFUNC bool almost_equal_elements(const double2x2 x, const double2x2 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double2x3 x, const double2x3 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double2x4 x, const double2x4 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double3x2 x, const double3x2 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double3x3 x, const double3x3 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double3x4 x, const double3x4 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double4x2 x, const double4x2 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double4x3 x, const double4x3 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements(const double4x4 x, const double4x4 y, const double tol) { return ::simd_almost_equal_elements(x, y, tol); } - - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double2x2 x, const double2x2 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double2x3 x, const double2x3 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double2x4 x, const double2x4 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double3x2 x, const double3x2 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double3x3 x, const double3x3 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double3x4 x, const double3x4 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double4x2 x, const double4x2 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double4x3 x, const double4x3 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } - static SIMD_CPPFUNC bool almost_equal_elements_relative(const double4x4 x, const double4x4 y, const double tol) { return ::simd_almost_equal_elements_relative(x, y, tol); } -} - -extern "C" { -#endif /* __cplusplus */ - -#pragma mark - Implementation - -static simd_float2x2 SIMD_CFUNC simd_diagonal_matrix(simd_float2 __x) { simd_float2x2 __r = { .columns[0] = {__x.x,0}, .columns[1] = {0,__x.y} }; return __r; } -static simd_double2x2 SIMD_CFUNC simd_diagonal_matrix(simd_double2 __x) { simd_double2x2 __r = { .columns[0] = {__x.x,0}, .columns[1] = {0,__x.y} }; return __r; } -static simd_float3x3 SIMD_CFUNC simd_diagonal_matrix(simd_float3 __x) { simd_float3x3 __r = { .columns[0] = {__x.x,0,0}, .columns[1] = {0,__x.y,0}, .columns[2] = {0,0,__x.z} }; return __r; } -static simd_double3x3 SIMD_CFUNC simd_diagonal_matrix(simd_double3 __x) { simd_double3x3 __r = { .columns[0] = {__x.x,0,0}, .columns[1] = {0,__x.y,0}, .columns[2] = {0,0,__x.z} }; return __r; } -static simd_float4x4 SIMD_CFUNC simd_diagonal_matrix(simd_float4 __x) { simd_float4x4 __r = { .columns[0] = {__x.x,0,0,0}, .columns[1] = {0,__x.y,0,0}, .columns[2] = {0,0,__x.z,0}, .columns[3] = {0,0,0,__x.w} }; return __r; } -static simd_double4x4 SIMD_CFUNC simd_diagonal_matrix(simd_double4 __x) { simd_double4x4 __r = { .columns[0] = {__x.x,0,0,0}, .columns[1] = {0,__x.y,0,0}, .columns[2] = {0,0,__x.z,0}, .columns[3] = {0,0,0,__x.w} }; return __r; } - -static simd_float2x2 SIMD_CFUNC simd_matrix(simd_float2 col0, simd_float2 col1) { simd_float2x2 __r = { .columns[0] = col0, .columns[1] = col1 }; return __r; } -static simd_float2x3 SIMD_CFUNC simd_matrix(simd_float3 col0, simd_float3 col1) { simd_float2x3 __r = { .columns[0] = col0, .columns[1] = col1 }; return __r; } -static simd_float2x4 SIMD_CFUNC simd_matrix(simd_float4 col0, simd_float4 col1) { simd_float2x4 __r = { .columns[0] = col0, .columns[1] = col1 }; return __r; } -static simd_double2x2 SIMD_CFUNC simd_matrix(simd_double2 col0, simd_double2 col1) { simd_double2x2 __r = { .columns[0] = col0, .columns[1] = col1 }; return __r; } -static simd_double2x3 SIMD_CFUNC simd_matrix(simd_double3 col0, simd_double3 col1) { simd_double2x3 __r = { .columns[0] = col0, .columns[1] = col1 }; return __r; } -static simd_double2x4 SIMD_CFUNC simd_matrix(simd_double4 col0, simd_double4 col1) { simd_double2x4 __r = { .columns[0] = col0, .columns[1] = col1 }; return __r; } -static simd_float3x2 SIMD_CFUNC simd_matrix(simd_float2 col0, simd_float2 col1, simd_float2 col2) { simd_float3x2 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2 }; return __r; } -static simd_float3x3 SIMD_CFUNC simd_matrix(simd_float3 col0, simd_float3 col1, simd_float3 col2) { simd_float3x3 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2 }; return __r; } -static simd_float3x4 SIMD_CFUNC simd_matrix(simd_float4 col0, simd_float4 col1, simd_float4 col2) { simd_float3x4 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2 }; return __r; } -static simd_double3x2 SIMD_CFUNC simd_matrix(simd_double2 col0, simd_double2 col1, simd_double2 col2) { simd_double3x2 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2 }; return __r; } -static simd_double3x3 SIMD_CFUNC simd_matrix(simd_double3 col0, simd_double3 col1, simd_double3 col2) { simd_double3x3 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2 }; return __r; } -static simd_double3x4 SIMD_CFUNC simd_matrix(simd_double4 col0, simd_double4 col1, simd_double4 col2) { simd_double3x4 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2 }; return __r; } -static simd_float4x2 SIMD_CFUNC simd_matrix(simd_float2 col0, simd_float2 col1, simd_float2 col2, simd_float2 col3) { simd_float4x2 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2, .columns[3] = col3 }; return __r; } -static simd_float4x3 SIMD_CFUNC simd_matrix(simd_float3 col0, simd_float3 col1, simd_float3 col2, simd_float3 col3) { simd_float4x3 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2, .columns[3] = col3 }; return __r; } -static simd_float4x4 SIMD_CFUNC simd_matrix(simd_float4 col0, simd_float4 col1, simd_float4 col2, simd_float4 col3) { simd_float4x4 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2, .columns[3] = col3 }; return __r; } -static simd_double4x2 SIMD_CFUNC simd_matrix(simd_double2 col0, simd_double2 col1, simd_double2 col2, simd_double2 col3) { simd_double4x2 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2, .columns[3] = col3 }; return __r; } -static simd_double4x3 SIMD_CFUNC simd_matrix(simd_double3 col0, simd_double3 col1, simd_double3 col2, simd_double3 col3) { simd_double4x3 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2, .columns[3] = col3 }; return __r; } -static simd_double4x4 SIMD_CFUNC simd_matrix(simd_double4 col0, simd_double4 col1, simd_double4 col2, simd_double4 col3) { simd_double4x4 __r = { .columns[0] = col0, .columns[1] = col1, .columns[2] = col2, .columns[3] = col3 }; return __r; } - -static simd_float2x2 SIMD_CFUNC simd_matrix_from_rows(simd_float2 row0, simd_float2 row1) { return simd_transpose(simd_matrix(row0, row1)); } -static simd_float3x2 SIMD_CFUNC simd_matrix_from_rows(simd_float3 row0, simd_float3 row1) { return simd_transpose(simd_matrix(row0, row1)); } -static simd_float4x2 SIMD_CFUNC simd_matrix_from_rows(simd_float4 row0, simd_float4 row1) { return simd_transpose(simd_matrix(row0, row1)); } -static simd_double2x2 SIMD_CFUNC simd_matrix_from_rows(simd_double2 row0, simd_double2 row1) { return simd_transpose(simd_matrix(row0, row1)); } -static simd_double3x2 SIMD_CFUNC simd_matrix_from_rows(simd_double3 row0, simd_double3 row1) { return simd_transpose(simd_matrix(row0, row1)); } -static simd_double4x2 SIMD_CFUNC simd_matrix_from_rows(simd_double4 row0, simd_double4 row1) { return simd_transpose(simd_matrix(row0, row1)); } -static simd_float2x3 SIMD_CFUNC simd_matrix_from_rows(simd_float2 row0, simd_float2 row1, simd_float2 row2) { return simd_transpose(simd_matrix(row0, row1, row2)); } -static simd_float3x3 SIMD_CFUNC simd_matrix_from_rows(simd_float3 row0, simd_float3 row1, simd_float3 row2) { return simd_transpose(simd_matrix(row0, row1, row2)); } -static simd_float4x3 SIMD_CFUNC simd_matrix_from_rows(simd_float4 row0, simd_float4 row1, simd_float4 row2) { return simd_transpose(simd_matrix(row0, row1, row2)); } -static simd_double2x3 SIMD_CFUNC simd_matrix_from_rows(simd_double2 row0, simd_double2 row1, simd_double2 row2) { return simd_transpose(simd_matrix(row0, row1, row2)); } -static simd_double3x3 SIMD_CFUNC simd_matrix_from_rows(simd_double3 row0, simd_double3 row1, simd_double3 row2) { return simd_transpose(simd_matrix(row0, row1, row2)); } -static simd_double4x3 SIMD_CFUNC simd_matrix_from_rows(simd_double4 row0, simd_double4 row1, simd_double4 row2) { return simd_transpose(simd_matrix(row0, row1, row2)); } -static simd_float2x4 SIMD_CFUNC simd_matrix_from_rows(simd_float2 row0, simd_float2 row1, simd_float2 row2, simd_float2 row3) { return simd_transpose(simd_matrix(row0, row1, row2, row3)); } -static simd_float3x4 SIMD_CFUNC simd_matrix_from_rows(simd_float3 row0, simd_float3 row1, simd_float3 row2, simd_float3 row3) { return simd_transpose(simd_matrix(row0, row1, row2, row3)); } -static simd_float4x4 SIMD_CFUNC simd_matrix_from_rows(simd_float4 row0, simd_float4 row1, simd_float4 row2, simd_float4 row3) { return simd_transpose(simd_matrix(row0, row1, row2, row3)); } -static simd_double2x4 SIMD_CFUNC simd_matrix_from_rows(simd_double2 row0, simd_double2 row1, simd_double2 row2, simd_double2 row3) { return simd_transpose(simd_matrix(row0, row1, row2, row3)); } -static simd_double3x4 SIMD_CFUNC simd_matrix_from_rows(simd_double3 row0, simd_double3 row1, simd_double3 row2, simd_double3 row3) { return simd_transpose(simd_matrix(row0, row1, row2, row3)); } -static simd_double4x4 SIMD_CFUNC simd_matrix_from_rows(simd_double4 row0, simd_double4 row1, simd_double4 row2, simd_double4 row3) { return simd_transpose(simd_matrix(row0, row1, row2, row3)); } - -static simd_float3x3 SIMD_NOINLINE simd_matrix3x3(simd_quatf q) { - simd_float4x4 r = simd_matrix4x4(q); - return (simd_float3x3){ r.columns[0].xyz, r.columns[1].xyz, r.columns[2].xyz }; -} - -static simd_float4x4 SIMD_NOINLINE simd_matrix4x4(simd_quatf q) { - simd_float4 v = q.vector; - simd_float4x4 r = { - .columns[0] = { 1 - 2*(v.y*v.y + v.z*v.z), - 2*(v.x*v.y + v.z*v.w), - 2*(v.x*v.z - v.y*v.w), 0 }, - .columns[1] = { 2*(v.x*v.y - v.z*v.w), - 1 - 2*(v.z*v.z + v.x*v.x), - 2*(v.y*v.z + v.x*v.w), 0 }, - .columns[2] = { 2*(v.z*v.x + v.y*v.w), - 2*(v.y*v.z - v.x*v.w), - 1 - 2*(v.y*v.y + v.x*v.x), 0 }, - .columns[3] = { 0, 0, 0, 1 } - }; - return r; -} - -static simd_double3x3 SIMD_NOINLINE simd_matrix3x3(simd_quatd q) { - simd_double4x4 r = simd_matrix4x4(q); - return (simd_double3x3){ r.columns[0].xyz, r.columns[1].xyz, r.columns[2].xyz }; -} - -static simd_double4x4 SIMD_NOINLINE simd_matrix4x4(simd_quatd q) { - simd_double4 v = q.vector; - simd_double4x4 r = { - .columns[0] = { 1 - 2*(v.y*v.y + v.z*v.z), - 2*(v.x*v.y + v.z*v.w), - 2*(v.x*v.z - v.y*v.w), 0 }, - .columns[1] = { 2*(v.x*v.y - v.z*v.w), - 1 - 2*(v.z*v.z + v.x*v.x), - 2*(v.y*v.z + v.x*v.w), 0 }, - .columns[2] = { 2*(v.z*v.x + v.y*v.w), - 2*(v.y*v.z - v.x*v.w), - 1 - 2*(v.y*v.y + v.x*v.x), 0 }, - .columns[3] = { 0, 0, 0, 1 } - }; - return r; -} - -static simd_float2x2 SIMD_CFUNC matrix_scale(float __a, simd_float2x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_float3x2 SIMD_CFUNC matrix_scale(float __a, simd_float3x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_float4x2 SIMD_CFUNC matrix_scale(float __a, simd_float4x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_float2x3 SIMD_CFUNC matrix_scale(float __a, simd_float2x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_float3x3 SIMD_CFUNC matrix_scale(float __a, simd_float3x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_float4x3 SIMD_CFUNC matrix_scale(float __a, simd_float4x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_float2x4 SIMD_CFUNC matrix_scale(float __a, simd_float2x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_float3x4 SIMD_CFUNC matrix_scale(float __a, simd_float3x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_float4x4 SIMD_CFUNC matrix_scale(float __a, simd_float4x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_double2x2 SIMD_CFUNC matrix_scale(double __a, simd_double2x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_double3x2 SIMD_CFUNC matrix_scale(double __a, simd_double3x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_double4x2 SIMD_CFUNC matrix_scale(double __a, simd_double4x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_double2x3 SIMD_CFUNC matrix_scale(double __a, simd_double2x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_double3x3 SIMD_CFUNC matrix_scale(double __a, simd_double3x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_double4x3 SIMD_CFUNC matrix_scale(double __a, simd_double4x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_double2x4 SIMD_CFUNC matrix_scale(double __a, simd_double2x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_double3x4 SIMD_CFUNC matrix_scale(double __a, simd_double3x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_double4x4 SIMD_CFUNC matrix_scale(double __a, simd_double4x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } - -static simd_float2x2 SIMD_CFUNC simd_mul(float __a, simd_float2x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_float3x2 SIMD_CFUNC simd_mul(float __a, simd_float3x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_float4x2 SIMD_CFUNC simd_mul(float __a, simd_float4x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_float2x3 SIMD_CFUNC simd_mul(float __a, simd_float2x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_float3x3 SIMD_CFUNC simd_mul(float __a, simd_float3x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_float4x3 SIMD_CFUNC simd_mul(float __a, simd_float4x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_float2x4 SIMD_CFUNC simd_mul(float __a, simd_float2x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_float3x4 SIMD_CFUNC simd_mul(float __a, simd_float3x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_float4x4 SIMD_CFUNC simd_mul(float __a, simd_float4x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_double2x2 SIMD_CFUNC simd_mul(double __a, simd_double2x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_double3x2 SIMD_CFUNC simd_mul(double __a, simd_double3x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_double4x2 SIMD_CFUNC simd_mul(double __a, simd_double4x2 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_double2x3 SIMD_CFUNC simd_mul(double __a, simd_double2x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_double3x3 SIMD_CFUNC simd_mul(double __a, simd_double3x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_double4x3 SIMD_CFUNC simd_mul(double __a, simd_double4x3 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } -static simd_double2x4 SIMD_CFUNC simd_mul(double __a, simd_double2x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; return __x; } -static simd_double3x4 SIMD_CFUNC simd_mul(double __a, simd_double3x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; return __x; } -static simd_double4x4 SIMD_CFUNC simd_mul(double __a, simd_double4x4 __x) { __x.columns[0] *= __a; __x.columns[1] *= __a; __x.columns[2] *= __a; __x.columns[3] *= __a; return __x; } - -static simd_float2x2 SIMD_CFUNC simd_linear_combination(float __a, simd_float2x2 __x, float __b, simd_float2x2 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - return __x; -} -static simd_float3x2 SIMD_CFUNC simd_linear_combination(float __a, simd_float3x2 __x, float __b, simd_float3x2 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - return __x; -} -static simd_float4x2 SIMD_CFUNC simd_linear_combination(float __a, simd_float4x2 __x, float __b, simd_float4x2 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - __x.columns[3] = __a*__x.columns[3] + __b*__y.columns[3]; - return __x; -} -static simd_float2x3 SIMD_CFUNC simd_linear_combination(float __a, simd_float2x3 __x, float __b, simd_float2x3 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - return __x; -} -static simd_float3x3 SIMD_CFUNC simd_linear_combination(float __a, simd_float3x3 __x, float __b, simd_float3x3 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - return __x; -} -static simd_float4x3 SIMD_CFUNC simd_linear_combination(float __a, simd_float4x3 __x, float __b, simd_float4x3 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - __x.columns[3] = __a*__x.columns[3] + __b*__y.columns[3]; - return __x; -} -static simd_float2x4 SIMD_CFUNC simd_linear_combination(float __a, simd_float2x4 __x, float __b, simd_float2x4 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - return __x; -} -static simd_float3x4 SIMD_CFUNC simd_linear_combination(float __a, simd_float3x4 __x, float __b, simd_float3x4 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - return __x; -} -static simd_float4x4 SIMD_CFUNC simd_linear_combination(float __a, simd_float4x4 __x, float __b, simd_float4x4 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - __x.columns[3] = __a*__x.columns[3] + __b*__y.columns[3]; - return __x; -} -static simd_double2x2 SIMD_CFUNC simd_linear_combination(double __a, simd_double2x2 __x, double __b, simd_double2x2 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - return __x; -} -static simd_double3x2 SIMD_CFUNC simd_linear_combination(double __a, simd_double3x2 __x, double __b, simd_double3x2 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - return __x; -} -static simd_double4x2 SIMD_CFUNC simd_linear_combination(double __a, simd_double4x2 __x, double __b, simd_double4x2 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - __x.columns[3] = __a*__x.columns[3] + __b*__y.columns[3]; - return __x; -} -static simd_double2x3 SIMD_CFUNC simd_linear_combination(double __a, simd_double2x3 __x, double __b, simd_double2x3 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - return __x; -} -static simd_double3x3 SIMD_CFUNC simd_linear_combination(double __a, simd_double3x3 __x, double __b, simd_double3x3 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - return __x; -} -static simd_double4x3 SIMD_CFUNC simd_linear_combination(double __a, simd_double4x3 __x, double __b, simd_double4x3 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - __x.columns[3] = __a*__x.columns[3] + __b*__y.columns[3]; - return __x; -} -static simd_double2x4 SIMD_CFUNC simd_linear_combination(double __a, simd_double2x4 __x, double __b, simd_double2x4 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - return __x; -} -static simd_double3x4 SIMD_CFUNC simd_linear_combination(double __a, simd_double3x4 __x, double __b, simd_double3x4 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - return __x; -} -static simd_double4x4 SIMD_CFUNC simd_linear_combination(double __a, simd_double4x4 __x, double __b, simd_double4x4 __y) { - __x.columns[0] = __a*__x.columns[0] + __b*__y.columns[0]; - __x.columns[1] = __a*__x.columns[1] + __b*__y.columns[1]; - __x.columns[2] = __a*__x.columns[2] + __b*__y.columns[2]; - __x.columns[3] = __a*__x.columns[3] + __b*__y.columns[3]; - return __x; -} - -static simd_float2x2 SIMD_CFUNC simd_add(simd_float2x2 __x, simd_float2x2 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float3x2 SIMD_CFUNC simd_add(simd_float3x2 __x, simd_float3x2 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float4x2 SIMD_CFUNC simd_add(simd_float4x2 __x, simd_float4x2 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float2x3 SIMD_CFUNC simd_add(simd_float2x3 __x, simd_float2x3 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float3x3 SIMD_CFUNC simd_add(simd_float3x3 __x, simd_float3x3 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float4x3 SIMD_CFUNC simd_add(simd_float4x3 __x, simd_float4x3 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float2x4 SIMD_CFUNC simd_add(simd_float2x4 __x, simd_float2x4 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float3x4 SIMD_CFUNC simd_add(simd_float3x4 __x, simd_float3x4 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_float4x4 SIMD_CFUNC simd_add(simd_float4x4 __x, simd_float4x4 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double2x2 SIMD_CFUNC simd_add(simd_double2x2 __x, simd_double2x2 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double3x2 SIMD_CFUNC simd_add(simd_double3x2 __x, simd_double3x2 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double4x2 SIMD_CFUNC simd_add(simd_double4x2 __x, simd_double4x2 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double2x3 SIMD_CFUNC simd_add(simd_double2x3 __x, simd_double2x3 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double3x3 SIMD_CFUNC simd_add(simd_double3x3 __x, simd_double3x3 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double4x3 SIMD_CFUNC simd_add(simd_double4x3 __x, simd_double4x3 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double2x4 SIMD_CFUNC simd_add(simd_double2x4 __x, simd_double2x4 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double3x4 SIMD_CFUNC simd_add(simd_double3x4 __x, simd_double3x4 __y) { return simd_linear_combination(1, __x, 1, __y); } -static simd_double4x4 SIMD_CFUNC simd_add(simd_double4x4 __x, simd_double4x4 __y) { return simd_linear_combination(1, __x, 1, __y); } - -static simd_float2x2 SIMD_CFUNC simd_sub(simd_float2x2 __x, simd_float2x2 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float3x2 SIMD_CFUNC simd_sub(simd_float3x2 __x, simd_float3x2 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float4x2 SIMD_CFUNC simd_sub(simd_float4x2 __x, simd_float4x2 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float2x3 SIMD_CFUNC simd_sub(simd_float2x3 __x, simd_float2x3 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float3x3 SIMD_CFUNC simd_sub(simd_float3x3 __x, simd_float3x3 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float4x3 SIMD_CFUNC simd_sub(simd_float4x3 __x, simd_float4x3 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float2x4 SIMD_CFUNC simd_sub(simd_float2x4 __x, simd_float2x4 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float3x4 SIMD_CFUNC simd_sub(simd_float3x4 __x, simd_float3x4 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_float4x4 SIMD_CFUNC simd_sub(simd_float4x4 __x, simd_float4x4 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double2x2 SIMD_CFUNC simd_sub(simd_double2x2 __x, simd_double2x2 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double3x2 SIMD_CFUNC simd_sub(simd_double3x2 __x, simd_double3x2 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double4x2 SIMD_CFUNC simd_sub(simd_double4x2 __x, simd_double4x2 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double2x3 SIMD_CFUNC simd_sub(simd_double2x3 __x, simd_double2x3 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double3x3 SIMD_CFUNC simd_sub(simd_double3x3 __x, simd_double3x3 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double4x3 SIMD_CFUNC simd_sub(simd_double4x3 __x, simd_double4x3 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double2x4 SIMD_CFUNC simd_sub(simd_double2x4 __x, simd_double2x4 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double3x4 SIMD_CFUNC simd_sub(simd_double3x4 __x, simd_double3x4 __y) { return simd_linear_combination(1, __x, -1, __y); } -static simd_double4x4 SIMD_CFUNC simd_sub(simd_double4x4 __x, simd_double4x4 __y) { return simd_linear_combination(1, __x, -1, __y); } - -static simd_float2x2 SIMD_CFUNC simd_transpose(simd_float2x2 __x) { -#if defined __SSE__ - simd_float4 __x0, __x1; - __x0.xy = __x.columns[0]; - __x1.xy = __x.columns[1]; - simd_float4 __r01 = _mm_unpacklo_ps(__x0, __x1); - return simd_matrix(__r01.lo, __r01.hi); -#else - return simd_matrix((simd_float2){__x.columns[0][0], __x.columns[1][0]}, - (simd_float2){__x.columns[0][1], __x.columns[1][1]}); -#endif -} - -static simd_float3x2 SIMD_CFUNC simd_transpose(simd_float2x3 __x) { -#if defined __SSE__ - simd_float4 __x0, __x1; - __x0.xyz = __x.columns[0]; - __x1.xyz = __x.columns[1]; - simd_float4 __r01 = _mm_unpacklo_ps(__x0, __x1); - simd_float4 __r2x = _mm_unpackhi_ps(__x0, __x1); - return simd_matrix(__r01.lo, __r01.hi, __r2x.lo); -#else - return simd_matrix((simd_float2){__x.columns[0][0], __x.columns[1][0]}, - (simd_float2){__x.columns[0][1], __x.columns[1][1]}, - (simd_float2){__x.columns[0][2], __x.columns[1][2]}); -#endif -} - -static simd_float4x2 SIMD_CFUNC simd_transpose(simd_float2x4 __x) { -#if defined __SSE__ - simd_float4 __r01 = _mm_unpacklo_ps(__x.columns[0], __x.columns[1]); - simd_float4 __r23 = _mm_unpackhi_ps(__x.columns[0], __x.columns[1]); - return simd_matrix(__r01.lo, __r01.hi, __r23.lo, __r23.hi); -#else - return simd_matrix((simd_float2){__x.columns[0][0], __x.columns[1][0]}, - (simd_float2){__x.columns[0][1], __x.columns[1][1]}, - (simd_float2){__x.columns[0][2], __x.columns[1][2]}, - (simd_float2){__x.columns[0][3], __x.columns[1][3]}); -#endif -} - -static simd_float2x3 SIMD_CFUNC simd_transpose(simd_float3x2 __x) { -#if defined __SSE__ - simd_float4 __x0, __x1, __x2; - __x0.xy = __x.columns[0]; - __x1.xy = __x.columns[1]; - __x2.xy = __x.columns[2]; - simd_float4 __t = _mm_unpacklo_ps(__x0, __x1); - simd_float4 __r0 = _mm_shuffle_ps(__t,__x2,0xc4); - simd_float4 __r1 = _mm_shuffle_ps(__t,__x2,0xde); - return simd_matrix(__r0.xyz, __r1.xyz); -#else - return simd_matrix((simd_float3){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0]}, - (simd_float3){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1]}); -#endif -} - -static simd_float3x3 SIMD_CFUNC simd_transpose(simd_float3x3 __x) { -#if defined __SSE__ - simd_float4 __x0, __x1, __x2; - __x0.xyz = __x.columns[0]; - __x1.xyz = __x.columns[1]; - __x2.xyz = __x.columns[2]; - simd_float4 __t0 = _mm_unpacklo_ps(__x0, __x1); - simd_float4 __t1 = _mm_unpackhi_ps(__x0, __x1); - simd_float4 __r0 = __t0; __r0.hi = __x2.lo; - simd_float4 __r1 = _mm_shuffle_ps(__t0, __x2, 0xde); - simd_float4 __r2 = __x2; __r2.lo = __t1.lo; - return simd_matrix(__r0.xyz, __r1.xyz, __r2.xyz); -#else - return simd_matrix((simd_float3){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0]}, - (simd_float3){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1]}, - (simd_float3){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2]}); -#endif -} - -static simd_float4x3 SIMD_CFUNC simd_transpose(simd_float3x4 __x) { -#if defined __SSE__ - simd_float4 __t0 = _mm_unpacklo_ps(__x.columns[0],__x.columns[1]); /* 00 10 01 11 */ - simd_float4 __t1 = _mm_unpackhi_ps(__x.columns[0],__x.columns[1]); /* 02 12 03 13 */ - simd_float4 __r0 = __t0; __r0.hi = __x.columns[2].lo; - simd_float4 __r1 = _mm_shuffle_ps(__t0, __x.columns[2], 0xde); - simd_float4 __r2 = __x.columns[2]; __r2.lo = __t1.lo; - simd_float4 __r3 = _mm_shuffle_ps(__t1, __x.columns[2], 0xfe); - return simd_matrix(__r0.xyz, __r1.xyz, __r2.xyz, __r3.xyz); -#else - return simd_matrix((simd_float3){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0]}, - (simd_float3){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1]}, - (simd_float3){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2]}, - (simd_float3){__x.columns[0][3], __x.columns[1][3], __x.columns[2][3]}); -#endif -} - -static simd_float2x4 SIMD_CFUNC simd_transpose(simd_float4x2 __x) { -#if defined __SSE__ - simd_float4 __x0, __x1, __x2, __x3; - __x0.xy = __x.columns[0]; - __x1.xy = __x.columns[1]; - __x2.xy = __x.columns[2]; - __x3.xy = __x.columns[3]; - simd_float4 __t0 = _mm_unpacklo_ps(__x0,__x2); - simd_float4 __t1 = _mm_unpacklo_ps(__x1,__x3); - simd_float4 __r0 = _mm_unpacklo_ps(__t0,__t1); - simd_float4 __r1 = _mm_unpackhi_ps(__t0,__t1); - return simd_matrix(__r0,__r1); -#else - return simd_matrix((simd_float4){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0], __x.columns[3][0]}, - (simd_float4){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1], __x.columns[3][1]}); -#endif -} - -static simd_float3x4 SIMD_CFUNC simd_transpose(simd_float4x3 __x) { -#if defined __SSE__ - simd_float4 __x0, __x1, __x2, __x3; - __x0.xyz = __x.columns[0]; - __x1.xyz = __x.columns[1]; - __x2.xyz = __x.columns[2]; - __x3.xyz = __x.columns[3]; - simd_float4 __t0 = _mm_unpacklo_ps(__x0,__x2); - simd_float4 __t1 = _mm_unpackhi_ps(__x0,__x2); - simd_float4 __t2 = _mm_unpacklo_ps(__x1,__x3); - simd_float4 __t3 = _mm_unpackhi_ps(__x1,__x3); - simd_float4 __r0 = _mm_unpacklo_ps(__t0,__t2); - simd_float4 __r1 = _mm_unpackhi_ps(__t0,__t2); - simd_float4 __r2 = _mm_unpacklo_ps(__t1,__t3); - return simd_matrix(__r0,__r1,__r2); -#else - return simd_matrix((simd_float4){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0], __x.columns[3][0]}, - (simd_float4){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1], __x.columns[3][1]}, - (simd_float4){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2], __x.columns[3][2]}); -#endif -} - -static simd_float4x4 SIMD_CFUNC simd_transpose(simd_float4x4 __x) { -#if defined __SSE__ - simd_float4 __t0 = _mm_unpacklo_ps(__x.columns[0],__x.columns[2]); - simd_float4 __t1 = _mm_unpackhi_ps(__x.columns[0],__x.columns[2]); - simd_float4 __t2 = _mm_unpacklo_ps(__x.columns[1],__x.columns[3]); - simd_float4 __t3 = _mm_unpackhi_ps(__x.columns[1],__x.columns[3]); - simd_float4 __r0 = _mm_unpacklo_ps(__t0,__t2); - simd_float4 __r1 = _mm_unpackhi_ps(__t0,__t2); - simd_float4 __r2 = _mm_unpacklo_ps(__t1,__t3); - simd_float4 __r3 = _mm_unpackhi_ps(__t1,__t3); - return simd_matrix(__r0,__r1,__r2,__r3); -#else - return simd_matrix((simd_float4){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0], __x.columns[3][0]}, - (simd_float4){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1], __x.columns[3][1]}, - (simd_float4){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2], __x.columns[3][2]}, - (simd_float4){__x.columns[0][3], __x.columns[1][3], __x.columns[2][3], __x.columns[3][3]}); -#endif -} - -static simd_double2x2 SIMD_CFUNC simd_transpose(simd_double2x2 __x) { - return simd_matrix((simd_double2){__x.columns[0][0], __x.columns[1][0]}, - (simd_double2){__x.columns[0][1], __x.columns[1][1]}); -} - -static simd_double3x2 SIMD_CFUNC simd_transpose(simd_double2x3 __x) { - return simd_matrix((simd_double2){__x.columns[0][0], __x.columns[1][0]}, - (simd_double2){__x.columns[0][1], __x.columns[1][1]}, - (simd_double2){__x.columns[0][2], __x.columns[1][2]}); -} - -static simd_double4x2 SIMD_CFUNC simd_transpose(simd_double2x4 __x) { - return simd_matrix((simd_double2){__x.columns[0][0], __x.columns[1][0]}, - (simd_double2){__x.columns[0][1], __x.columns[1][1]}, - (simd_double2){__x.columns[0][2], __x.columns[1][2]}, - (simd_double2){__x.columns[0][3], __x.columns[1][3]}); -} - -static simd_double2x3 SIMD_CFUNC simd_transpose(simd_double3x2 __x) { - return simd_matrix((simd_double3){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0]}, - (simd_double3){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1]}); -} - -static simd_double3x3 SIMD_CFUNC simd_transpose(simd_double3x3 __x) { - return simd_matrix((simd_double3){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0]}, - (simd_double3){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1]}, - (simd_double3){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2]}); -} - -static simd_double4x3 SIMD_CFUNC simd_transpose(simd_double3x4 __x) { - return simd_matrix((simd_double3){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0]}, - (simd_double3){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1]}, - (simd_double3){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2]}, - (simd_double3){__x.columns[0][3], __x.columns[1][3], __x.columns[2][3]}); -} - -static simd_double2x4 SIMD_CFUNC simd_transpose(simd_double4x2 __x) { - return simd_matrix((simd_double4){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0], __x.columns[3][0]}, - (simd_double4){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1], __x.columns[3][1]}); -} - -static simd_double3x4 SIMD_CFUNC simd_transpose(simd_double4x3 __x) { - return simd_matrix((simd_double4){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0], __x.columns[3][0]}, - (simd_double4){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1], __x.columns[3][1]}, - (simd_double4){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2], __x.columns[3][2]}); -} - -static simd_double4x4 SIMD_CFUNC simd_transpose(simd_double4x4 __x) { - return simd_matrix((simd_double4){__x.columns[0][0], __x.columns[1][0], __x.columns[2][0], __x.columns[3][0]}, - (simd_double4){__x.columns[0][1], __x.columns[1][1], __x.columns[2][1], __x.columns[3][1]}, - (simd_double4){__x.columns[0][2], __x.columns[1][2], __x.columns[2][2], __x.columns[3][2]}, - (simd_double4){__x.columns[0][3], __x.columns[1][3], __x.columns[2][3], __x.columns[3][3]}); -} - -static simd_float3 SIMD_CFUNC __rotate1( simd_float3 __x) { return __builtin_shufflevector(__x,__x,1,2,0); } -static simd_float3 SIMD_CFUNC __rotate2( simd_float3 __x) { return __builtin_shufflevector(__x,__x,2,0,1); } -static simd_float4 SIMD_CFUNC __rotate1( simd_float4 __x) { return __builtin_shufflevector(__x,__x,1,2,3,0); } -static simd_float4 SIMD_CFUNC __rotate2( simd_float4 __x) { return __builtin_shufflevector(__x,__x,2,3,0,1); } -static simd_float4 SIMD_CFUNC __rotate3( simd_float4 __x) { return __builtin_shufflevector(__x,__x,3,0,1,2); } -static simd_double3 SIMD_CFUNC __rotate1(simd_double3 __x) { return __builtin_shufflevector(__x,__x,1,2,0); } -static simd_double3 SIMD_CFUNC __rotate2(simd_double3 __x) { return __builtin_shufflevector(__x,__x,2,0,1); } -static simd_double4 SIMD_CFUNC __rotate1(simd_double4 __x) { return __builtin_shufflevector(__x,__x,1,2,3,0); } -static simd_double4 SIMD_CFUNC __rotate2(simd_double4 __x) { return __builtin_shufflevector(__x,__x,2,3,0,1); } -static simd_double4 SIMD_CFUNC __rotate3(simd_double4 __x) { return __builtin_shufflevector(__x,__x,3,0,1,2); } - -static float SIMD_CFUNC simd_determinant( simd_float2x2 __x) { return __x.columns[0][0]*__x.columns[1][1] - __x.columns[0][1]*__x.columns[1][0]; } -static double SIMD_CFUNC simd_determinant(simd_double2x2 __x) { return __x.columns[0][0]*__x.columns[1][1] - __x.columns[0][1]*__x.columns[1][0]; } -static float SIMD_CFUNC simd_determinant( simd_float3x3 __x) { return simd_reduce_add(__x.columns[0]*(__rotate1(__x.columns[1])*__rotate2(__x.columns[2]) - __rotate2(__x.columns[1])*__rotate1(__x.columns[2]))); } -static double SIMD_CFUNC simd_determinant(simd_double3x3 __x) { return simd_reduce_add(__x.columns[0]*(__rotate1(__x.columns[1])*__rotate2(__x.columns[2]) - __rotate2(__x.columns[1])*__rotate1(__x.columns[2]))); } -static float SIMD_CFUNC simd_determinant( simd_float4x4 __x) { - simd_float4 codet = __x.columns[0]*(__rotate1(__x.columns[1])*(__rotate2(__x.columns[2])*__rotate3(__x.columns[3])-__rotate3(__x.columns[2])*__rotate2(__x.columns[3])) + - __rotate2(__x.columns[1])*(__rotate3(__x.columns[2])*__rotate1(__x.columns[3])-__rotate1(__x.columns[2])*__rotate3(__x.columns[3])) + - __rotate3(__x.columns[1])*(__rotate1(__x.columns[2])*__rotate2(__x.columns[3])-__rotate2(__x.columns[2])*__rotate1(__x.columns[3]))); - return simd_reduce_add(codet.even - codet.odd); -} -static double SIMD_CFUNC simd_determinant(simd_double4x4 __x) { - simd_double4 codet = __x.columns[0]*(__rotate1(__x.columns[1])*(__rotate2(__x.columns[2])*__rotate3(__x.columns[3])-__rotate3(__x.columns[2])*__rotate2(__x.columns[3])) + - __rotate2(__x.columns[1])*(__rotate3(__x.columns[2])*__rotate1(__x.columns[3])-__rotate1(__x.columns[2])*__rotate3(__x.columns[3])) + - __rotate3(__x.columns[1])*(__rotate1(__x.columns[2])*__rotate2(__x.columns[3])-__rotate2(__x.columns[2])*__rotate1(__x.columns[3]))); - return simd_reduce_add(codet.even - codet.odd); -} - -static simd_float2x2 SIMD_CFUNC simd_inverse( simd_float2x2 __x) { return __invert_f2(__x); } -static simd_float3x3 SIMD_CFUNC simd_inverse( simd_float3x3 __x) { return __invert_f3(__x); } -static simd_float4x4 SIMD_CFUNC simd_inverse( simd_float4x4 __x) { return __invert_f4(__x); } -static simd_double2x2 SIMD_CFUNC simd_inverse(simd_double2x2 __x) { return __invert_d2(__x); } -static simd_double3x3 SIMD_CFUNC simd_inverse(simd_double3x3 __x) { return __invert_d3(__x); } -static simd_double4x4 SIMD_CFUNC simd_inverse(simd_double4x4 __x) { return __invert_d4(__x); } - -static simd_float2 SIMD_CFUNC simd_mul( simd_float2x2 __x, simd_float2 __y) { simd_float2 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } -static simd_float3 SIMD_CFUNC simd_mul( simd_float2x3 __x, simd_float2 __y) { simd_float3 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } -static simd_float4 SIMD_CFUNC simd_mul( simd_float2x4 __x, simd_float2 __y) { simd_float4 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } -static simd_float2 SIMD_CFUNC simd_mul( simd_float3x2 __x, simd_float3 __y) { simd_float2 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); return __r; } -static simd_float3 SIMD_CFUNC simd_mul( simd_float3x3 __x, simd_float3 __y) { simd_float3 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); return __r; } -static simd_float4 SIMD_CFUNC simd_mul( simd_float3x4 __x, simd_float3 __y) { simd_float4 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); return __r; } -static simd_float2 SIMD_CFUNC simd_mul( simd_float4x2 __x, simd_float4 __y) { simd_float2 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); __r = simd_muladd( __x.columns[3], __y[3],__r); return __r; } -static simd_float3 SIMD_CFUNC simd_mul( simd_float4x3 __x, simd_float4 __y) { simd_float3 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); __r = simd_muladd( __x.columns[3], __y[3],__r); return __r; } -static simd_float4 SIMD_CFUNC simd_mul( simd_float4x4 __x, simd_float4 __y) { simd_float4 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); __r = simd_muladd( __x.columns[3], __y[3],__r); return __r; } -static simd_double2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double2 __y) { simd_double2 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } -static simd_double3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double2 __y) { simd_double3 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } -static simd_double4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double2 __y) { simd_double4 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } -static simd_double2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double3 __y) { simd_double2 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); return __r; } -static simd_double3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double3 __y) { simd_double3 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); return __r; } -static simd_double4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double3 __y) { simd_double4 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); return __r; } -static simd_double2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double4 __y) { simd_double2 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); __r = simd_muladd( __x.columns[3], __y[3],__r); return __r; } -static simd_double3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double4 __y) { simd_double3 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); __r = simd_muladd( __x.columns[3], __y[3],__r); return __r; } -static simd_double4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double4 __y) { simd_double4 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); __r = simd_muladd( __x.columns[2], __y[2],__r); __r = simd_muladd( __x.columns[3], __y[3],__r); return __r; } - -static simd_float2 SIMD_CFUNC simd_mul( simd_float2 __x, simd_float2x2 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float3 SIMD_CFUNC simd_mul( simd_float2 __x, simd_float3x2 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float4 SIMD_CFUNC simd_mul( simd_float2 __x, simd_float4x2 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float2 SIMD_CFUNC simd_mul( simd_float3 __x, simd_float2x3 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float3 SIMD_CFUNC simd_mul( simd_float3 __x, simd_float3x3 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float4 SIMD_CFUNC simd_mul( simd_float3 __x, simd_float4x3 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float2 SIMD_CFUNC simd_mul( simd_float4 __x, simd_float2x4 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float3 SIMD_CFUNC simd_mul( simd_float4 __x, simd_float3x4 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_float4 SIMD_CFUNC simd_mul( simd_float4 __x, simd_float4x4 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double2 SIMD_CFUNC simd_mul(simd_double2 __x, simd_double2x2 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double3 SIMD_CFUNC simd_mul(simd_double2 __x, simd_double3x2 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double4 SIMD_CFUNC simd_mul(simd_double2 __x, simd_double4x2 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double2 SIMD_CFUNC simd_mul(simd_double3 __x, simd_double2x3 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double3 SIMD_CFUNC simd_mul(simd_double3 __x, simd_double3x3 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double4 SIMD_CFUNC simd_mul(simd_double3 __x, simd_double4x3 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double2 SIMD_CFUNC simd_mul(simd_double4 __x, simd_double2x4 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double3 SIMD_CFUNC simd_mul(simd_double4 __x, simd_double3x4 __y) { return simd_mul(simd_transpose(__y), __x); } -static simd_double4 SIMD_CFUNC simd_mul(simd_double4 __x, simd_double4x4 __y) { return simd_mul(simd_transpose(__y), __x); } - -static simd_float2x2 SIMD_CFUNC simd_mul( simd_float2x2 __x, simd_float2x2 __y) { simd_float2x2 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double2x2 __y) { simd_double2x2 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x3 SIMD_CFUNC simd_mul( simd_float2x3 __x, simd_float2x2 __y) { simd_float2x3 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double2x2 __y) { simd_double2x3 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x4 SIMD_CFUNC simd_mul( simd_float2x4 __x, simd_float2x2 __y) { simd_float2x4 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double2x2 __y) { simd_double2x4 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x2 SIMD_CFUNC simd_mul( simd_float3x2 __x, simd_float2x3 __y) { simd_float2x2 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double2x3 __y) { simd_double2x2 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x3 SIMD_CFUNC simd_mul( simd_float3x3 __x, simd_float2x3 __y) { simd_float2x3 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double2x3 __y) { simd_double2x3 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x4 SIMD_CFUNC simd_mul( simd_float3x4 __x, simd_float2x3 __y) { simd_float2x4 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double2x3 __y) { simd_double2x4 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x2 SIMD_CFUNC simd_mul( simd_float4x2 __x, simd_float2x4 __y) { simd_float2x2 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double2x4 __y) { simd_double2x2 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x3 SIMD_CFUNC simd_mul( simd_float4x3 __x, simd_float2x4 __y) { simd_float2x3 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double2x4 __y) { simd_double2x3 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float2x4 SIMD_CFUNC simd_mul( simd_float4x4 __x, simd_float2x4 __y) { simd_float2x4 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double2x4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double2x4 __y) { simd_double2x4 __r; for (int i=0; i<2; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } - -static simd_float3x2 SIMD_CFUNC simd_mul( simd_float2x2 __x, simd_float3x2 __y) { simd_float3x2 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double3x2 __y) { simd_double3x2 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x3 SIMD_CFUNC simd_mul( simd_float2x3 __x, simd_float3x2 __y) { simd_float3x3 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double3x2 __y) { simd_double3x3 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x4 SIMD_CFUNC simd_mul( simd_float2x4 __x, simd_float3x2 __y) { simd_float3x4 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double3x2 __y) { simd_double3x4 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x2 SIMD_CFUNC simd_mul( simd_float3x2 __x, simd_float3x3 __y) { simd_float3x2 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double3x3 __y) { simd_double3x2 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x3 SIMD_CFUNC simd_mul( simd_float3x3 __x, simd_float3x3 __y) { simd_float3x3 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double3x3 __y) { simd_double3x3 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x4 SIMD_CFUNC simd_mul( simd_float3x4 __x, simd_float3x3 __y) { simd_float3x4 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double3x3 __y) { simd_double3x4 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x2 SIMD_CFUNC simd_mul( simd_float4x2 __x, simd_float3x4 __y) { simd_float3x2 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double3x4 __y) { simd_double3x2 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x3 SIMD_CFUNC simd_mul( simd_float4x3 __x, simd_float3x4 __y) { simd_float3x3 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double3x4 __y) { simd_double3x3 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float3x4 SIMD_CFUNC simd_mul( simd_float4x4 __x, simd_float3x4 __y) { simd_float3x4 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double3x4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double3x4 __y) { simd_double3x4 __r; for (int i=0; i<3; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } - -static simd_float4x2 SIMD_CFUNC simd_mul( simd_float2x2 __x, simd_float4x2 __y) { simd_float4x2 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x2 SIMD_CFUNC simd_mul(simd_double2x2 __x, simd_double4x2 __y) { simd_double4x2 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x3 SIMD_CFUNC simd_mul( simd_float2x3 __x, simd_float4x2 __y) { simd_float4x3 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x3 SIMD_CFUNC simd_mul(simd_double2x3 __x, simd_double4x2 __y) { simd_double4x3 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x4 SIMD_CFUNC simd_mul( simd_float2x4 __x, simd_float4x2 __y) { simd_float4x4 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x4 SIMD_CFUNC simd_mul(simd_double2x4 __x, simd_double4x2 __y) { simd_double4x4 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x2 SIMD_CFUNC simd_mul( simd_float3x2 __x, simd_float4x3 __y) { simd_float4x2 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x2 SIMD_CFUNC simd_mul(simd_double3x2 __x, simd_double4x3 __y) { simd_double4x2 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x3 SIMD_CFUNC simd_mul( simd_float3x3 __x, simd_float4x3 __y) { simd_float4x3 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x3 SIMD_CFUNC simd_mul(simd_double3x3 __x, simd_double4x3 __y) { simd_double4x3 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x4 SIMD_CFUNC simd_mul( simd_float3x4 __x, simd_float4x3 __y) { simd_float4x4 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x4 SIMD_CFUNC simd_mul(simd_double3x4 __x, simd_double4x3 __y) { simd_double4x4 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x2 SIMD_CFUNC simd_mul( simd_float4x2 __x, simd_float4x4 __y) { simd_float4x2 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double4x4 __y) { simd_double4x2 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x3 SIMD_CFUNC simd_mul( simd_float4x3 __x, simd_float4x4 __y) { simd_float4x3 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x3 SIMD_CFUNC simd_mul(simd_double4x3 __x, simd_double4x4 __y) { simd_double4x3 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_float4x4 SIMD_CFUNC simd_mul( simd_float4x4 __x, simd_float4x4 __y) { simd_float4x4 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } -static simd_double4x4 SIMD_CFUNC simd_mul(simd_double4x4 __x, simd_double4x4 __y) { simd_double4x4 __r; for (int i=0; i<4; ++i) __r.columns[i] = simd_mul(__x, __y.columns[i]); return __r; } - -static simd_float2 SIMD_CFUNC matrix_multiply( simd_float2x2 __x, simd_float2 __y) { return simd_mul(__x, __y); } -static simd_float3 SIMD_CFUNC matrix_multiply( simd_float2x3 __x, simd_float2 __y) { return simd_mul(__x, __y); } -static simd_float4 SIMD_CFUNC matrix_multiply( simd_float2x4 __x, simd_float2 __y) { return simd_mul(__x, __y); } -static simd_float2 SIMD_CFUNC matrix_multiply( simd_float3x2 __x, simd_float3 __y) { return simd_mul(__x, __y); } -static simd_float3 SIMD_CFUNC matrix_multiply( simd_float3x3 __x, simd_float3 __y) { return simd_mul(__x, __y); } -static simd_float4 SIMD_CFUNC matrix_multiply( simd_float3x4 __x, simd_float3 __y) { return simd_mul(__x, __y); } -static simd_float2 SIMD_CFUNC matrix_multiply( simd_float4x2 __x, simd_float4 __y) { return simd_mul(__x, __y); } -static simd_float3 SIMD_CFUNC matrix_multiply( simd_float4x3 __x, simd_float4 __y) { return simd_mul(__x, __y); } -static simd_float4 SIMD_CFUNC matrix_multiply( simd_float4x4 __x, simd_float4 __y) { return simd_mul(__x, __y); } -static simd_double2 SIMD_CFUNC matrix_multiply(simd_double2x2 __x, simd_double2 __y) { return simd_mul(__x, __y); } -static simd_double3 SIMD_CFUNC matrix_multiply(simd_double2x3 __x, simd_double2 __y) { return simd_mul(__x, __y); } -static simd_double4 SIMD_CFUNC matrix_multiply(simd_double2x4 __x, simd_double2 __y) { return simd_mul(__x, __y); } -static simd_double2 SIMD_CFUNC matrix_multiply(simd_double3x2 __x, simd_double3 __y) { return simd_mul(__x, __y); } -static simd_double3 SIMD_CFUNC matrix_multiply(simd_double3x3 __x, simd_double3 __y) { return simd_mul(__x, __y); } -static simd_double4 SIMD_CFUNC matrix_multiply(simd_double3x4 __x, simd_double3 __y) { return simd_mul(__x, __y); } -static simd_double2 SIMD_CFUNC matrix_multiply(simd_double4x2 __x, simd_double4 __y) { return simd_mul(__x, __y); } -static simd_double3 SIMD_CFUNC matrix_multiply(simd_double4x3 __x, simd_double4 __y) { return simd_mul(__x, __y); } -static simd_double4 SIMD_CFUNC matrix_multiply(simd_double4x4 __x, simd_double4 __y) { return simd_mul(__x, __y); } - -static simd_float2 SIMD_CFUNC matrix_multiply( simd_float2 __x, simd_float2x2 __y) { return simd_mul(__x, __y); } -static simd_float3 SIMD_CFUNC matrix_multiply( simd_float2 __x, simd_float3x2 __y) { return simd_mul(__x, __y); } -static simd_float4 SIMD_CFUNC matrix_multiply( simd_float2 __x, simd_float4x2 __y) { return simd_mul(__x, __y); } -static simd_float2 SIMD_CFUNC matrix_multiply( simd_float3 __x, simd_float2x3 __y) { return simd_mul(__x, __y); } -static simd_float3 SIMD_CFUNC matrix_multiply( simd_float3 __x, simd_float3x3 __y) { return simd_mul(__x, __y); } -static simd_float4 SIMD_CFUNC matrix_multiply( simd_float3 __x, simd_float4x3 __y) { return simd_mul(__x, __y); } -static simd_float2 SIMD_CFUNC matrix_multiply( simd_float4 __x, simd_float2x4 __y) { return simd_mul(__x, __y); } -static simd_float3 SIMD_CFUNC matrix_multiply( simd_float4 __x, simd_float3x4 __y) { return simd_mul(__x, __y); } -static simd_float4 SIMD_CFUNC matrix_multiply( simd_float4 __x, simd_float4x4 __y) { return simd_mul(__x, __y); } -static simd_double2 SIMD_CFUNC matrix_multiply(simd_double2 __x, simd_double2x2 __y) { return simd_mul(__x, __y); } -static simd_double3 SIMD_CFUNC matrix_multiply(simd_double2 __x, simd_double3x2 __y) { return simd_mul(__x, __y); } -static simd_double4 SIMD_CFUNC matrix_multiply(simd_double2 __x, simd_double4x2 __y) { return simd_mul(__x, __y); } -static simd_double2 SIMD_CFUNC matrix_multiply(simd_double3 __x, simd_double2x3 __y) { return simd_mul(__x, __y); } -static simd_double3 SIMD_CFUNC matrix_multiply(simd_double3 __x, simd_double3x3 __y) { return simd_mul(__x, __y); } -static simd_double4 SIMD_CFUNC matrix_multiply(simd_double3 __x, simd_double4x3 __y) { return simd_mul(__x, __y); } -static simd_double2 SIMD_CFUNC matrix_multiply(simd_double4 __x, simd_double2x4 __y) { return simd_mul(__x, __y); } -static simd_double3 SIMD_CFUNC matrix_multiply(simd_double4 __x, simd_double3x4 __y) { return simd_mul(__x, __y); } -static simd_double4 SIMD_CFUNC matrix_multiply(simd_double4 __x, simd_double4x4 __y) { return simd_mul(__x, __y); } - -static simd_float2x2 SIMD_CFUNC matrix_multiply( simd_float2x2 __x, simd_float2x2 __y) { return simd_mul(__x, __y); } -static simd_double2x2 SIMD_CFUNC matrix_multiply(simd_double2x2 __x, simd_double2x2 __y) { return simd_mul(__x, __y); } -static simd_float2x3 SIMD_CFUNC matrix_multiply( simd_float2x3 __x, simd_float2x2 __y) { return simd_mul(__x, __y); } -static simd_double2x3 SIMD_CFUNC matrix_multiply(simd_double2x3 __x, simd_double2x2 __y) { return simd_mul(__x, __y); } -static simd_float2x4 SIMD_CFUNC matrix_multiply( simd_float2x4 __x, simd_float2x2 __y) { return simd_mul(__x, __y); } -static simd_double2x4 SIMD_CFUNC matrix_multiply(simd_double2x4 __x, simd_double2x2 __y) { return simd_mul(__x, __y); } -static simd_float2x2 SIMD_CFUNC matrix_multiply( simd_float3x2 __x, simd_float2x3 __y) { return simd_mul(__x, __y); } -static simd_double2x2 SIMD_CFUNC matrix_multiply(simd_double3x2 __x, simd_double2x3 __y) { return simd_mul(__x, __y); } -static simd_float2x3 SIMD_CFUNC matrix_multiply( simd_float3x3 __x, simd_float2x3 __y) { return simd_mul(__x, __y); } -static simd_double2x3 SIMD_CFUNC matrix_multiply(simd_double3x3 __x, simd_double2x3 __y) { return simd_mul(__x, __y); } -static simd_float2x4 SIMD_CFUNC matrix_multiply( simd_float3x4 __x, simd_float2x3 __y) { return simd_mul(__x, __y); } -static simd_double2x4 SIMD_CFUNC matrix_multiply(simd_double3x4 __x, simd_double2x3 __y) { return simd_mul(__x, __y); } -static simd_float2x2 SIMD_CFUNC matrix_multiply( simd_float4x2 __x, simd_float2x4 __y) { return simd_mul(__x, __y); } -static simd_double2x2 SIMD_CFUNC matrix_multiply(simd_double4x2 __x, simd_double2x4 __y) { return simd_mul(__x, __y); } -static simd_float2x3 SIMD_CFUNC matrix_multiply( simd_float4x3 __x, simd_float2x4 __y) { return simd_mul(__x, __y); } -static simd_double2x3 SIMD_CFUNC matrix_multiply(simd_double4x3 __x, simd_double2x4 __y) { return simd_mul(__x, __y); } -static simd_float2x4 SIMD_CFUNC matrix_multiply( simd_float4x4 __x, simd_float2x4 __y) { return simd_mul(__x, __y); } -static simd_double2x4 SIMD_CFUNC matrix_multiply(simd_double4x4 __x, simd_double2x4 __y) { return simd_mul(__x, __y); } - -static simd_float3x2 SIMD_CFUNC matrix_multiply( simd_float2x2 __x, simd_float3x2 __y) { return simd_mul(__x, __y); } -static simd_double3x2 SIMD_CFUNC matrix_multiply(simd_double2x2 __x, simd_double3x2 __y) { return simd_mul(__x, __y); } -static simd_float3x3 SIMD_CFUNC matrix_multiply( simd_float2x3 __x, simd_float3x2 __y) { return simd_mul(__x, __y); } -static simd_double3x3 SIMD_CFUNC matrix_multiply(simd_double2x3 __x, simd_double3x2 __y) { return simd_mul(__x, __y); } -static simd_float3x4 SIMD_CFUNC matrix_multiply( simd_float2x4 __x, simd_float3x2 __y) { return simd_mul(__x, __y); } -static simd_double3x4 SIMD_CFUNC matrix_multiply(simd_double2x4 __x, simd_double3x2 __y) { return simd_mul(__x, __y); } -static simd_float3x2 SIMD_CFUNC matrix_multiply( simd_float3x2 __x, simd_float3x3 __y) { return simd_mul(__x, __y); } -static simd_double3x2 SIMD_CFUNC matrix_multiply(simd_double3x2 __x, simd_double3x3 __y) { return simd_mul(__x, __y); } -static simd_float3x3 SIMD_CFUNC matrix_multiply( simd_float3x3 __x, simd_float3x3 __y) { return simd_mul(__x, __y); } -static simd_double3x3 SIMD_CFUNC matrix_multiply(simd_double3x3 __x, simd_double3x3 __y) { return simd_mul(__x, __y); } -static simd_float3x4 SIMD_CFUNC matrix_multiply( simd_float3x4 __x, simd_float3x3 __y) { return simd_mul(__x, __y); } -static simd_double3x4 SIMD_CFUNC matrix_multiply(simd_double3x4 __x, simd_double3x3 __y) { return simd_mul(__x, __y); } -static simd_float3x2 SIMD_CFUNC matrix_multiply( simd_float4x2 __x, simd_float3x4 __y) { return simd_mul(__x, __y); } -static simd_double3x2 SIMD_CFUNC matrix_multiply(simd_double4x2 __x, simd_double3x4 __y) { return simd_mul(__x, __y); } -static simd_float3x3 SIMD_CFUNC matrix_multiply( simd_float4x3 __x, simd_float3x4 __y) { return simd_mul(__x, __y); } -static simd_double3x3 SIMD_CFUNC matrix_multiply(simd_double4x3 __x, simd_double3x4 __y) { return simd_mul(__x, __y); } -static simd_float3x4 SIMD_CFUNC matrix_multiply( simd_float4x4 __x, simd_float3x4 __y) { return simd_mul(__x, __y); } -static simd_double3x4 SIMD_CFUNC matrix_multiply(simd_double4x4 __x, simd_double3x4 __y) { return simd_mul(__x, __y); } - -static simd_float4x2 SIMD_CFUNC matrix_multiply( simd_float2x2 __x, simd_float4x2 __y) { return simd_mul(__x, __y); } -static simd_double4x2 SIMD_CFUNC matrix_multiply(simd_double2x2 __x, simd_double4x2 __y) { return simd_mul(__x, __y); } -static simd_float4x3 SIMD_CFUNC matrix_multiply( simd_float2x3 __x, simd_float4x2 __y) { return simd_mul(__x, __y); } -static simd_double4x3 SIMD_CFUNC matrix_multiply(simd_double2x3 __x, simd_double4x2 __y) { return simd_mul(__x, __y); } -static simd_float4x4 SIMD_CFUNC matrix_multiply( simd_float2x4 __x, simd_float4x2 __y) { return simd_mul(__x, __y); } -static simd_double4x4 SIMD_CFUNC matrix_multiply(simd_double2x4 __x, simd_double4x2 __y) { return simd_mul(__x, __y); } -static simd_float4x2 SIMD_CFUNC matrix_multiply( simd_float3x2 __x, simd_float4x3 __y) { return simd_mul(__x, __y); } -static simd_double4x2 SIMD_CFUNC matrix_multiply(simd_double3x2 __x, simd_double4x3 __y) { return simd_mul(__x, __y); } -static simd_float4x3 SIMD_CFUNC matrix_multiply( simd_float3x3 __x, simd_float4x3 __y) { return simd_mul(__x, __y); } -static simd_double4x3 SIMD_CFUNC matrix_multiply(simd_double3x3 __x, simd_double4x3 __y) { return simd_mul(__x, __y); } -static simd_float4x4 SIMD_CFUNC matrix_multiply( simd_float3x4 __x, simd_float4x3 __y) { return simd_mul(__x, __y); } -static simd_double4x4 SIMD_CFUNC matrix_multiply(simd_double3x4 __x, simd_double4x3 __y) { return simd_mul(__x, __y); } -static simd_float4x2 SIMD_CFUNC matrix_multiply( simd_float4x2 __x, simd_float4x4 __y) { return simd_mul(__x, __y); } -static simd_double4x2 SIMD_CFUNC matrix_multiply(simd_double4x2 __x, simd_double4x4 __y) { return simd_mul(__x, __y); } -static simd_float4x3 SIMD_CFUNC matrix_multiply( simd_float4x3 __x, simd_float4x4 __y) { return simd_mul(__x, __y); } -static simd_double4x3 SIMD_CFUNC matrix_multiply(simd_double4x3 __x, simd_double4x4 __y) { return simd_mul(__x, __y); } -static simd_float4x4 SIMD_CFUNC matrix_multiply( simd_float4x4 __x, simd_float4x4 __y) { return simd_mul(__x, __y); } -static simd_double4x4 SIMD_CFUNC matrix_multiply(simd_double4x4 __x, simd_double4x4 __y) { return simd_mul(__x, __y); } - -static simd_bool SIMD_CFUNC simd_equal(simd_float2x2 __x, simd_float2x2 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float2x3 __x, simd_float2x3 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float2x4 __x, simd_float2x4 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float3x2 __x, simd_float3x2 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float3x3 __x, simd_float3x3 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float3x4 __x, simd_float3x4 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float4x2 __x, simd_float4x2 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2]) & - (__x.columns[3] == __y.columns[3])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float4x3 __x, simd_float4x3 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2]) & - (__x.columns[3] == __y.columns[3])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_float4x4 __x, simd_float4x4 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2]) & - (__x.columns[3] == __y.columns[3])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double2x2 __x, simd_double2x2 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double2x3 __x, simd_double2x3 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double2x4 __x, simd_double2x4 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double3x2 __x, simd_double3x2 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double3x3 __x, simd_double3x3 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double3x4 __x, simd_double3x4 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double4x2 __x, simd_double4x2 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2]) & - (__x.columns[3] == __y.columns[3])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double4x3 __x, simd_double4x3 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2]) & - (__x.columns[3] == __y.columns[3])); -} -static simd_bool SIMD_CFUNC simd_equal(simd_double4x4 __x, simd_double4x4 __y) { - return simd_all((__x.columns[0] == __y.columns[0]) & - (__x.columns[1] == __y.columns[1]) & - (__x.columns[2] == __y.columns[2]) & - (__x.columns[3] == __y.columns[3])); -} - -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float2x2 __x, simd_float2x2 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float2x3 __x, simd_float2x3 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float2x4 __x, simd_float2x4 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float3x2 __x, simd_float3x2 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float3x3 __x, simd_float3x3 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float3x4 __x, simd_float3x4 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float4x2 __x, simd_float4x2 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float4x3 __x, simd_float4x3 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_float4x4 __x, simd_float4x4 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double2x2 __x, simd_double2x2 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double2x3 __x, simd_double2x3 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double2x4 __x, simd_double2x4 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double3x2 __x, simd_double3x2 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double3x3 __x, simd_double3x3 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double3x4 __x, simd_double3x4 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double4x2 __x, simd_double4x2 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double4x3 __x, simd_double4x3 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol)); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double4x4 __x, simd_double4x4 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol)); -} - -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float2x2 __x, simd_float2x2 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float2x3 __x, simd_float2x3 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float2x4 __x, simd_float2x4 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float3x2 __x, simd_float3x2 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float3x3 __x, simd_float3x3 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float3x4 __x, simd_float3x4 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float4x2 __x, simd_float4x2 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2])) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol*__tg_fabs(__x.columns[3]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float4x3 __x, simd_float4x3 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2])) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol*__tg_fabs(__x.columns[3]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_float4x4 __x, simd_float4x4 __y, float __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2])) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol*__tg_fabs(__x.columns[3]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double2x2 __x, simd_double2x2 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double2x3 __x, simd_double2x3 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double2x4 __x, simd_double2x4 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double3x2 __x, simd_double3x2 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double3x3 __x, simd_double3x3 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double3x4 __x, simd_double3x4 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double4x2 __x, simd_double4x2 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2])) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol*__tg_fabs(__x.columns[3]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double4x3 __x, simd_double4x3 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2])) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol*__tg_fabs(__x.columns[3]))); -} -static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_double4x4 __x, simd_double4x4 __y, double __tol) { - return simd_all((__tg_fabs(__x.columns[0] - __y.columns[0]) <= __tol*__tg_fabs(__x.columns[0])) & - (__tg_fabs(__x.columns[1] - __y.columns[1]) <= __tol*__tg_fabs(__x.columns[1])) & - (__tg_fabs(__x.columns[2] - __y.columns[2]) <= __tol*__tg_fabs(__x.columns[2])) & - (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol*__tg_fabs(__x.columns[3]))); -} - -#ifdef __cplusplus -} -#endif -#endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */ -#endif /* __SIMD_HEADER__ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/matrix_types.h b/lib/libc/include/x86_64-macos.10-none/simd/matrix_types.h deleted file mode 100644 index 904df687a6..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/matrix_types.h +++ /dev/null @@ -1,264 +0,0 @@ -/* Copyright (c) 2014-2017 Apple, Inc. All rights reserved. - * - * This header defines nine matrix types for each of float and double, which - * are intended for use together with the vector types defined in - * . - * - * For compatibility with common graphics libraries, these matrices are stored - * in column-major order, and implemented as arrays of column vectors. - * Column-major storage order may seem a little strange if you aren't used to - * it, but for most usage the memory layout of the matrices shouldn't matter - * at all; instead you should think of matrices as abstract mathematical - * objects that you use to perform arithmetic without worrying about the - * details of the underlying representation. - * - * WARNING: vectors of length three are internally represented as length four - * vectors with one element of padding (for alignment purposes). This means - * that when a floatNx3 or doubleNx3 is viewed as a vector, it appears to - * have 4*N elements instead of the expected 3*N (with one padding element - * at the end of each column). The matrix elements are laid out in memory - * as follows: - * - * { 0, 1, 2, x, 3, 4, 5, x, ... } - * - * (where the scalar indices used above indicate the conceptual column- - * major storage order). If you aren't monkeying around with the internal - * storage details of matrices, you don't need to worry about this at all. - * Consider this yet another good reason to avoid doing so. */ - -#ifndef SIMD_MATRIX_TYPES_HEADER -#define SIMD_MATRIX_TYPES_HEADER - -#include -#if SIMD_COMPILER_HAS_REQUIRED_FEATURES - -/* Matrix types available in C, Objective-C, and C++ */ -typedef simd_float2x2 matrix_float2x2; -typedef simd_float3x2 matrix_float3x2; -typedef simd_float4x2 matrix_float4x2; - -typedef simd_float2x3 matrix_float2x3; -typedef simd_float3x3 matrix_float3x3; -typedef simd_float4x3 matrix_float4x3; - -typedef simd_float2x4 matrix_float2x4; -typedef simd_float3x4 matrix_float3x4; -typedef simd_float4x4 matrix_float4x4; - -typedef simd_double2x2 matrix_double2x2; -typedef simd_double3x2 matrix_double3x2; -typedef simd_double4x2 matrix_double4x2; - -typedef simd_double2x3 matrix_double2x3; -typedef simd_double3x3 matrix_double3x3; -typedef simd_double4x3 matrix_double4x3; - -typedef simd_double2x4 matrix_double2x4; -typedef simd_double3x4 matrix_double3x4; -typedef simd_double4x4 matrix_double4x4; - -#ifdef __cplusplus -#if defined SIMD_MATRIX_HEADER -static simd_float3x3 SIMD_NOINLINE simd_matrix3x3(simd_quatf q); -static simd_float4x4 SIMD_NOINLINE simd_matrix4x4(simd_quatf q); -static simd_double3x3 SIMD_NOINLINE simd_matrix3x3(simd_quatd q); -static simd_double4x4 SIMD_NOINLINE simd_matrix4x4(simd_quatd q); -#endif - -namespace simd { - - struct float2x2 : ::simd_float2x2 { - float2x2() { columns[0] = 0; columns[1] = 0; } -#if __has_feature(cxx_delegating_constructors) - float2x2(float diagonal) : float2x2((float2)diagonal) { } -#endif - float2x2(float2 v) { columns[0] = (float2){v.x,0}; columns[1] = (float2){0,v.y}; } - float2x2(float2 c0, float2 c1) { columns[0] = c0; columns[1] = c1; } - float2x2(::simd_float2x2 m) : ::simd_float2x2(m) { } - }; - - struct float3x2 : ::simd_float3x2 { - float3x2() { columns[0] = 0; columns[1] = 0; columns[2] = 0; } -#if __has_feature(cxx_delegating_constructors) - float3x2(float diagonal) : float3x2((float2)diagonal) { } -#endif - float3x2(float2 v) { columns[0] = (float2){v.x,0}; columns[1] = (float2){0,v.y}; columns[2] = 0; } - float3x2(float2 c0, float2 c1, float2 c2) { columns[0] = c0; columns[1] = c1; columns[2] = c2; } - float3x2(::simd_float3x2 m) : ::simd_float3x2(m) { } - }; - - struct float4x2 : ::simd_float4x2 { - float4x2() { columns[0] = 0; columns[1] = 0; columns[2] = 0; columns[3] = 0; } -#if __has_feature(cxx_delegating_constructors) - float4x2(float diagonal) : float4x2((float2)diagonal) { } -#endif - float4x2(float2 v) { columns[0] = (float2){v.x,0}; columns[1] = (float2){0,v.y}; columns[2] = 0; columns[3] = 0; } - float4x2(float2 c0, float2 c1, float2 c2, float2 c3) { columns[0] = c0; columns[1] = c1; columns[2] = c2; columns[3] = c3; } - float4x2(::simd_float4x2 m) : ::simd_float4x2(m) { } - }; - - struct float2x3 : ::simd_float2x3 { - float2x3() { columns[0] = 0; columns[1] = 0; } -#if __has_feature(cxx_delegating_constructors) - float2x3(float diagonal) : float2x3((float2)diagonal) { } -#endif - float2x3(float2 v) { columns[0] = (float3){v.x,0,0}; columns[1] = (float3){0,v.y,0}; } - float2x3(float3 c0, float3 c1) { columns[0] = c0; columns[1] = c1; } - float2x3(::simd_float2x3 m) : ::simd_float2x3(m) { } - }; - - struct float3x3 : ::simd_float3x3 { - float3x3() { columns[0] = 0; columns[1] = 0; columns[2] = 0; } -#if __has_feature(cxx_delegating_constructors) - float3x3(float diagonal) : float3x3((float3)diagonal) { } -#endif - float3x3(float3 v) { columns[0] = (float3){v.x,0,0}; columns[1] = (float3){0,v.y,0}; columns[2] = (float3){0,0,v.z}; } - float3x3(float3 c0, float3 c1, float3 c2) { columns[0] = c0; columns[1] = c1; columns[2] = c2; } - float3x3(::simd_float3x3 m) : ::simd_float3x3(m) { } -#if defined SIMD_MATRIX_HEADER - float3x3(::simd_quatf q) : ::simd_float3x3(::simd_matrix3x3(q)) { } -#endif - }; - - struct float4x3 : ::simd_float4x3 { - float4x3() { columns[0] = 0; columns[1] = 0; columns[2] = 0; columns[3] = 0; } -#if __has_feature(cxx_delegating_constructors) - float4x3(float diagonal) : float4x3((float3)diagonal) { } -#endif - float4x3(float3 v) { columns[0] = (float3){v.x,0,0}; columns[1] = (float3){0,v.y,0}; columns[2] = (float3){0,0,v.z}; columns[3] = 0; } - float4x3(float3 c0, float3 c1, float3 c2, float3 c3) { columns[0] = c0; columns[1] = c1; columns[2] = c2; columns[3] = c3; } - float4x3(::simd_float4x3 m) : ::simd_float4x3(m) { } - }; - - struct float2x4 : ::simd_float2x4 { - float2x4() { columns[0] = 0; columns[1] = 0; } -#if __has_feature(cxx_delegating_constructors) - float2x4(float diagonal) : float2x4((float2)diagonal) { } -#endif - float2x4(float2 v) { columns[0] = (float4){v.x,0,0,0}; columns[1] = (float4){0,v.y,0,0}; } - float2x4(float4 c0, float4 c1) { columns[0] = c0; columns[1] = c1; } - float2x4(::simd_float2x4 m) : ::simd_float2x4(m) { } - }; - - struct float3x4 : ::simd_float3x4 { - float3x4() { columns[0] = 0; columns[1] = 0; columns[2] = 0; } -#if __has_feature(cxx_delegating_constructors) - float3x4(float diagonal) : float3x4((float3)diagonal) { } -#endif - float3x4(float3 v) { columns[0] = (float4){v.x,0,0,0}; columns[1] = (float4){0,v.y,0,0}; columns[2] = (float4){0,0,v.z,0}; } - float3x4(float4 c0, float4 c1, float4 c2) { columns[0] = c0; columns[1] = c1; columns[2] = c2; } - float3x4(::simd_float3x4 m) : ::simd_float3x4(m) { } - }; - - struct float4x4 : ::simd_float4x4 { - float4x4() { columns[0] = 0; columns[1] = 0; columns[2] = 0; columns[3] = 0; } -#if __has_feature(cxx_delegating_constructors) - float4x4(float diagonal) : float4x4((float4)diagonal) { } -#endif - float4x4(float4 v) { columns[0] = (float4){v.x,0,0,0}; columns[1] = (float4){0,v.y,0,0}; columns[2] = (float4){0,0,v.z,0}; columns[3] = (float4){0,0,0,v.w}; } - float4x4(float4 c0, float4 c1, float4 c2, float4 c3) { columns[0] = c0; columns[1] = c1; columns[2] = c2; columns[3] = c3; } - float4x4(::simd_float4x4 m) : ::simd_float4x4(m) { } -#if defined SIMD_MATRIX_HEADER - float4x4(::simd_quatf q) : ::simd_float4x4(::simd_matrix4x4(q)) { } -#endif - }; - - struct double2x2 : ::simd_double2x2 { - double2x2() { columns[0] = 0; columns[1] = 0; } -#if __has_feature(cxx_delegating_constructors) - double2x2(double diagonal) : double2x2((double2)diagonal) { } -#endif - double2x2(double2 v) { columns[0] = (double2){v.x,0}; columns[1] = (double2){0,v.y}; } - double2x2(double2 c0, double2 c1) { columns[0] = c0; columns[1] = c1; } - double2x2(::simd_double2x2 m) : ::simd_double2x2(m) { } - }; - - struct double3x2 : ::simd_double3x2 { - double3x2() { columns[0] = 0; columns[1] = 0; columns[2] = 0; } -#if __has_feature(cxx_delegating_constructors) - double3x2(double diagonal) : double3x2((double2)diagonal) { } -#endif - double3x2(double2 v) { columns[0] = (double2){v.x,0}; columns[1] = (double2){0,v.y}; columns[2] = 0; } - double3x2(double2 c0, double2 c1, double2 c2) { columns[0] = c0; columns[1] = c1; columns[2] = c2; } - double3x2(::simd_double3x2 m) : ::simd_double3x2(m) { } - }; - - struct double4x2 : ::simd_double4x2 { - double4x2() { columns[0] = 0; columns[1] = 0; columns[2] = 0; columns[3] = 0; } -#if __has_feature(cxx_delegating_constructors) - double4x2(double diagonal) : double4x2((double2)diagonal) { } -#endif - double4x2(double2 v) { columns[0] = (double2){v.x,0}; columns[1] = (double2){0,v.y}; columns[2] = 0; columns[3] = 0; } - double4x2(double2 c0, double2 c1, double2 c2, double2 c3) { columns[0] = c0; columns[1] = c1; columns[2] = c2; columns[3] = c3; } - double4x2(::simd_double4x2 m) : ::simd_double4x2(m) { } - }; - - struct double2x3 : ::simd_double2x3 { - double2x3() { columns[0] = 0; columns[1] = 0; } -#if __has_feature(cxx_delegating_constructors) - double2x3(double diagonal) : double2x3((double2)diagonal) { } -#endif - double2x3(double2 v) { columns[0] = (double3){v.x,0,0}; columns[1] = (double3){0,v.y,0}; } - double2x3(double3 c0, double3 c1) { columns[0] = c0; columns[1] = c1; } - double2x3(::simd_double2x3 m) : ::simd_double2x3(m) { } - }; - - struct double3x3 : ::simd_double3x3 { - double3x3() { columns[0] = 0; columns[1] = 0; columns[2] = 0; } -#if __has_feature(cxx_delegating_constructors) - double3x3(double diagonal) : double3x3((double3)diagonal) { } -#endif - double3x3(double3 v) { columns[0] = (double3){v.x,0,0}; columns[1] = (double3){0,v.y,0}; columns[2] = (double3){0,0,v.z}; } - double3x3(double3 c0, double3 c1, double3 c2) { columns[0] = c0; columns[1] = c1; columns[2] = c2; } - double3x3(::simd_double3x3 m) : ::simd_double3x3(m) { } -#if defined SIMD_MATRIX_HEADER - double3x3(::simd_quatd q) : ::simd_double3x3(::simd_matrix3x3(q)) { } -#endif - }; - - struct double4x3 : ::simd_double4x3 { - double4x3() { columns[0] = 0; columns[1] = 0; columns[2] = 0; columns[3] = 0; } -#if __has_feature(cxx_delegating_constructors) - double4x3(double diagonal) : double4x3((double3)diagonal) { } -#endif - double4x3(double3 v) { columns[0] = (double3){v.x,0,0}; columns[1] = (double3){0,v.y,0}; columns[2] = (double3){0,0,v.z}; columns[3] = 0; } - double4x3(double3 c0, double3 c1, double3 c2, double3 c3) { columns[0] = c0; columns[1] = c1; columns[2] = c2; columns[3] = c3; } - double4x3(::simd_double4x3 m) : ::simd_double4x3(m) { } - }; - - struct double2x4 : ::simd_double2x4 { - double2x4() { columns[0] = 0; columns[1] = 0; } -#if __has_feature(cxx_delegating_constructors) - double2x4(double diagonal) : double2x4((double2)diagonal) { } -#endif - double2x4(double2 v) { columns[0] = (double4){v.x,0,0,0}; columns[1] = (double4){0,v.y,0,0}; } - double2x4(double4 c0, double4 c1) { columns[0] = c0; columns[1] = c1; } - double2x4(::simd_double2x4 m) : ::simd_double2x4(m) { } - }; - - struct double3x4 : ::simd_double3x4 { - double3x4() { columns[0] = 0; columns[1] = 0; columns[2] = 0; } -#if __has_feature(cxx_delegating_constructors) - double3x4(double diagonal) : double3x4((double3)diagonal) { } -#endif - double3x4(double3 v) { columns[0] = (double4){v.x,0,0,0}; columns[1] = (double4){0,v.y,0,0}; columns[2] = (double4){0,0,v.z,0}; } - double3x4(double4 c0, double4 c1, double4 c2) { columns[0] = c0; columns[1] = c1; columns[2] = c2; } - double3x4(::simd_double3x4 m) : ::simd_double3x4(m) { } - }; - - struct double4x4 : ::simd_double4x4 { - double4x4() { columns[0] = 0; columns[1] = 0; columns[2] = 0; columns[3] = 0; } -#if __has_feature(cxx_delegating_constructors) - double4x4(double diagonal) : double4x4((double4)diagonal) { } -#endif - double4x4(double4 v) { columns[0] = (double4){v.x,0,0,0}; columns[1] = (double4){0,v.y,0,0}; columns[2] = (double4){0,0,v.z,0}; columns[3] = (double4){0,0,0,v.w}; } - double4x4(double4 c0, double4 c1, double4 c2, double4 c3) { columns[0] = c0; columns[1] = c1; columns[2] = c2; columns[3] = c3; } - double4x4(::simd_double4x4 m) : ::simd_double4x4(m) { } -#if defined SIMD_MATRIX_HEADER - double4x4(::simd_quatd q) : ::simd_double4x4(::simd_matrix4x4(q)) { } -#endif - }; -} -#endif /* __cplusplus */ -#endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */ -#endif /* SIMD_MATRIX_TYPES_HEADER */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/packed.h b/lib/libc/include/x86_64-macos.10-none/simd/packed.h deleted file mode 100644 index dfdc199999..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/packed.h +++ /dev/null @@ -1,1031 +0,0 @@ -/*! @header - * This header defines fixed size vector types with relaxed alignment. For - * each vector type defined by that is not a 1- or 3- - * element vector, there is a corresponding type defined by this header that - * requires only the alignment matching that of the underlying scalar type. - * - * These types should be used to access buffers that may not be sufficiently - * aligned to allow them to be accessed using the "normal" simd vector types. - * As an example of this usage, suppose that you want to load a vector of - * four floats from an array of floats. The type simd_float4 has sixteen byte - * alignment, whereas an array of floats has only four byte alignment. - * Thus, naively casting a pointer into the array to (simd_float4 *) would - * invoke undefined behavior, and likely produce an alignment fault at - * runtime. Instead, use the corresponding packed type to load from the array: - * - *
- *  @textblock
- *  simd_float4 vector = *(packed_simd_float4 *)&array[i];
- *  // do something with vector ...
- *  @/textblock
- *  
- * - * It's important to note that the packed_ types are only needed to work with - * memory; once the data is loaded, we simply operate on it as usual using - * the simd_float4 type, as illustrated above. - * - * @copyright 2014-2017 Apple, Inc. All rights reserved. - * @unsorted */ - -#ifndef SIMD_PACKED_TYPES -#define SIMD_PACKED_TYPES - -# include -# if SIMD_COMPILER_HAS_REQUIRED_FEATURES -/*! @abstract A vector of two 8-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_char2. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -typedef __attribute__((__ext_vector_type__(2),__aligned__(1))) char simd_packed_char2; - -/*! @abstract A vector of four 8-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_char4. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -typedef __attribute__((__ext_vector_type__(4),__aligned__(1))) char simd_packed_char4; - -/*! @abstract A vector of eight 8-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ this type is also available as simd::packed_char8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(8),__aligned__(1))) char simd_packed_char8; - -/*! @abstract A vector of sixteen 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_char16. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(16),__aligned__(1))) char simd_packed_char16; - -/*! @abstract A vector of thirty-two 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_char32. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(32),__aligned__(1))) char simd_packed_char32; - -/*! @abstract A vector of sixty-four 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_char64. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(64),__aligned__(1))) char simd_packed_char64; - -/*! @abstract A vector of two 8-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_uchar2. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(2),__aligned__(1))) unsigned char simd_packed_uchar2; - -/*! @abstract A vector of four 8-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_uchar4. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(4),__aligned__(1))) unsigned char simd_packed_uchar4; - -/*! @abstract A vector of eight 8-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_uchar8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(8),__aligned__(1))) unsigned char simd_packed_uchar8; - -/*! @abstract A vector of sixteen 8-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_uchar16. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(16),__aligned__(1))) unsigned char simd_packed_uchar16; - -/*! @abstract A vector of thirty-two 8-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_uchar32. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(32),__aligned__(1))) unsigned char simd_packed_uchar32; - -/*! @abstract A vector of sixty-four 8-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_uchar64. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(64),__aligned__(1))) unsigned char simd_packed_uchar64; - -/*! @abstract A vector of two 16-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_short2. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(2),__aligned__(2))) short simd_packed_short2; - -/*! @abstract A vector of four 16-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_short4. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(4),__aligned__(2))) short simd_packed_short4; - -/*! @abstract A vector of eight 16-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_short8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(8),__aligned__(2))) short simd_packed_short8; - -/*! @abstract A vector of sixteen 16-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_short16. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(16),__aligned__(2))) short simd_packed_short16; - -/*! @abstract A vector of thirty-two 16-bit signed (twos-complement) - * integers with relaxed alignment. - * @description In C++ this type is also available as simd::packed_short32. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(32),__aligned__(2))) short simd_packed_short32; - -/*! @abstract A vector of two 16-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_ushort2. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(2),__aligned__(2))) unsigned short simd_packed_ushort2; - -/*! @abstract A vector of four 16-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_ushort4. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(4),__aligned__(2))) unsigned short simd_packed_ushort4; - -/*! @abstract A vector of eight 16-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_ushort8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(8),__aligned__(2))) unsigned short simd_packed_ushort8; - -/*! @abstract A vector of sixteen 16-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as - * simd::packed_ushort16. This type is not available in Metal. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(16),__aligned__(2))) unsigned short simd_packed_ushort16; - -/*! @abstract A vector of thirty-two 16-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as - * simd::packed_ushort32. This type is not available in Metal. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(32),__aligned__(2))) unsigned short simd_packed_ushort32; - -/*! @abstract A vector of two 32-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_int2. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) int simd_packed_int2; - -/*! @abstract A vector of four 32-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_int4. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) int simd_packed_int4; - -/*! @abstract A vector of eight 32-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_int8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) int simd_packed_int8; - -/*! @abstract A vector of sixteen 32-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_int16. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(16),__aligned__(4))) int simd_packed_int16; - -/*! @abstract A vector of two 32-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_uint2. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) unsigned int simd_packed_uint2; - -/*! @abstract A vector of four 32-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_uint4. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) unsigned int simd_packed_uint4; - -/*! @abstract A vector of eight 32-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_uint8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) unsigned int simd_packed_uint8; - -/*! @abstract A vector of sixteen 32-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_uint16. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(16),__aligned__(4))) unsigned int simd_packed_uint16; - -/*! @abstract A vector of two 32-bit floating-point numbers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_float2. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) float simd_packed_float2; - -/*! @abstract A vector of four 32-bit floating-point numbers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_float4. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) float simd_packed_float4; - -/*! @abstract A vector of eight 32-bit floating-point numbers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_float8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) float simd_packed_float8; - -/*! @abstract A vector of sixteen 32-bit floating-point numbers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_float16. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -typedef __attribute__((__ext_vector_type__(16),__aligned__(4))) float simd_packed_float16; - -/*! @abstract A vector of two 64-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_long2. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(2),__aligned__(8))) simd_long1 simd_packed_long2; -#else -typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) simd_long1 simd_packed_long2; -#endif - -/*! @abstract A vector of four 64-bit signed (twos-complement) integers with - * relaxed alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_long4. The alignment of this type is that of the underlying - * scalar element type, so you can use it to load or store from an array of - * that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(4),__aligned__(8))) simd_long1 simd_packed_long4; -#else -typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) simd_long1 simd_packed_long4; -#endif - -/*! @abstract A vector of eight 64-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C++ this type is also available as simd::packed_long8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(8),__aligned__(8))) simd_long1 simd_packed_long8; -#else -typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) simd_long1 simd_packed_long8; -#endif - -/*! @abstract A vector of two 64-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_ulong2. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(2),__aligned__(8))) simd_ulong1 simd_packed_ulong2; -#else -typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) simd_ulong1 simd_packed_ulong2; -#endif - -/*! @abstract A vector of four 64-bit unsigned integers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_ulong4. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(4),__aligned__(8))) simd_ulong1 simd_packed_ulong4; -#else -typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) simd_ulong1 simd_packed_ulong4; -#endif - -/*! @abstract A vector of eight 64-bit unsigned integers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_ulong8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(8),__aligned__(8))) simd_ulong1 simd_packed_ulong8; -#else -typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) simd_ulong1 simd_packed_ulong8; -#endif - -/*! @abstract A vector of two 64-bit floating-point numbers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_double2. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(2),__aligned__(8))) double simd_packed_double2; -#else -typedef __attribute__((__ext_vector_type__(2),__aligned__(4))) double simd_packed_double2; -#endif - -/*! @abstract A vector of four 64-bit floating-point numbers with relaxed - * alignment. - * @description In C++ and Metal, this type is also available as - * simd::packed_double4. The alignment of this type is that of the - * underlying scalar element type, so you can use it to load or store from - * an array of that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(4),__aligned__(8))) double simd_packed_double4; -#else -typedef __attribute__((__ext_vector_type__(4),__aligned__(4))) double simd_packed_double4; -#endif - -/*! @abstract A vector of eight 64-bit floating-point numbers with relaxed - * alignment. - * @description In C++ this type is also available as simd::packed_double8. - * This type is not available in Metal. The alignment of this type is only - * that of the underlying scalar element type, so you can use it to load or - * store from an array of that type. */ -#if defined __LP64__ -typedef __attribute__((__ext_vector_type__(8),__aligned__(8))) double simd_packed_double8; -#else -typedef __attribute__((__ext_vector_type__(8),__aligned__(4))) double simd_packed_double8; -#endif - -/* MARK: C++ vector types */ -#if defined __cplusplus -namespace simd { - namespace packed { - /*! @abstract A vector of two 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_char2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_char2 char2; - - /*! @abstract A vector of four 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_char4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_char4 char4; - - /*! @abstract A vector of eight 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_char8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_char8 char8; - - /*! @abstract A vector of sixteen 8-bit signed (twos-complement) - * integers with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_char16. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_char16 char16; - - /*! @abstract A vector of thirty-two 8-bit signed (twos-complement) - * integers with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_char32. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_char32 char32; - - /*! @abstract A vector of sixty-four 8-bit signed (twos-complement) - * integers with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_char64. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_char64 char64; - - /*! @abstract A vector of two 8-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_uchar2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_uchar2 uchar2; - - /*! @abstract A vector of four 8-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_uchar4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_uchar4 uchar4; - - /*! @abstract A vector of eight 8-bit unsigned integers with relaxed - * alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_uchar8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_uchar8 uchar8; - - /*! @abstract A vector of sixteen 8-bit unsigned integers with relaxed - * alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_uchar16. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_uchar16 uchar16; - - /*! @abstract A vector of thirty-two 8-bit unsigned integers with - * relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_uchar32. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_uchar32 uchar32; - - /*! @abstract A vector of sixty-four 8-bit unsigned integers with - * relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_uchar64. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_uchar64 uchar64; - - /*! @abstract A vector of two 16-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_short2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_short2 short2; - - /*! @abstract A vector of four 16-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_short4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_short4 short4; - - /*! @abstract A vector of eight 16-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_short8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_short8 short8; - - /*! @abstract A vector of sixteen 16-bit signed (twos-complement) - * integers with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_short16. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_short16 short16; - - /*! @abstract A vector of thirty-two 16-bit signed (twos-complement) - * integers with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_short32. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_short32 short32; - - /*! @abstract A vector of two 16-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_ushort2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_ushort2 ushort2; - - /*! @abstract A vector of four 16-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_ushort4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_ushort4 ushort4; - - /*! @abstract A vector of eight 16-bit unsigned integers with relaxed - * alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_ushort8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_ushort8 ushort8; - - /*! @abstract A vector of sixteen 16-bit unsigned integers with relaxed - * alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_ushort16. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_ushort16 ushort16; - - /*! @abstract A vector of thirty-two 16-bit unsigned integers with - * relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_ushort32. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_ushort32 ushort32; - - /*! @abstract A vector of two 32-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_int2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_int2 int2; - - /*! @abstract A vector of four 32-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_int4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_int4 int4; - - /*! @abstract A vector of eight 32-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_int8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_int8 int8; - - /*! @abstract A vector of sixteen 32-bit signed (twos-complement) - * integers with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_int16. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_int16 int16; - - /*! @abstract A vector of two 32-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_uint2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_uint2 uint2; - - /*! @abstract A vector of four 32-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_uint4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_uint4 uint4; - - /*! @abstract A vector of eight 32-bit unsigned integers with relaxed - * alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_uint8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_uint8 uint8; - - /*! @abstract A vector of sixteen 32-bit unsigned integers with relaxed - * alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_uint16. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_uint16 uint16; - - /*! @abstract A vector of two 32-bit floating-point numbers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_float2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_float2 float2; - - /*! @abstract A vector of four 32-bit floating-point numbers with - * relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_float4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_float4 float4; - - /*! @abstract A vector of eight 32-bit floating-point numbers with - * relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_float8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_float8 float8; - - /*! @abstract A vector of sixteen 32-bit floating-point numbers with - * relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_float16. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_float16 float16; - - /*! @abstract A vector of two 64-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_long2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_long2 long2; - - /*! @abstract A vector of four 64-bit signed (twos-complement) integers - * with relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_long4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_long4 long4; - - /*! @abstract A vector of eight 64-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_long8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_long8 long8; - - /*! @abstract A vector of two 64-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_ulong2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_ulong2 ulong2; - - /*! @abstract A vector of four 64-bit unsigned integers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_ulong4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_ulong4 ulong4; - - /*! @abstract A vector of eight 64-bit unsigned integers with relaxed - * alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_ulong8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_ulong8 ulong8; - - /*! @abstract A vector of two 64-bit floating-point numbers with relaxed - * alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_double2. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_double2 double2; - - /*! @abstract A vector of four 64-bit floating-point numbers with - * relaxed alignment. - * @description In C or Objective-C, this type is available as - * simd_packed_double4. The alignment of this type is only that of the - * underlying scalar element type, so you can use it to load or store - * from an array of that type. */ -typedef ::simd_packed_double4 double4; - - /*! @abstract A vector of eight 64-bit floating-point numbers with - * relaxed alignment. - * @description This type is not available in Metal. In C or - * Objective-C, this type is available as simd_packed_double8. The - * alignment of this type is only that of the underlying scalar element - * type, so you can use it to load or store from an array of that type. */ -typedef ::simd_packed_double8 double8; - - } /* namespace simd::packed:: */ -} /* namespace simd:: */ -#endif /* __cplusplus */ - -/* MARK: Deprecated vector types */ -/*! @group Deprecated vector types - * @discussion These are the original types used by earlier versions of the - * simd library; they are provided here for compatability with existing source - * files. Use the new ("simd_"-prefixed) types for future development. */ -/*! @abstract A vector of two 8-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_char2 - * or simd::packed_char2 instead. */ -typedef simd_packed_char2 packed_char2; - -/*! @abstract A vector of four 8-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_char4 - * or simd::packed_char4 instead. */ -typedef simd_packed_char4 packed_char4; - -/*! @abstract A vector of eight 8-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_char8 - * or simd::packed_char8 instead. */ -typedef simd_packed_char8 packed_char8; - -/*! @abstract A vector of sixteen 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_char16 - * or simd::packed_char16 instead. */ -typedef simd_packed_char16 packed_char16; - -/*! @abstract A vector of thirty-two 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_char32 - * or simd::packed_char32 instead. */ -typedef simd_packed_char32 packed_char32; - -/*! @abstract A vector of sixty-four 8-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_char64 - * or simd::packed_char64 instead. */ -typedef simd_packed_char64 packed_char64; - -/*! @abstract A vector of two 8-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uchar2 - * or simd::packed_uchar2 instead. */ -typedef simd_packed_uchar2 packed_uchar2; - -/*! @abstract A vector of four 8-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uchar4 - * or simd::packed_uchar4 instead. */ -typedef simd_packed_uchar4 packed_uchar4; - -/*! @abstract A vector of eight 8-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uchar8 - * or simd::packed_uchar8 instead. */ -typedef simd_packed_uchar8 packed_uchar8; - -/*! @abstract A vector of sixteen 8-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uchar16 - * or simd::packed_uchar16 instead. */ -typedef simd_packed_uchar16 packed_uchar16; - -/*! @abstract A vector of thirty-two 8-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uchar32 - * or simd::packed_uchar32 instead. */ -typedef simd_packed_uchar32 packed_uchar32; - -/*! @abstract A vector of sixty-four 8-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uchar64 - * or simd::packed_uchar64 instead. */ -typedef simd_packed_uchar64 packed_uchar64; - -/*! @abstract A vector of two 16-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_short2 - * or simd::packed_short2 instead. */ -typedef simd_packed_short2 packed_short2; - -/*! @abstract A vector of four 16-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_short4 - * or simd::packed_short4 instead. */ -typedef simd_packed_short4 packed_short4; - -/*! @abstract A vector of eight 16-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_short8 - * or simd::packed_short8 instead. */ -typedef simd_packed_short8 packed_short8; - -/*! @abstract A vector of sixteen 16-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_short16 - * or simd::packed_short16 instead. */ -typedef simd_packed_short16 packed_short16; - -/*! @abstract A vector of thirty-two 16-bit signed (twos-complement) - * integers with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_short32 - * or simd::packed_short32 instead. */ -typedef simd_packed_short32 packed_short32; - -/*! @abstract A vector of two 16-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_ushort2 - * or simd::packed_ushort2 instead. */ -typedef simd_packed_ushort2 packed_ushort2; - -/*! @abstract A vector of four 16-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_ushort4 - * or simd::packed_ushort4 instead. */ -typedef simd_packed_ushort4 packed_ushort4; - -/*! @abstract A vector of eight 16-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_ushort8 - * or simd::packed_ushort8 instead. */ -typedef simd_packed_ushort8 packed_ushort8; - -/*! @abstract A vector of sixteen 16-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use - * simd_packed_ushort16 or simd::packed_ushort16 instead. */ -typedef simd_packed_ushort16 packed_ushort16; - -/*! @abstract A vector of thirty-two 16-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use - * simd_packed_ushort32 or simd::packed_ushort32 instead. */ -typedef simd_packed_ushort32 packed_ushort32; - -/*! @abstract A vector of two 32-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_int2 or - * simd::packed_int2 instead. */ -typedef simd_packed_int2 packed_int2; - -/*! @abstract A vector of four 32-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_int4 or - * simd::packed_int4 instead. */ -typedef simd_packed_int4 packed_int4; - -/*! @abstract A vector of eight 32-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_int8 or - * simd::packed_int8 instead. */ -typedef simd_packed_int8 packed_int8; - -/*! @abstract A vector of sixteen 32-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_int16 - * or simd::packed_int16 instead. */ -typedef simd_packed_int16 packed_int16; - -/*! @abstract A vector of two 32-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uint2 - * or simd::packed_uint2 instead. */ -typedef simd_packed_uint2 packed_uint2; - -/*! @abstract A vector of four 32-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uint4 - * or simd::packed_uint4 instead. */ -typedef simd_packed_uint4 packed_uint4; - -/*! @abstract A vector of eight 32-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uint8 - * or simd::packed_uint8 instead. */ -typedef simd_packed_uint8 packed_uint8; - -/*! @abstract A vector of sixteen 32-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_uint16 - * or simd::packed_uint16 instead. */ -typedef simd_packed_uint16 packed_uint16; - -/*! @abstract A vector of two 32-bit floating-point numbers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_float2 - * or simd::packed_float2 instead. */ -typedef simd_packed_float2 packed_float2; - -/*! @abstract A vector of four 32-bit floating-point numbers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_float4 - * or simd::packed_float4 instead. */ -typedef simd_packed_float4 packed_float4; - -/*! @abstract A vector of eight 32-bit floating-point numbers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_float8 - * or simd::packed_float8 instead. */ -typedef simd_packed_float8 packed_float8; - -/*! @abstract A vector of sixteen 32-bit floating-point numbers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_float16 - * or simd::packed_float16 instead. */ -typedef simd_packed_float16 packed_float16; - -/*! @abstract A vector of two 64-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_long2 - * or simd::packed_long2 instead. */ -typedef simd_packed_long2 packed_long2; - -/*! @abstract A vector of four 64-bit signed (twos-complement) integers with - * relaxed alignment. - * @description This type is deprecated; you should use simd_packed_long4 - * or simd::packed_long4 instead. */ -typedef simd_packed_long4 packed_long4; - -/*! @abstract A vector of eight 64-bit signed (twos-complement) integers - * with relaxed alignment. - * @description This type is deprecated; you should use simd_packed_long8 - * or simd::packed_long8 instead. */ -typedef simd_packed_long8 packed_long8; - -/*! @abstract A vector of two 64-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_ulong2 - * or simd::packed_ulong2 instead. */ -typedef simd_packed_ulong2 packed_ulong2; - -/*! @abstract A vector of four 64-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_ulong4 - * or simd::packed_ulong4 instead. */ -typedef simd_packed_ulong4 packed_ulong4; - -/*! @abstract A vector of eight 64-bit unsigned integers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_ulong8 - * or simd::packed_ulong8 instead. */ -typedef simd_packed_ulong8 packed_ulong8; - -/*! @abstract A vector of two 64-bit floating-point numbers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_double2 - * or simd::packed_double2 instead. */ -typedef simd_packed_double2 packed_double2; - -/*! @abstract A vector of four 64-bit floating-point numbers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_double4 - * or simd::packed_double4 instead. */ -typedef simd_packed_double4 packed_double4; - -/*! @abstract A vector of eight 64-bit floating-point numbers with relaxed - * alignment. - * @description This type is deprecated; you should use simd_packed_double8 - * or simd::packed_double8 instead. */ -typedef simd_packed_double8 packed_double8; - -# endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */ -#endif \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/quaternion.h b/lib/libc/include/x86_64-macos.10-none/simd/quaternion.h deleted file mode 100644 index 32158d7e8d..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/quaternion.h +++ /dev/null @@ -1,1192 +0,0 @@ -/*! @header - * This header defines functions for constructing and using quaternions. - * @copyright 2015-2016 Apple, Inc. All rights reserved. - * @unsorted */ - -#ifndef SIMD_QUATERNIONS -#define SIMD_QUATERNIONS - -#include -#if SIMD_COMPILER_HAS_REQUIRED_FEATURES -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* MARK: - C and Objective-C float interfaces */ - -/*! @abstract Constructs a quaternion from four scalar values. - * - * @param ix The first component of the imaginary (vector) part. - * @param iy The second component of the imaginary (vector) part. - * @param iz The third component of the imaginary (vector) part. - * - * @param r The real (scalar) part. */ -static inline SIMD_CFUNC simd_quatf simd_quaternion(float ix, float iy, float iz, float r) { - return (simd_quatf){ { ix, iy, iz, r } }; -} - -/*! @abstract Constructs a quaternion from an array of four scalars. - * - * @discussion Note that the imaginary part of the quaternion comes from - * array elements 0, 1, and 2, and the real part comes from element 3. */ -static inline SIMD_NONCONST simd_quatf simd_quaternion(const float xyzr[4]) { - return (simd_quatf){ *(const simd_packed_float4 *)xyzr }; -} - -/*! @abstract Constructs a quaternion from a four-element vector. - * - * @discussion Note that the imaginary (vector) part of the quaternion comes - * from lanes 0, 1, and 2 of the vector, and the real (scalar) part comes from - * lane 3. */ -static inline SIMD_CFUNC simd_quatf simd_quaternion(simd_float4 xyzr) { - return (simd_quatf){ xyzr }; -} - -/*! @abstract Constructs a quaternion that rotates by `angle` radians about - * `axis`. */ -static inline SIMD_CFUNC simd_quatf simd_quaternion(float angle, simd_float3 axis); - -/*! @abstract Construct a quaternion that rotates from one vector to another. - * - * @param from A normalized three-element vector. - * @param to A normalized three-element vector. - * - * @discussion The rotation axis is `simd_cross(from, to)`. If `from` and - * `to` point in opposite directions (to within machine precision), an - * arbitrary rotation axis is chosen, and the angle is pi radians. */ -static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float3 from, simd_float3 to); - -/*! @abstract Construct a quaternion from a 3x3 rotation `matrix`. - * - * @discussion If `matrix` is not orthogonal with determinant 1, the result - * is undefined. */ -static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float3x3 matrix); - -/*! @abstract Construct a quaternion from a 4x4 rotation `matrix`. - * - * @discussion The last row and column of the matrix are ignored. This - * function is equivalent to calling simd_quaternion with the upper-left 3x3 - * submatrix . */ -static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float4x4 matrix); - -/*! @abstract The real (scalar) part of the quaternion `q`. */ -static inline SIMD_CFUNC float simd_real(simd_quatf q) { - return q.vector.w; -} - -/*! @abstract The imaginary (vector) part of the quaternion `q`. */ -static inline SIMD_CFUNC simd_float3 simd_imag(simd_quatf q) { - return q.vector.xyz; -} - -/*! @abstract The angle (in radians) of rotation represented by `q`. */ -static inline SIMD_CFUNC float simd_angle(simd_quatf q); - -/*! @abstract The normalized axis (a 3-element vector) around which the - * action of the quaternion `q` rotates. */ -static inline SIMD_CFUNC simd_float3 simd_axis(simd_quatf q); - -/*! @abstract The sum of the quaternions `p` and `q`. */ -static inline SIMD_CFUNC simd_quatf simd_add(simd_quatf p, simd_quatf q); - -/*! @abstract The difference of the quaternions `p` and `q`. */ -static inline SIMD_CFUNC simd_quatf simd_sub(simd_quatf p, simd_quatf q); - -/*! @abstract The product of the quaternions `p` and `q`. */ -static inline SIMD_CFUNC simd_quatf simd_mul(simd_quatf p, simd_quatf q); - -/*! @abstract The quaternion `q` scaled by the real value `a`. */ -static inline SIMD_CFUNC simd_quatf simd_mul(simd_quatf q, float a); - -/*! @abstract The quaternion `q` scaled by the real value `a`. */ -static inline SIMD_CFUNC simd_quatf simd_mul(float a, simd_quatf q); - -/*! @abstract The conjugate of the quaternion `q`. */ -static inline SIMD_CFUNC simd_quatf simd_conjugate(simd_quatf q); - -/*! @abstract The (multiplicative) inverse of the quaternion `q`. */ -static inline SIMD_CFUNC simd_quatf simd_inverse(simd_quatf q); - -/*! @abstract The negation (additive inverse) of the quaternion `q`. */ -static inline SIMD_CFUNC simd_quatf simd_negate(simd_quatf q); - -/*! @abstract The dot product of the quaternions `p` and `q` interpreted as - * four-dimensional vectors. */ -static inline SIMD_CFUNC float simd_dot(simd_quatf p, simd_quatf q); - -/*! @abstract The length of the quaternion `q`. */ -static inline SIMD_CFUNC float simd_length(simd_quatf q); - -/*! @abstract The unit quaternion obtained by normalizing `q`. */ -static inline SIMD_CFUNC simd_quatf simd_normalize(simd_quatf q); - -/*! @abstract Rotates the vector `v` by the quaternion `q`. */ -static inline SIMD_CFUNC simd_float3 simd_act(simd_quatf q, simd_float3 v); - -/*! @abstract Logarithm of the quaternion `q`. - * @discussion Do not call this function directly; use `log(q)` instead. - * - * We can write a quaternion `q` in the form: `r(cos(t) + sin(t)v)` where - * `r` is the length of `q`, `t` is an angle, and `v` is a unit 3-vector. - * The logarithm of `q` is `log(r) + tv`, just like the logarithm of the - * complex number `r*(cos(t) + i sin(t))` is `log(r) + it`. - * - * Note that this function is not robust against poorly-scaled non-unit - * quaternions, because it is primarily used for spline interpolation of - * unit quaternions. If you need to compute a robust logarithm of general - * quaternions, you can use the following approach: - * - * scale = simd_reduce_max(simd_abs(q.vector)); - * logq = log(simd_recip(scale)*q); - * logq.real += log(scale); - * return logq; */ -static SIMD_NOINLINE simd_quatf __tg_log(simd_quatf q); - -/*! @abstract Inverse of `log( )`; the exponential map on quaternions. - * @discussion Do not call this function directly; use `exp(q)` instead. */ -static SIMD_NOINLINE simd_quatf __tg_exp(simd_quatf q); - -/*! @abstract Spherical linear interpolation along the shortest arc between - * quaternions `q0` and `q1`. */ -static SIMD_NOINLINE simd_quatf simd_slerp(simd_quatf q0, simd_quatf q1, float t); - -/*! @abstract Spherical linear interpolation along the longest arc between - * quaternions `q0` and `q1`. */ -static SIMD_NOINLINE simd_quatf simd_slerp_longest(simd_quatf q0, simd_quatf q1, float t); - -/*! @abstract Interpolate between quaternions along a spherical cubic spline. - * - * @discussion The function interpolates between q1 and q2. q0 is the left - * endpoint of the previous interval, and q3 is the right endpoint of the next - * interval. Use this function to smoothly interpolate between a sequence of - * rotations. */ -static SIMD_NOINLINE simd_quatf simd_spline(simd_quatf q0, simd_quatf q1, simd_quatf q2, simd_quatf q3, float t); - -/*! @abstract Spherical cubic Bezier interpolation between quaternions. - * - * @discussion The function treats q0 ... q3 as control points and uses slerp - * in place of lerp in the De Castlejeau algorithm. The endpoints of - * interpolation are thus q0 and q3, and the curve will not generally pass - * through q1 or q2. Note that the convex hull property of "standard" Bezier - * curve does not hold on the sphere. */ -static SIMD_NOINLINE simd_quatf simd_bezier(simd_quatf q0, simd_quatf q1, simd_quatf q2, simd_quatf q3, float t); - -#ifdef __cplusplus -} /* extern "C" */ -/* MARK: - C++ float interfaces */ - -namespace simd { - struct quatf : ::simd_quatf { - /*! @abstract The identity quaternion. */ - quatf( ) : ::simd_quatf(::simd_quaternion((float4){0,0,0,1})) { } - - /*! @abstract Constructs a C++ quaternion from a C quaternion. */ - quatf(::simd_quatf q) : ::simd_quatf(q) { } - - /*! @abstract Constructs a quaternion from components. */ - quatf(float ix, float iy, float iz, float r) : ::simd_quatf(::simd_quaternion(ix, iy, iz, r)) { } - - /*! @abstract Constructs a quaternion from an array of scalars. */ - quatf(const float xyzr[4]) : ::simd_quatf(::simd_quaternion(xyzr)) { } - - /*! @abstract Constructs a quaternion from a vector. */ - quatf(float4 xyzr) : ::simd_quatf(::simd_quaternion(xyzr)) { } - - /*! @abstract Quaternion representing rotation about `axis` by `angle` - * radians. */ - quatf(float angle, float3 axis) : ::simd_quatf(::simd_quaternion(angle, axis)) { } - - /*! @abstract Quaternion that rotates `from` into `to`. */ - quatf(float3 from, float3 to) : ::simd_quatf(::simd_quaternion(from, to)) { } - - /*! @abstract Constructs a quaternion from a rotation matrix. */ - quatf(::simd_float3x3 matrix) : ::simd_quatf(::simd_quaternion(matrix)) { } - - /*! @abstract Constructs a quaternion from a rotation matrix. */ - quatf(::simd_float4x4 matrix) : ::simd_quatf(::simd_quaternion(matrix)) { } - - /*! @abstract The real (scalar) part of the quaternion. */ - float real(void) const { return ::simd_real(*this); } - - /*! @abstract The imaginary (vector) part of the quaternion. */ - float3 imag(void) const { return ::simd_imag(*this); } - - /*! @abstract The angle the quaternion rotates by. */ - float angle(void) const { return ::simd_angle(*this); } - - /*! @abstract The axis the quaternion rotates about. */ - float3 axis(void) const { return ::simd_axis(*this); } - - /*! @abstract The length of the quaternion. */ - float length(void) const { return ::simd_length(*this); } - - /*! @abstract Act on the vector `v` by rotation. */ - float3 operator()(const ::simd_float3 v) const { return ::simd_act(*this, v); } - }; - - static SIMD_CPPFUNC quatf operator+(const ::simd_quatf p, const ::simd_quatf q) { return ::simd_add(p, q); } - static SIMD_CPPFUNC quatf operator-(const ::simd_quatf p, const ::simd_quatf q) { return ::simd_sub(p, q); } - static SIMD_CPPFUNC quatf operator-(const ::simd_quatf p) { return ::simd_negate(p); } - static SIMD_CPPFUNC quatf operator*(const float r, const ::simd_quatf p) { return ::simd_mul(r, p); } - static SIMD_CPPFUNC quatf operator*(const ::simd_quatf p, const float r) { return ::simd_mul(p, r); } - static SIMD_CPPFUNC quatf operator*(const ::simd_quatf p, const ::simd_quatf q) { return ::simd_mul(p, q); } - static SIMD_CPPFUNC quatf operator/(const ::simd_quatf p, const ::simd_quatf q) { return ::simd_mul(p, ::simd_inverse(q)); } - static SIMD_CPPFUNC quatf operator+=(quatf &p, const ::simd_quatf q) { return p = p+q; } - static SIMD_CPPFUNC quatf operator-=(quatf &p, const ::simd_quatf q) { return p = p-q; } - static SIMD_CPPFUNC quatf operator*=(quatf &p, const float r) { return p = p*r; } - static SIMD_CPPFUNC quatf operator*=(quatf &p, const ::simd_quatf q) { return p = p*q; } - static SIMD_CPPFUNC quatf operator/=(quatf &p, const ::simd_quatf q) { return p = p/q; } - - /*! @abstract The conjugate of the quaternion `q`. */ - static SIMD_CPPFUNC quatf conjugate(const ::simd_quatf p) { return ::simd_conjugate(p); } - - /*! @abstract The (multiplicative) inverse of the quaternion `q`. */ - static SIMD_CPPFUNC quatf inverse(const ::simd_quatf p) { return ::simd_inverse(p); } - - /*! @abstract The dot product of the quaternions `p` and `q` interpreted as - * four-dimensional vectors. */ - static SIMD_CPPFUNC float dot(const ::simd_quatf p, const ::simd_quatf q) { return ::simd_dot(p, q); } - - /*! @abstract The unit quaternion obtained by normalizing `q`. */ - static SIMD_CPPFUNC quatf normalize(const ::simd_quatf p) { return ::simd_normalize(p); } - - /*! @abstract logarithm of the quaternion `q`. */ - static SIMD_CPPFUNC quatf log(const ::simd_quatf q) { return ::__tg_log(q); } - - /*! @abstract exponential map of quaterion `q`. */ - static SIMD_CPPFUNC quatf exp(const ::simd_quatf q) { return ::__tg_exp(q); } - - /*! @abstract Spherical linear interpolation along the shortest arc between - * quaternions `q0` and `q1`. */ - static SIMD_CPPFUNC quatf slerp(const ::simd_quatf p0, const ::simd_quatf p1, float t) { return ::simd_slerp(p0, p1, t); } - - /*! @abstract Spherical linear interpolation along the longest arc between - * quaternions `q0` and `q1`. */ - static SIMD_CPPFUNC quatf slerp_longest(const ::simd_quatf p0, const ::simd_quatf p1, float t) { return ::simd_slerp_longest(p0, p1, t); } - - /*! @abstract Interpolate between quaternions along a spherical cubic spline. - * - * @discussion The function interpolates between q1 and q2. q0 is the left - * endpoint of the previous interval, and q3 is the right endpoint of the next - * interval. Use this function to smoothly interpolate between a sequence of - * rotations. */ - static SIMD_CPPFUNC quatf spline(const ::simd_quatf p0, const ::simd_quatf p1, const ::simd_quatf p2, const ::simd_quatf p3, float t) { return ::simd_spline(p0, p1, p2, p3, t); } - - /*! @abstract Spherical cubic Bezier interpolation between quaternions. - * - * @discussion The function treats q0 ... q3 as control points and uses slerp - * in place of lerp in the De Castlejeau algorithm. The endpoints of - * interpolation are thus q0 and q3, and the curve will not generally pass - * through q1 or q2. Note that the convex hull property of "standard" Bezier - * curve does not hold on the sphere. */ - static SIMD_CPPFUNC quatf bezier(const ::simd_quatf p0, const ::simd_quatf p1, const ::simd_quatf p2, const ::simd_quatf p3, float t) { return ::simd_bezier(p0, p1, p2, p3, t); } -} - -extern "C" { -#endif /* __cplusplus */ - -/* MARK: - float implementations */ - -#include -#include - -/* tg_promote is implementation gobbledygook that enables the compile-time - * dispatching in tgmath.h to work its magic. */ -static simd_quatf __attribute__((__overloadable__)) __tg_promote(simd_quatf); - -/*! @abstract Constructs a quaternion from imaginary and real parts. - * @discussion This function is hidden behind an underscore to avoid confusion - * with the angle-axis constructor. */ -static inline SIMD_CFUNC simd_quatf _simd_quaternion(simd_float3 imag, float real) { - return simd_quaternion(simd_make_float4(imag, real)); -} - -static inline SIMD_CFUNC simd_quatf simd_quaternion(float angle, simd_float3 axis) { - return _simd_quaternion(sin(angle/2) * axis, cos(angle/2)); -} - -static inline SIMD_CFUNC float simd_angle(simd_quatf q) { - return 2*atan2(simd_length(q.vector.xyz), q.vector.w); -} - -static inline SIMD_CFUNC simd_float3 simd_axis(simd_quatf q) { - return simd_normalize(q.vector.xyz); -} - -static inline SIMD_CFUNC simd_quatf simd_add(simd_quatf p, simd_quatf q) { - return simd_quaternion(p.vector + q.vector); -} - -static inline SIMD_CFUNC simd_quatf simd_sub(simd_quatf p, simd_quatf q) { - return simd_quaternion(p.vector - q.vector); -} - -static inline SIMD_CFUNC simd_quatf simd_mul(simd_quatf p, simd_quatf q) { - #pragma STDC FP_CONTRACT ON - return simd_quaternion((p.vector.x * __builtin_shufflevector(q.vector, -q.vector, 3,6,1,4) + - p.vector.y * __builtin_shufflevector(q.vector, -q.vector, 2,3,4,5)) + - (p.vector.z * __builtin_shufflevector(q.vector, -q.vector, 5,0,3,6) + - p.vector.w * q.vector)); -} - -static inline SIMD_CFUNC simd_quatf simd_mul(simd_quatf q, float a) { - return simd_quaternion(a * q.vector); -} - -static inline SIMD_CFUNC simd_quatf simd_mul(float a, simd_quatf q) { - return simd_mul(q,a); -} - -static inline SIMD_CFUNC simd_quatf simd_conjugate(simd_quatf q) { - return simd_quaternion(q.vector * (simd_float4){-1,-1,-1, 1}); -} - -static inline SIMD_CFUNC simd_quatf simd_inverse(simd_quatf q) { - return simd_quaternion(simd_conjugate(q).vector * simd_recip(simd_length_squared(q.vector))); -} - -static inline SIMD_CFUNC simd_quatf simd_negate(simd_quatf q) { - return simd_quaternion(-q.vector); -} - -static inline SIMD_CFUNC float simd_dot(simd_quatf p, simd_quatf q) { - return simd_dot(p.vector, q.vector); -} - -static inline SIMD_CFUNC float simd_length(simd_quatf q) { - return simd_length(q.vector); -} - -static inline SIMD_CFUNC simd_quatf simd_normalize(simd_quatf q) { - float length_squared = simd_length_squared(q.vector); - if (length_squared == 0) { - return simd_quaternion((simd_float4){0,0,0,1}); - } - return simd_quaternion(q.vector * simd_rsqrt(length_squared)); -} - -#if defined __arm__ || defined __arm64__ -/*! @abstract Multiplies the vector `v` by the quaternion `q`. - * - * @discussion This IS NOT the action of `q` on `v` (i.e. this is not rotation - * by `q`. That operation is provided by `simd_act(q, v)`. This function is an - * implementation detail and you should not call it directly. It may be - * removed or modified in future versions of the simd module. */ -static inline SIMD_CFUNC simd_quatf _simd_mul_vq(simd_float3 v, simd_quatf q) { - #pragma STDC FP_CONTRACT ON - return simd_quaternion(v.x * __builtin_shufflevector(q.vector, -q.vector, 3,6,1,4) + - v.y * __builtin_shufflevector(q.vector, -q.vector, 2,3,4,5) + - v.z * __builtin_shufflevector(q.vector, -q.vector, 5,0,3,6)); -} -#endif - -static inline SIMD_CFUNC simd_float3 simd_act(simd_quatf q, simd_float3 v) { -#if defined __arm__ || defined __arm64__ - return simd_mul(q, _simd_mul_vq(v, simd_conjugate(q))).vector.xyz; -#else - #pragma STDC FP_CONTRACT ON - simd_float3 t = 2*simd_cross(simd_imag(q),v); - return v + simd_real(q)*t + simd_cross(simd_imag(q), t); -#endif -} - -static SIMD_NOINLINE simd_quatf __tg_log(simd_quatf q) { - float real = __tg_log(simd_length_squared(q.vector))/2; - if (simd_equal(simd_imag(q), 0)) return _simd_quaternion(0, real); - simd_float3 imag = __tg_acos(simd_real(q)/simd_length(q)) * simd_normalize(simd_imag(q)); - return _simd_quaternion(imag, real); -} - -static SIMD_NOINLINE simd_quatf __tg_exp(simd_quatf q) { - // angle is actually *twice* the angle of the rotation corresponding to - // the resulting quaternion, which is why we don't simply use the (angle, - // axis) constructor to generate `unit`. - float angle = simd_length(simd_imag(q)); - if (angle == 0) return _simd_quaternion(0, exp(simd_real(q))); - simd_float3 axis = simd_normalize(simd_imag(q)); - simd_quatf unit = _simd_quaternion(sin(angle)*axis, cosf(angle)); - return simd_mul(exp(simd_real(q)), unit); -} - -/*! @abstract Implementation detail of the `simd_quaternion(from, to)` - * initializer. - * - * @discussion Computes the quaternion rotation `from` to `to` if they are - * separated by less than 90 degrees. Not numerically stable for larger - * angles. This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static inline SIMD_CFUNC simd_quatf _simd_quaternion_reduced(simd_float3 from, simd_float3 to) { - simd_float3 half = simd_normalize(from + to); - return _simd_quaternion(simd_cross(from, half), simd_dot(from, half)); -} - -static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float3 from, simd_float3 to) { - - // If the angle between from and to is not too big, we can compute the - // rotation accurately using a simple implementation. - if (simd_dot(from, to) >= 0) { - return _simd_quaternion_reduced(from, to); - } - - // Because from and to are more than 90 degrees apart, we compute the - // rotation in two stages (from -> half), (half -> to) to preserve numerical - // accuracy. - simd_float3 half = simd_normalize(from + to); - - if (simd_length_squared(half) == 0) { - // half is nearly zero, so from and to point in nearly opposite directions - // and the rotation is numerically underspecified. Pick an axis orthogonal - // to the vectors, and use an angle of pi radians. - simd_float3 abs_from = simd_abs(from); - if (abs_from.x <= abs_from.y && abs_from.x <= abs_from.z) - return _simd_quaternion(simd_normalize(simd_cross(from, (simd_float3){1,0,0})), 0.f); - else if (abs_from.y <= abs_from.z) - return _simd_quaternion(simd_normalize(simd_cross(from, (simd_float3){0,1,0})), 0.f); - else - return _simd_quaternion(simd_normalize(simd_cross(from, (simd_float3){0,0,1})), 0.f); - } - - // Compute the two-step rotation. */ - return simd_mul(_simd_quaternion_reduced(from, half), - _simd_quaternion_reduced(half, to)); -} - -static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float3x3 matrix) { - const simd_float3 *mat = matrix.columns; - float trace = mat[0][0] + mat[1][1] + mat[2][2]; - if (trace >= 0.0) { - float r = 2*sqrt(1 + trace); - float rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[1][2] - mat[2][1]), - rinv*(mat[2][0] - mat[0][2]), - rinv*(mat[0][1] - mat[1][0]), - r/4); - } else if (mat[0][0] >= mat[1][1] && mat[0][0] >= mat[2][2]) { - float r = 2*sqrt(1 - mat[1][1] - mat[2][2] + mat[0][0]); - float rinv = simd_recip(r); - return simd_quaternion(r/4, - rinv*(mat[0][1] + mat[1][0]), - rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] - mat[2][1])); - } else if (mat[1][1] >= mat[2][2]) { - float r = 2*sqrt(1 - mat[0][0] - mat[2][2] + mat[1][1]); - float rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][1] + mat[1][0]), - r/4, - rinv*(mat[1][2] + mat[2][1]), - rinv*(mat[2][0] - mat[0][2])); - } else { - float r = 2*sqrt(1 - mat[0][0] - mat[1][1] + mat[2][2]); - float rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] + mat[2][1]), - r/4, - rinv*(mat[0][1] - mat[1][0])); - } -} - -static SIMD_NOINLINE simd_quatf simd_quaternion(simd_float4x4 matrix) { - const simd_float4 *mat = matrix.columns; - float trace = mat[0][0] + mat[1][1] + mat[2][2]; - if (trace >= 0.0) { - float r = 2*sqrt(1 + trace); - float rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[1][2] - mat[2][1]), - rinv*(mat[2][0] - mat[0][2]), - rinv*(mat[0][1] - mat[1][0]), - r/4); - } else if (mat[0][0] >= mat[1][1] && mat[0][0] >= mat[2][2]) { - float r = 2*sqrt(1 - mat[1][1] - mat[2][2] + mat[0][0]); - float rinv = simd_recip(r); - return simd_quaternion(r/4, - rinv*(mat[0][1] + mat[1][0]), - rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] - mat[2][1])); - } else if (mat[1][1] >= mat[2][2]) { - float r = 2*sqrt(1 - mat[0][0] - mat[2][2] + mat[1][1]); - float rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][1] + mat[1][0]), - r/4, - rinv*(mat[1][2] + mat[2][1]), - rinv*(mat[2][0] - mat[0][2])); - } else { - float r = 2*sqrt(1 - mat[0][0] - mat[1][1] + mat[2][2]); - float rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] + mat[2][1]), - r/4, - rinv*(mat[0][1] - mat[1][0])); - } -} - -/*! @abstract The angle between p and q interpreted as 4-dimensional vectors. - * - * @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_NOINLINE float _simd_angle(simd_quatf p, simd_quatf q) { - return 2*atan2(simd_length(p.vector - q.vector), simd_length(p.vector + q.vector)); -} - -/*! @abstract sin(x)/x. - * - * @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_CFUNC float _simd_sinc(float x) { - if (x == 0) return 1; - return sin(x)/x; -} - -/*! @abstract Spherical lerp between q0 and q1. - * - * @discussion This function may interpolate along either the longer or - * shorter path between q0 and q1; it is used as an implementation detail - * in `simd_slerp` and `simd_slerp_longest`; you should use those functions - * instead of calling this directly. */ -static SIMD_NOINLINE simd_quatf _simd_slerp_internal(simd_quatf q0, simd_quatf q1, float t) { - float s = 1 - t; - float a = _simd_angle(q0, q1); - float r = simd_recip(_simd_sinc(a)); - return simd_normalize(simd_quaternion(_simd_sinc(s*a)*r*s*q0.vector + _simd_sinc(t*a)*r*t*q1.vector)); -} - -static SIMD_NOINLINE simd_quatf simd_slerp(simd_quatf q0, simd_quatf q1, float t) { - if (simd_dot(q0, q1) >= 0) - return _simd_slerp_internal(q0, q1, t); - return _simd_slerp_internal(q0, simd_negate(q1), t); -} - -static SIMD_NOINLINE simd_quatf simd_slerp_longest(simd_quatf q0, simd_quatf q1, float t) { - if (simd_dot(q0, q1) >= 0) - return _simd_slerp_internal(q0, simd_negate(q1), t); - return _simd_slerp_internal(q0, q1, t); -} - -/*! @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_NOINLINE simd_quatf _simd_intermediate(simd_quatf q0, simd_quatf q1, simd_quatf q2) { - simd_quatf p0 = __tg_log(simd_mul(q0, simd_inverse(q1))); - simd_quatf p2 = __tg_log(simd_mul(q2, simd_inverse(q1))); - return simd_normalize(simd_mul(q1, __tg_exp(simd_mul(-0.25, simd_add(p0,p2))))); -} - -/*! @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_NOINLINE simd_quatf _simd_squad(simd_quatf q0, simd_quatf qa, simd_quatf qb, simd_quatf q1, float t) { - simd_quatf r0 = _simd_slerp_internal(q0, q1, t); - simd_quatf r1 = _simd_slerp_internal(qa, qb, t); - return _simd_slerp_internal(r0, r1, 2*t*(1 - t)); -} - -static SIMD_NOINLINE simd_quatf simd_spline(simd_quatf q0, simd_quatf q1, simd_quatf q2, simd_quatf q3, float t) { - simd_quatf qa = _simd_intermediate(q0, q1, q2); - simd_quatf qb = _simd_intermediate(q1, q2, q3); - return _simd_squad(q1, qa, qb, q2, t); -} - -static SIMD_NOINLINE simd_quatf simd_bezier(simd_quatf q0, simd_quatf q1, simd_quatf q2, simd_quatf q3, float t) { - simd_quatf q01 = _simd_slerp_internal(q0, q1, t); - simd_quatf q12 = _simd_slerp_internal(q1, q2, t); - simd_quatf q23 = _simd_slerp_internal(q2, q3, t); - simd_quatf q012 = _simd_slerp_internal(q01, q12, t); - simd_quatf q123 = _simd_slerp_internal(q12, q23, t); - return _simd_slerp_internal(q012, q123, t); -} - -/* MARK: - C and Objective-C double interfaces */ - -/*! @abstract Constructs a quaternion from four scalar values. - * - * @param ix The first component of the imaginary (vector) part. - * @param iy The second component of the imaginary (vector) part. - * @param iz The third component of the imaginary (vector) part. - * - * @param r The real (scalar) part. */ -static inline SIMD_CFUNC simd_quatd simd_quaternion(double ix, double iy, double iz, double r) { - return (simd_quatd){ { ix, iy, iz, r } }; -} - -/*! @abstract Constructs a quaternion from an array of four scalars. - * - * @discussion Note that the imaginary part of the quaternion comes from - * array elements 0, 1, and 2, and the real part comes from element 3. */ -static inline SIMD_NONCONST simd_quatd simd_quaternion(const double xyzr[4]) { - return (simd_quatd){ *(const simd_packed_double4 *)xyzr }; -} - -/*! @abstract Constructs a quaternion from a four-element vector. - * - * @discussion Note that the imaginary (vector) part of the quaternion comes - * from lanes 0, 1, and 2 of the vector, and the real (scalar) part comes from - * lane 3. */ -static inline SIMD_CFUNC simd_quatd simd_quaternion(simd_double4 xyzr) { - return (simd_quatd){ xyzr }; -} - -/*! @abstract Constructs a quaternion that rotates by `angle` radians about - * `axis`. */ -static inline SIMD_CFUNC simd_quatd simd_quaternion(double angle, simd_double3 axis); - -/*! @abstract Construct a quaternion that rotates from one vector to another. - * - * @param from A normalized three-element vector. - * @param to A normalized three-element vector. - * - * @discussion The rotation axis is `simd_cross(from, to)`. If `from` and - * `to` point in opposite directions (to within machine precision), an - * arbitrary rotation axis is chosen, and the angle is pi radians. */ -static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double3 from, simd_double3 to); - -/*! @abstract Construct a quaternion from a 3x3 rotation `matrix`. - * - * @discussion If `matrix` is not orthogonal with determinant 1, the result - * is undefined. */ -static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double3x3 matrix); - -/*! @abstract Construct a quaternion from a 4x4 rotation `matrix`. - * - * @discussion The last row and column of the matrix are ignored. This - * function is equivalent to calling simd_quaternion with the upper-left 3x3 - * submatrix . */ -static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double4x4 matrix); - -/*! @abstract The real (scalar) part of the quaternion `q`. */ -static inline SIMD_CFUNC double simd_real(simd_quatd q) { - return q.vector.w; -} - -/*! @abstract The imaginary (vector) part of the quaternion `q`. */ -static inline SIMD_CFUNC simd_double3 simd_imag(simd_quatd q) { - return q.vector.xyz; -} - -/*! @abstract The angle (in radians) of rotation represented by `q`. */ -static inline SIMD_CFUNC double simd_angle(simd_quatd q); - -/*! @abstract The normalized axis (a 3-element vector) around which the - * action of the quaternion `q` rotates. */ -static inline SIMD_CFUNC simd_double3 simd_axis(simd_quatd q); - -/*! @abstract The sum of the quaternions `p` and `q`. */ -static inline SIMD_CFUNC simd_quatd simd_add(simd_quatd p, simd_quatd q); - -/*! @abstract The difference of the quaternions `p` and `q`. */ -static inline SIMD_CFUNC simd_quatd simd_sub(simd_quatd p, simd_quatd q); - -/*! @abstract The product of the quaternions `p` and `q`. */ -static inline SIMD_CFUNC simd_quatd simd_mul(simd_quatd p, simd_quatd q); - -/*! @abstract The quaternion `q` scaled by the real value `a`. */ -static inline SIMD_CFUNC simd_quatd simd_mul(simd_quatd q, double a); - -/*! @abstract The quaternion `q` scaled by the real value `a`. */ -static inline SIMD_CFUNC simd_quatd simd_mul(double a, simd_quatd q); - -/*! @abstract The conjugate of the quaternion `q`. */ -static inline SIMD_CFUNC simd_quatd simd_conjugate(simd_quatd q); - -/*! @abstract The (multiplicative) inverse of the quaternion `q`. */ -static inline SIMD_CFUNC simd_quatd simd_inverse(simd_quatd q); - -/*! @abstract The negation (additive inverse) of the quaternion `q`. */ -static inline SIMD_CFUNC simd_quatd simd_negate(simd_quatd q); - -/*! @abstract The dot product of the quaternions `p` and `q` interpreted as - * four-dimensional vectors. */ -static inline SIMD_CFUNC double simd_dot(simd_quatd p, simd_quatd q); - -/*! @abstract The length of the quaternion `q`. */ -static inline SIMD_CFUNC double simd_length(simd_quatd q); - -/*! @abstract The unit quaternion obtained by normalizing `q`. */ -static inline SIMD_CFUNC simd_quatd simd_normalize(simd_quatd q); - -/*! @abstract Rotates the vector `v` by the quaternion `q`. */ -static inline SIMD_CFUNC simd_double3 simd_act(simd_quatd q, simd_double3 v); - -/*! @abstract Logarithm of the quaternion `q`. - * @discussion Do not call this function directly; use `log(q)` instead. - * - * We can write a quaternion `q` in the form: `r(cos(t) + sin(t)v)` where - * `r` is the length of `q`, `t` is an angle, and `v` is a unit 3-vector. - * The logarithm of `q` is `log(r) + tv`, just like the logarithm of the - * complex number `r*(cos(t) + i sin(t))` is `log(r) + it`. - * - * Note that this function is not robust against poorly-scaled non-unit - * quaternions, because it is primarily used for spline interpolation of - * unit quaternions. If you need to compute a robust logarithm of general - * quaternions, you can use the following approach: - * - * scale = simd_reduce_max(simd_abs(q.vector)); - * logq = log(simd_recip(scale)*q); - * logq.real += log(scale); - * return logq; */ -static SIMD_NOINLINE simd_quatd __tg_log(simd_quatd q); - -/*! @abstract Inverse of `log( )`; the exponential map on quaternions. - * @discussion Do not call this function directly; use `exp(q)` instead. */ -static SIMD_NOINLINE simd_quatd __tg_exp(simd_quatd q); - -/*! @abstract Spherical linear interpolation along the shortest arc between - * quaternions `q0` and `q1`. */ -static SIMD_NOINLINE simd_quatd simd_slerp(simd_quatd q0, simd_quatd q1, double t); - -/*! @abstract Spherical linear interpolation along the longest arc between - * quaternions `q0` and `q1`. */ -static SIMD_NOINLINE simd_quatd simd_slerp_longest(simd_quatd q0, simd_quatd q1, double t); - -/*! @abstract Interpolate between quaternions along a spherical cubic spline. - * - * @discussion The function interpolates between q1 and q2. q0 is the left - * endpoint of the previous interval, and q3 is the right endpoint of the next - * interval. Use this function to smoothly interpolate between a sequence of - * rotations. */ -static SIMD_NOINLINE simd_quatd simd_spline(simd_quatd q0, simd_quatd q1, simd_quatd q2, simd_quatd q3, double t); - -/*! @abstract Spherical cubic Bezier interpolation between quaternions. - * - * @discussion The function treats q0 ... q3 as control points and uses slerp - * in place of lerp in the De Castlejeau algorithm. The endpoints of - * interpolation are thus q0 and q3, and the curve will not generally pass - * through q1 or q2. Note that the convex hull property of "standard" Bezier - * curve does not hold on the sphere. */ -static SIMD_NOINLINE simd_quatd simd_bezier(simd_quatd q0, simd_quatd q1, simd_quatd q2, simd_quatd q3, double t); - -#ifdef __cplusplus -} /* extern "C" */ -/* MARK: - C++ double interfaces */ - -namespace simd { - struct quatd : ::simd_quatd { - /*! @abstract The identity quaternion. */ - quatd( ) : ::simd_quatd(::simd_quaternion((double4){0,0,0,1})) { } - - /*! @abstract Constructs a C++ quaternion from a C quaternion. */ - quatd(::simd_quatd q) : ::simd_quatd(q) { } - - /*! @abstract Constructs a quaternion from components. */ - quatd(double ix, double iy, double iz, double r) : ::simd_quatd(::simd_quaternion(ix, iy, iz, r)) { } - - /*! @abstract Constructs a quaternion from an array of scalars. */ - quatd(const double xyzr[4]) : ::simd_quatd(::simd_quaternion(xyzr)) { } - - /*! @abstract Constructs a quaternion from a vector. */ - quatd(double4 xyzr) : ::simd_quatd(::simd_quaternion(xyzr)) { } - - /*! @abstract Quaternion representing rotation about `axis` by `angle` - * radians. */ - quatd(double angle, double3 axis) : ::simd_quatd(::simd_quaternion(angle, axis)) { } - - /*! @abstract Quaternion that rotates `from` into `to`. */ - quatd(double3 from, double3 to) : ::simd_quatd(::simd_quaternion(from, to)) { } - - /*! @abstract Constructs a quaternion from a rotation matrix. */ - quatd(::simd_double3x3 matrix) : ::simd_quatd(::simd_quaternion(matrix)) { } - - /*! @abstract Constructs a quaternion from a rotation matrix. */ - quatd(::simd_double4x4 matrix) : ::simd_quatd(::simd_quaternion(matrix)) { } - - /*! @abstract The real (scalar) part of the quaternion. */ - double real(void) const { return ::simd_real(*this); } - - /*! @abstract The imaginary (vector) part of the quaternion. */ - double3 imag(void) const { return ::simd_imag(*this); } - - /*! @abstract The angle the quaternion rotates by. */ - double angle(void) const { return ::simd_angle(*this); } - - /*! @abstract The axis the quaternion rotates about. */ - double3 axis(void) const { return ::simd_axis(*this); } - - /*! @abstract The length of the quaternion. */ - double length(void) const { return ::simd_length(*this); } - - /*! @abstract Act on the vector `v` by rotation. */ - double3 operator()(const ::simd_double3 v) const { return ::simd_act(*this, v); } - }; - - static SIMD_CPPFUNC quatd operator+(const ::simd_quatd p, const ::simd_quatd q) { return ::simd_add(p, q); } - static SIMD_CPPFUNC quatd operator-(const ::simd_quatd p, const ::simd_quatd q) { return ::simd_sub(p, q); } - static SIMD_CPPFUNC quatd operator-(const ::simd_quatd p) { return ::simd_negate(p); } - static SIMD_CPPFUNC quatd operator*(const double r, const ::simd_quatd p) { return ::simd_mul(r, p); } - static SIMD_CPPFUNC quatd operator*(const ::simd_quatd p, const double r) { return ::simd_mul(p, r); } - static SIMD_CPPFUNC quatd operator*(const ::simd_quatd p, const ::simd_quatd q) { return ::simd_mul(p, q); } - static SIMD_CPPFUNC quatd operator/(const ::simd_quatd p, const ::simd_quatd q) { return ::simd_mul(p, ::simd_inverse(q)); } - static SIMD_CPPFUNC quatd operator+=(quatd &p, const ::simd_quatd q) { return p = p+q; } - static SIMD_CPPFUNC quatd operator-=(quatd &p, const ::simd_quatd q) { return p = p-q; } - static SIMD_CPPFUNC quatd operator*=(quatd &p, const double r) { return p = p*r; } - static SIMD_CPPFUNC quatd operator*=(quatd &p, const ::simd_quatd q) { return p = p*q; } - static SIMD_CPPFUNC quatd operator/=(quatd &p, const ::simd_quatd q) { return p = p/q; } - - /*! @abstract The conjugate of the quaternion `q`. */ - static SIMD_CPPFUNC quatd conjugate(const ::simd_quatd p) { return ::simd_conjugate(p); } - - /*! @abstract The (multiplicative) inverse of the quaternion `q`. */ - static SIMD_CPPFUNC quatd inverse(const ::simd_quatd p) { return ::simd_inverse(p); } - - /*! @abstract The dot product of the quaternions `p` and `q` interpreted as - * four-dimensional vectors. */ - static SIMD_CPPFUNC double dot(const ::simd_quatd p, const ::simd_quatd q) { return ::simd_dot(p, q); } - - /*! @abstract The unit quaternion obtained by normalizing `q`. */ - static SIMD_CPPFUNC quatd normalize(const ::simd_quatd p) { return ::simd_normalize(p); } - - /*! @abstract logarithm of the quaternion `q`. */ - static SIMD_CPPFUNC quatd log(const ::simd_quatd q) { return ::__tg_log(q); } - - /*! @abstract exponential map of quaterion `q`. */ - static SIMD_CPPFUNC quatd exp(const ::simd_quatd q) { return ::__tg_exp(q); } - - /*! @abstract Spherical linear interpolation along the shortest arc between - * quaternions `q0` and `q1`. */ - static SIMD_CPPFUNC quatd slerp(const ::simd_quatd p0, const ::simd_quatd p1, double t) { return ::simd_slerp(p0, p1, t); } - - /*! @abstract Spherical linear interpolation along the longest arc between - * quaternions `q0` and `q1`. */ - static SIMD_CPPFUNC quatd slerp_longest(const ::simd_quatd p0, const ::simd_quatd p1, double t) { return ::simd_slerp_longest(p0, p1, t); } - - /*! @abstract Interpolate between quaternions along a spherical cubic spline. - * - * @discussion The function interpolates between q1 and q2. q0 is the left - * endpoint of the previous interval, and q3 is the right endpoint of the next - * interval. Use this function to smoothly interpolate between a sequence of - * rotations. */ - static SIMD_CPPFUNC quatd spline(const ::simd_quatd p0, const ::simd_quatd p1, const ::simd_quatd p2, const ::simd_quatd p3, double t) { return ::simd_spline(p0, p1, p2, p3, t); } - - /*! @abstract Spherical cubic Bezier interpolation between quaternions. - * - * @discussion The function treats q0 ... q3 as control points and uses slerp - * in place of lerp in the De Castlejeau algorithm. The endpoints of - * interpolation are thus q0 and q3, and the curve will not generally pass - * through q1 or q2. Note that the convex hull property of "standard" Bezier - * curve does not hold on the sphere. */ - static SIMD_CPPFUNC quatd bezier(const ::simd_quatd p0, const ::simd_quatd p1, const ::simd_quatd p2, const ::simd_quatd p3, double t) { return ::simd_bezier(p0, p1, p2, p3, t); } -} - -extern "C" { -#endif /* __cplusplus */ - -/* MARK: - double implementations */ - -#include -#include - -/* tg_promote is implementation gobbledygook that enables the compile-time - * dispatching in tgmath.h to work its magic. */ -static simd_quatd __attribute__((__overloadable__)) __tg_promote(simd_quatd); - -/*! @abstract Constructs a quaternion from imaginary and real parts. - * @discussion This function is hidden behind an underscore to avoid confusion - * with the angle-axis constructor. */ -static inline SIMD_CFUNC simd_quatd _simd_quaternion(simd_double3 imag, double real) { - return simd_quaternion(simd_make_double4(imag, real)); -} - -static inline SIMD_CFUNC simd_quatd simd_quaternion(double angle, simd_double3 axis) { - return _simd_quaternion(sin(angle/2) * axis, cos(angle/2)); -} - -static inline SIMD_CFUNC double simd_angle(simd_quatd q) { - return 2*atan2(simd_length(q.vector.xyz), q.vector.w); -} - -static inline SIMD_CFUNC simd_double3 simd_axis(simd_quatd q) { - return simd_normalize(q.vector.xyz); -} - -static inline SIMD_CFUNC simd_quatd simd_add(simd_quatd p, simd_quatd q) { - return simd_quaternion(p.vector + q.vector); -} - -static inline SIMD_CFUNC simd_quatd simd_sub(simd_quatd p, simd_quatd q) { - return simd_quaternion(p.vector - q.vector); -} - -static inline SIMD_CFUNC simd_quatd simd_mul(simd_quatd p, simd_quatd q) { - #pragma STDC FP_CONTRACT ON - return simd_quaternion((p.vector.x * __builtin_shufflevector(q.vector, -q.vector, 3,6,1,4) + - p.vector.y * __builtin_shufflevector(q.vector, -q.vector, 2,3,4,5)) + - (p.vector.z * __builtin_shufflevector(q.vector, -q.vector, 5,0,3,6) + - p.vector.w * q.vector)); -} - -static inline SIMD_CFUNC simd_quatd simd_mul(simd_quatd q, double a) { - return simd_quaternion(a * q.vector); -} - -static inline SIMD_CFUNC simd_quatd simd_mul(double a, simd_quatd q) { - return simd_mul(q,a); -} - -static inline SIMD_CFUNC simd_quatd simd_conjugate(simd_quatd q) { - return simd_quaternion(q.vector * (simd_double4){-1,-1,-1, 1}); -} - -static inline SIMD_CFUNC simd_quatd simd_inverse(simd_quatd q) { - return simd_quaternion(simd_conjugate(q).vector * simd_recip(simd_length_squared(q.vector))); -} - -static inline SIMD_CFUNC simd_quatd simd_negate(simd_quatd q) { - return simd_quaternion(-q.vector); -} - -static inline SIMD_CFUNC double simd_dot(simd_quatd p, simd_quatd q) { - return simd_dot(p.vector, q.vector); -} - -static inline SIMD_CFUNC double simd_length(simd_quatd q) { - return simd_length(q.vector); -} - -static inline SIMD_CFUNC simd_quatd simd_normalize(simd_quatd q) { - double length_squared = simd_length_squared(q.vector); - if (length_squared == 0) { - return simd_quaternion((simd_double4){0,0,0,1}); - } - return simd_quaternion(q.vector * simd_rsqrt(length_squared)); -} - -#if defined __arm__ || defined __arm64__ -/*! @abstract Multiplies the vector `v` by the quaternion `q`. - * - * @discussion This IS NOT the action of `q` on `v` (i.e. this is not rotation - * by `q`. That operation is provided by `simd_act(q, v)`. This function is an - * implementation detail and you should not call it directly. It may be - * removed or modified in future versions of the simd module. */ -static inline SIMD_CFUNC simd_quatd _simd_mul_vq(simd_double3 v, simd_quatd q) { - #pragma STDC FP_CONTRACT ON - return simd_quaternion(v.x * __builtin_shufflevector(q.vector, -q.vector, 3,6,1,4) + - v.y * __builtin_shufflevector(q.vector, -q.vector, 2,3,4,5) + - v.z * __builtin_shufflevector(q.vector, -q.vector, 5,0,3,6)); -} -#endif - -static inline SIMD_CFUNC simd_double3 simd_act(simd_quatd q, simd_double3 v) { -#if defined __arm__ || defined __arm64__ - return simd_mul(q, _simd_mul_vq(v, simd_conjugate(q))).vector.xyz; -#else - #pragma STDC FP_CONTRACT ON - simd_double3 t = 2*simd_cross(simd_imag(q),v); - return v + simd_real(q)*t + simd_cross(simd_imag(q), t); -#endif -} - -static SIMD_NOINLINE simd_quatd __tg_log(simd_quatd q) { - double real = __tg_log(simd_length_squared(q.vector))/2; - if (simd_equal(simd_imag(q), 0)) return _simd_quaternion(0, real); - simd_double3 imag = __tg_acos(simd_real(q)/simd_length(q)) * simd_normalize(simd_imag(q)); - return _simd_quaternion(imag, real); -} - -static SIMD_NOINLINE simd_quatd __tg_exp(simd_quatd q) { - // angle is actually *twice* the angle of the rotation corresponding to - // the resulting quaternion, which is why we don't simply use the (angle, - // axis) constructor to generate `unit`. - double angle = simd_length(simd_imag(q)); - if (angle == 0) return _simd_quaternion(0, exp(simd_real(q))); - simd_double3 axis = simd_normalize(simd_imag(q)); - simd_quatd unit = _simd_quaternion(sin(angle)*axis, cosf(angle)); - return simd_mul(exp(simd_real(q)), unit); -} - -/*! @abstract Implementation detail of the `simd_quaternion(from, to)` - * initializer. - * - * @discussion Computes the quaternion rotation `from` to `to` if they are - * separated by less than 90 degrees. Not numerically stable for larger - * angles. This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static inline SIMD_CFUNC simd_quatd _simd_quaternion_reduced(simd_double3 from, simd_double3 to) { - simd_double3 half = simd_normalize(from + to); - return _simd_quaternion(simd_cross(from, half), simd_dot(from, half)); -} - -static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double3 from, simd_double3 to) { - - // If the angle between from and to is not too big, we can compute the - // rotation accurately using a simple implementation. - if (simd_dot(from, to) >= 0) { - return _simd_quaternion_reduced(from, to); - } - - // Because from and to are more than 90 degrees apart, we compute the - // rotation in two stages (from -> half), (half -> to) to preserve numerical - // accuracy. - simd_double3 half = simd_normalize(from + to); - - if (simd_length_squared(half) == 0) { - // half is nearly zero, so from and to point in nearly opposite directions - // and the rotation is numerically underspecified. Pick an axis orthogonal - // to the vectors, and use an angle of pi radians. - simd_double3 abs_from = simd_abs(from); - if (abs_from.x <= abs_from.y && abs_from.x <= abs_from.z) - return _simd_quaternion(simd_normalize(simd_cross(from, (simd_double3){1,0,0})), 0.f); - else if (abs_from.y <= abs_from.z) - return _simd_quaternion(simd_normalize(simd_cross(from, (simd_double3){0,1,0})), 0.f); - else - return _simd_quaternion(simd_normalize(simd_cross(from, (simd_double3){0,0,1})), 0.f); - } - - // Compute the two-step rotation. */ - return simd_mul(_simd_quaternion_reduced(from, half), - _simd_quaternion_reduced(half, to)); -} - -static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double3x3 matrix) { - const simd_double3 *mat = matrix.columns; - double trace = mat[0][0] + mat[1][1] + mat[2][2]; - if (trace >= 0.0) { - double r = 2*sqrt(1 + trace); - double rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[1][2] - mat[2][1]), - rinv*(mat[2][0] - mat[0][2]), - rinv*(mat[0][1] - mat[1][0]), - r/4); - } else if (mat[0][0] >= mat[1][1] && mat[0][0] >= mat[2][2]) { - double r = 2*sqrt(1 - mat[1][1] - mat[2][2] + mat[0][0]); - double rinv = simd_recip(r); - return simd_quaternion(r/4, - rinv*(mat[0][1] + mat[1][0]), - rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] - mat[2][1])); - } else if (mat[1][1] >= mat[2][2]) { - double r = 2*sqrt(1 - mat[0][0] - mat[2][2] + mat[1][1]); - double rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][1] + mat[1][0]), - r/4, - rinv*(mat[1][2] + mat[2][1]), - rinv*(mat[2][0] - mat[0][2])); - } else { - double r = 2*sqrt(1 - mat[0][0] - mat[1][1] + mat[2][2]); - double rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] + mat[2][1]), - r/4, - rinv*(mat[0][1] - mat[1][0])); - } -} - -static SIMD_NOINLINE simd_quatd simd_quaternion(simd_double4x4 matrix) { - const simd_double4 *mat = matrix.columns; - double trace = mat[0][0] + mat[1][1] + mat[2][2]; - if (trace >= 0.0) { - double r = 2*sqrt(1 + trace); - double rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[1][2] - mat[2][1]), - rinv*(mat[2][0] - mat[0][2]), - rinv*(mat[0][1] - mat[1][0]), - r/4); - } else if (mat[0][0] >= mat[1][1] && mat[0][0] >= mat[2][2]) { - double r = 2*sqrt(1 - mat[1][1] - mat[2][2] + mat[0][0]); - double rinv = simd_recip(r); - return simd_quaternion(r/4, - rinv*(mat[0][1] + mat[1][0]), - rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] - mat[2][1])); - } else if (mat[1][1] >= mat[2][2]) { - double r = 2*sqrt(1 - mat[0][0] - mat[2][2] + mat[1][1]); - double rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][1] + mat[1][0]), - r/4, - rinv*(mat[1][2] + mat[2][1]), - rinv*(mat[2][0] - mat[0][2])); - } else { - double r = 2*sqrt(1 - mat[0][0] - mat[1][1] + mat[2][2]); - double rinv = simd_recip(r); - return simd_quaternion(rinv*(mat[0][2] + mat[2][0]), - rinv*(mat[1][2] + mat[2][1]), - r/4, - rinv*(mat[0][1] - mat[1][0])); - } -} - -/*! @abstract The angle between p and q interpreted as 4-dimensional vectors. - * - * @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_NOINLINE double _simd_angle(simd_quatd p, simd_quatd q) { - return 2*atan2(simd_length(p.vector - q.vector), simd_length(p.vector + q.vector)); -} - -/*! @abstract sin(x)/x. - * - * @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_CFUNC double _simd_sinc(double x) { - if (x == 0) return 1; - return sin(x)/x; -} - -/*! @abstract Spherical lerp between q0 and q1. - * - * @discussion This function may interpolate along either the longer or - * shorter path between q0 and q1; it is used as an implementation detail - * in `simd_slerp` and `simd_slerp_longest`; you should use those functions - * instead of calling this directly. */ -static SIMD_NOINLINE simd_quatd _simd_slerp_internal(simd_quatd q0, simd_quatd q1, double t) { - double s = 1 - t; - double a = _simd_angle(q0, q1); - double r = simd_recip(_simd_sinc(a)); - return simd_normalize(simd_quaternion(_simd_sinc(s*a)*r*s*q0.vector + _simd_sinc(t*a)*r*t*q1.vector)); -} - -static SIMD_NOINLINE simd_quatd simd_slerp(simd_quatd q0, simd_quatd q1, double t) { - if (simd_dot(q0, q1) >= 0) - return _simd_slerp_internal(q0, q1, t); - return _simd_slerp_internal(q0, simd_negate(q1), t); -} - -static SIMD_NOINLINE simd_quatd simd_slerp_longest(simd_quatd q0, simd_quatd q1, double t) { - if (simd_dot(q0, q1) >= 0) - return _simd_slerp_internal(q0, simd_negate(q1), t); - return _simd_slerp_internal(q0, q1, t); -} - -/*! @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_NOINLINE simd_quatd _simd_intermediate(simd_quatd q0, simd_quatd q1, simd_quatd q2) { - simd_quatd p0 = __tg_log(simd_mul(q0, simd_inverse(q1))); - simd_quatd p2 = __tg_log(simd_mul(q2, simd_inverse(q1))); - return simd_normalize(simd_mul(q1, __tg_exp(simd_mul(-0.25, simd_add(p0,p2))))); -} - -/*! @discussion This function is an implementation detail and you should not - * call it directly. It may be removed or modified in future versions of the - * simd module. */ -static SIMD_NOINLINE simd_quatd _simd_squad(simd_quatd q0, simd_quatd qa, simd_quatd qb, simd_quatd q1, double t) { - simd_quatd r0 = _simd_slerp_internal(q0, q1, t); - simd_quatd r1 = _simd_slerp_internal(qa, qb, t); - return _simd_slerp_internal(r0, r1, 2*t*(1 - t)); -} - -static SIMD_NOINLINE simd_quatd simd_spline(simd_quatd q0, simd_quatd q1, simd_quatd q2, simd_quatd q3, double t) { - simd_quatd qa = _simd_intermediate(q0, q1, q2); - simd_quatd qb = _simd_intermediate(q1, q2, q3); - return _simd_squad(q1, qa, qb, q2, t); -} - -static SIMD_NOINLINE simd_quatd simd_bezier(simd_quatd q0, simd_quatd q1, simd_quatd q2, simd_quatd q3, double t) { - simd_quatd q01 = _simd_slerp_internal(q0, q1, t); - simd_quatd q12 = _simd_slerp_internal(q1, q2, t); - simd_quatd q23 = _simd_slerp_internal(q2, q3, t); - simd_quatd q012 = _simd_slerp_internal(q01, q12, t); - simd_quatd q123 = _simd_slerp_internal(q12, q23, t); - return _simd_slerp_internal(q012, q123, t); -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ -#endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */ -#endif /* SIMD_QUATERNIONS */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/simd/vector_make.h b/lib/libc/include/x86_64-macos.10-none/simd/vector_make.h deleted file mode 100644 index b8e2323944..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/simd/vector_make.h +++ /dev/null @@ -1,6768 +0,0 @@ -/*! @header - * This header defines functions for constructing, extending, and truncating - * simd vector types. - * - * For each vector type `simd_typeN` supported by , the following - * constructors are provided: - * - * ~~~ - * simd_typeN simd_make_typeN(type other); - * simd_typeN simd_make_typeN(simd_typeM other); - * ~~~ - * For the scalar-input version, or if M < N, these functions zero-extend - * `other` to produce a wider vector. If M == N, `other` is passed through - * unmodified. If `M > N`, `other` is truncated to form the result. - * - * ~~~ - * simd_typeN simd_make_typeN_undef(type other); - * simd_typeN simd_make_typeN_undef(simd_typeM other); - * ~~~ - * These functions are only available for M < N and for scalar inputs. They - * extend `other` to produce a wider vector where the contents of the newly- - * formed lanes are undefined. - * - * In addition, if N is 2, 3, or 4, the following constructors are available: - * ~~~ - * simd_make_typeN(parts ...) - * ~~~ - * where parts is a list of scalars and smaller vectors such that the sum of - * the number of lanes in the arguments is equal to N. For example, a - * `simd_float3` can be constructed from three `floats`, or a `float` and a - * `simd_float2` in any order: - * ~~~ - * simd_float2 ab = { 1, 2 }; - * simd_float3 vector = simd_make_float3(ab, 3); - * ~~~ - * - * @copyright 2014-2016 Apple, Inc. All rights reserved. - * @unsorted */ - -#ifndef SIMD_VECTOR_CONSTRUCTORS -#define SIMD_VECTOR_CONSTRUCTORS - -#include -#if SIMD_COMPILER_HAS_REQUIRED_FEATURES - -#ifdef __cplusplus -extern "C" { -#endif - -/*! @abstract Concatenates `x` and `y` to form a vector of two 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(char x, char y) { - simd_char2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(char other) { - simd_char2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2_undef(char other) { - simd_char2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(simd_char2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(simd_char3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(simd_char4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(simd_char8 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(simd_char16 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(simd_char32 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char2 simd_make_char2(simd_char64 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(char x, char y, char z) { - simd_char3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(char x, simd_char2 yz) { - simd_char3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char2 xy, char z) { - simd_char3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(char other) { - simd_char3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3_undef(char other) { - simd_char3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char2 other) { - simd_char3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3_undef(simd_char2 other) { - simd_char3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char8 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char16 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char32 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char3 simd_make_char3(simd_char64 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 8-bit signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(char x, char y, char z, char w) { - simd_char4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(char x, char y, simd_char2 zw) { - simd_char4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(char x, simd_char2 yz, char w) { - simd_char4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char2 xy, char z, char w) { - simd_char4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(char x, simd_char3 yzw) { - simd_char4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char2 xy, simd_char2 zw) { - simd_char4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char3 xyz, char w) { - simd_char4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(char other) { - simd_char4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4_undef(char other) { - simd_char4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char2 other) { - simd_char4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4_undef(simd_char2 other) { - simd_char4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char3 other) { - simd_char4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4_undef(simd_char3 other) { - simd_char4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char8 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char16 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char32 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_char4 simd_make_char4(simd_char64 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char4 lo, simd_char4 hi) { - simd_char8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(char other) { - simd_char8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8_undef(char other) { - simd_char8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char2 other) { - simd_char8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8_undef(simd_char2 other) { - simd_char8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char3 other) { - simd_char8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8_undef(simd_char3 other) { - simd_char8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char4 other) { - simd_char8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8_undef(simd_char4 other) { - simd_char8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char8 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of eight 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char16 other) { - return simd_make_char8(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of eight 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char32 other) { - return simd_make_char8(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of eight 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char8 simd_make_char8(simd_char64 other) { - return simd_make_char8(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char8 lo, simd_char8 hi) { - simd_char16 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(char other) { - simd_char16 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16_undef(char other) { - simd_char16 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char2 other) { - simd_char16 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16_undef(simd_char2 other) { - simd_char16 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char3 other) { - simd_char16 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16_undef(simd_char3 other) { - simd_char16 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char4 other) { - simd_char16 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16_undef(simd_char4 other) { - simd_char16 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char8 other) { - simd_char16 result = 0; - result.lo = simd_make_char8(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16_undef(simd_char8 other) { - simd_char16 result; - result.lo = simd_make_char8(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char16 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char32 other) { - return simd_make_char16(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char16 simd_make_char16(simd_char64 other) { - return simd_make_char16(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 8-bit signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char16 lo, simd_char16 hi) { - simd_char32 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(char other) { - simd_char32 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32_undef(char other) { - simd_char32 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char2 other) { - simd_char32 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32_undef(simd_char2 other) { - simd_char32 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char3 other) { - simd_char32 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32_undef(simd_char3 other) { - simd_char32 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char4 other) { - simd_char32 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32_undef(simd_char4 other) { - simd_char32 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char8 other) { - simd_char32 result = 0; - result.lo = simd_make_char16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32_undef(simd_char8 other) { - simd_char32 result; - result.lo = simd_make_char16(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char16 other) { - simd_char32 result = 0; - result.lo = simd_make_char16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32_undef(simd_char16 other) { - simd_char32 result; - result.lo = simd_make_char16(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char32 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char32 simd_make_char32(simd_char64 other) { - return simd_make_char32(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixty-four - * 8-bit signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char32 lo, simd_char32 hi) { - simd_char64 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(char other) { - simd_char64 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64_undef(char other) { - simd_char64 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char2 other) { - simd_char64 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64_undef(simd_char2 other) { - simd_char64 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char3 other) { - simd_char64 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64_undef(simd_char3 other) { - simd_char64 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char4 other) { - simd_char64 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64_undef(simd_char4 other) { - simd_char64 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char8 other) { - simd_char64 result = 0; - result.lo = simd_make_char32(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64_undef(simd_char8 other) { - simd_char64 result; - result.lo = simd_make_char32(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char16 other) { - simd_char64 result = 0; - result.lo = simd_make_char32(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64_undef(simd_char16 other) { - simd_char64 result; - result.lo = simd_make_char32(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char32 other) { - simd_char64 result = 0; - result.lo = simd_make_char32(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64_undef(simd_char32 other) { - simd_char64 result; - result.lo = simd_make_char32(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_char64 simd_make_char64(simd_char64 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(unsigned char x, unsigned char y) { - simd_uchar2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(unsigned char other) { - simd_uchar2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2_undef(unsigned char other) { - simd_uchar2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(simd_uchar2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(simd_uchar3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(simd_uchar4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(simd_uchar8 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(simd_uchar16 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(simd_uchar32 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar2 simd_make_uchar2(simd_uchar64 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(unsigned char x, unsigned char y, unsigned char z) { - simd_uchar3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(unsigned char x, simd_uchar2 yz) { - simd_uchar3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar2 xy, unsigned char z) { - simd_uchar3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(unsigned char other) { - simd_uchar3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3_undef(unsigned char other) { - simd_uchar3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar2 other) { - simd_uchar3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3_undef(simd_uchar2 other) { - simd_uchar3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar8 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar16 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar32 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar3 simd_make_uchar3(simd_uchar64 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 8-bit unsigned integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(unsigned char x, unsigned char y, unsigned char z, unsigned char w) { - simd_uchar4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(unsigned char x, unsigned char y, simd_uchar2 zw) { - simd_uchar4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(unsigned char x, simd_uchar2 yz, unsigned char w) { - simd_uchar4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar2 xy, unsigned char z, unsigned char w) { - simd_uchar4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(unsigned char x, simd_uchar3 yzw) { - simd_uchar4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar2 xy, simd_uchar2 zw) { - simd_uchar4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar3 xyz, unsigned char w) { - simd_uchar4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(unsigned char other) { - simd_uchar4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4_undef(unsigned char other) { - simd_uchar4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar2 other) { - simd_uchar4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4_undef(simd_uchar2 other) { - simd_uchar4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar3 other) { - simd_uchar4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4_undef(simd_uchar3 other) { - simd_uchar4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar8 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar16 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar32 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar4 simd_make_uchar4(simd_uchar64 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar4 lo, simd_uchar4 hi) { - simd_uchar8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(unsigned char other) { - simd_uchar8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8_undef(unsigned char other) { - simd_uchar8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar2 other) { - simd_uchar8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8_undef(simd_uchar2 other) { - simd_uchar8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar3 other) { - simd_uchar8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8_undef(simd_uchar3 other) { - simd_uchar8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar4 other) { - simd_uchar8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8_undef(simd_uchar4 other) { - simd_uchar8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar8 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of eight 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar16 other) { - return simd_make_uchar8(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of eight 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar32 other) { - return simd_make_uchar8(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of eight 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar8 simd_make_uchar8(simd_uchar64 other) { - return simd_make_uchar8(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar8 lo, simd_uchar8 hi) { - simd_uchar16 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(unsigned char other) { - simd_uchar16 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16_undef(unsigned char other) { - simd_uchar16 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar2 other) { - simd_uchar16 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16_undef(simd_uchar2 other) { - simd_uchar16 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar3 other) { - simd_uchar16 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16_undef(simd_uchar3 other) { - simd_uchar16 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar4 other) { - simd_uchar16 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16_undef(simd_uchar4 other) { - simd_uchar16 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar8 other) { - simd_uchar16 result = 0; - result.lo = simd_make_uchar8(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16_undef(simd_uchar8 other) { - simd_uchar16 result; - result.lo = simd_make_uchar8(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar16 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of sixteen 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar32 other) { - return simd_make_uchar16(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of sixteen 8-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uchar16 simd_make_uchar16(simd_uchar64 other) { - return simd_make_uchar16(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 8-bit unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar16 lo, simd_uchar16 hi) { - simd_uchar32 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(unsigned char other) { - simd_uchar32 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32_undef(unsigned char other) { - simd_uchar32 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar2 other) { - simd_uchar32 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32_undef(simd_uchar2 other) { - simd_uchar32 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar3 other) { - simd_uchar32 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32_undef(simd_uchar3 other) { - simd_uchar32 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar4 other) { - simd_uchar32 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32_undef(simd_uchar4 other) { - simd_uchar32 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar8 other) { - simd_uchar32 result = 0; - result.lo = simd_make_uchar16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32_undef(simd_uchar8 other) { - simd_uchar32 result; - result.lo = simd_make_uchar16(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar16 other) { - simd_uchar32 result = 0; - result.lo = simd_make_uchar16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32_undef(simd_uchar16 other) { - simd_uchar32 result; - result.lo = simd_make_uchar16(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar32 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of thirty-two 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar32 simd_make_uchar32(simd_uchar64 other) { - return simd_make_uchar32(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixty-four - * 8-bit unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar32 lo, simd_uchar32 hi) { - simd_uchar64 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(unsigned char other) { - simd_uchar64 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64_undef(unsigned char other) { - simd_uchar64 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar2 other) { - simd_uchar64 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64_undef(simd_uchar2 other) { - simd_uchar64 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar3 other) { - simd_uchar64 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64_undef(simd_uchar3 other) { - simd_uchar64 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar4 other) { - simd_uchar64 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64_undef(simd_uchar4 other) { - simd_uchar64 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar8 other) { - simd_uchar64 result = 0; - result.lo = simd_make_uchar32(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64_undef(simd_uchar8 other) { - simd_uchar64 result; - result.lo = simd_make_uchar32(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar16 other) { - simd_uchar64 result = 0; - result.lo = simd_make_uchar32(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64_undef(simd_uchar16 other) { - simd_uchar64 result; - result.lo = simd_make_uchar32(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixty-four 8-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar32 other) { - simd_uchar64 result = 0; - result.lo = simd_make_uchar32(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64_undef(simd_uchar32 other) { - simd_uchar64 result; - result.lo = simd_make_uchar32(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uchar64 simd_make_uchar64(simd_uchar64 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(short x, short y) { - simd_short2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(short other) { - simd_short2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2_undef(short other) { - simd_short2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(simd_short2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(simd_short3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(simd_short4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(simd_short8 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(simd_short16 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_short2 simd_make_short2(simd_short32 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(short x, short y, short z) { - simd_short3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(short x, simd_short2 yz) { - simd_short3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(simd_short2 xy, short z) { - simd_short3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(short other) { - simd_short3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3_undef(short other) { - simd_short3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(simd_short2 other) { - simd_short3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3_undef(simd_short2 other) { - simd_short3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(simd_short3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(simd_short4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(simd_short8 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(simd_short16 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short3 simd_make_short3(simd_short32 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 16-bit signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(short x, short y, short z, short w) { - simd_short4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(short x, short y, simd_short2 zw) { - simd_short4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(short x, simd_short2 yz, short w) { - simd_short4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short2 xy, short z, short w) { - simd_short4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(short x, simd_short3 yzw) { - simd_short4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short2 xy, simd_short2 zw) { - simd_short4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short3 xyz, short w) { - simd_short4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(short other) { - simd_short4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4_undef(short other) { - simd_short4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short2 other) { - simd_short4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4_undef(simd_short2 other) { - simd_short4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short3 other) { - simd_short4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4_undef(simd_short3 other) { - simd_short4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short8 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short16 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short4 simd_make_short4(simd_short32 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(simd_short4 lo, simd_short4 hi) { - simd_short8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(short other) { - simd_short8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8_undef(short other) { - simd_short8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(simd_short2 other) { - simd_short8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8_undef(simd_short2 other) { - simd_short8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(simd_short3 other) { - simd_short8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8_undef(simd_short3 other) { - simd_short8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(simd_short4 other) { - simd_short8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8_undef(simd_short4 other) { - simd_short8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(simd_short8 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of eight 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(simd_short16 other) { - return simd_make_short8(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of eight 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short8 simd_make_short8(simd_short32 other) { - return simd_make_short8(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(simd_short8 lo, simd_short8 hi) { - simd_short16 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(short other) { - simd_short16 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16_undef(short other) { - simd_short16 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(simd_short2 other) { - simd_short16 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16_undef(simd_short2 other) { - simd_short16 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(simd_short3 other) { - simd_short16 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16_undef(simd_short3 other) { - simd_short16 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(simd_short4 other) { - simd_short16 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16_undef(simd_short4 other) { - simd_short16 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(simd_short8 other) { - simd_short16 result = 0; - result.lo = simd_make_short8(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16_undef(simd_short8 other) { - simd_short16 result; - result.lo = simd_make_short8(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(simd_short16 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short16 simd_make_short16(simd_short32 other) { - return simd_make_short16(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 16-bit signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(simd_short16 lo, simd_short16 hi) { - simd_short32 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(short other) { - simd_short32 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32_undef(short other) { - simd_short32 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(simd_short2 other) { - simd_short32 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32_undef(simd_short2 other) { - simd_short32 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(simd_short3 other) { - simd_short32 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32_undef(simd_short3 other) { - simd_short32 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(simd_short4 other) { - simd_short32 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32_undef(simd_short4 other) { - simd_short32 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(simd_short8 other) { - simd_short32 result = 0; - result.lo = simd_make_short16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32_undef(simd_short8 other) { - simd_short32 result; - result.lo = simd_make_short16(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(simd_short16 other) { - simd_short32 result = 0; - result.lo = simd_make_short16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32_undef(simd_short16 other) { - simd_short32 result; - result.lo = simd_make_short16(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_short32 simd_make_short32(simd_short32 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(unsigned short x, unsigned short y) { - simd_ushort2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(unsigned short other) { - simd_ushort2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2_undef(unsigned short other) { - simd_ushort2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(simd_ushort2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(simd_ushort3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(simd_ushort4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(simd_ushort8 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(simd_ushort16 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort2 simd_make_ushort2(simd_ushort32 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(unsigned short x, unsigned short y, unsigned short z) { - simd_ushort3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(unsigned short x, simd_ushort2 yz) { - simd_ushort3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(simd_ushort2 xy, unsigned short z) { - simd_ushort3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(unsigned short other) { - simd_ushort3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3_undef(unsigned short other) { - simd_ushort3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(simd_ushort2 other) { - simd_ushort3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3_undef(simd_ushort2 other) { - simd_ushort3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(simd_ushort3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(simd_ushort4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(simd_ushort8 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(simd_ushort16 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort3 simd_make_ushort3(simd_ushort32 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 16-bit unsigned integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w) { - simd_ushort4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(unsigned short x, unsigned short y, simd_ushort2 zw) { - simd_ushort4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(unsigned short x, simd_ushort2 yz, unsigned short w) { - simd_ushort4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort2 xy, unsigned short z, unsigned short w) { - simd_ushort4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(unsigned short x, simd_ushort3 yzw) { - simd_ushort4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort2 xy, simd_ushort2 zw) { - simd_ushort4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort3 xyz, unsigned short w) { - simd_ushort4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(unsigned short other) { - simd_ushort4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4_undef(unsigned short other) { - simd_ushort4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort2 other) { - simd_ushort4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4_undef(simd_ushort2 other) { - simd_ushort4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort3 other) { - simd_ushort4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4_undef(simd_ushort3 other) { - simd_ushort4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort8 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort16 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort4 simd_make_ushort4(simd_ushort32 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(simd_ushort4 lo, simd_ushort4 hi) { - simd_ushort8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(unsigned short other) { - simd_ushort8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8_undef(unsigned short other) { - simd_ushort8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(simd_ushort2 other) { - simd_ushort8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8_undef(simd_ushort2 other) { - simd_ushort8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(simd_ushort3 other) { - simd_ushort8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8_undef(simd_ushort3 other) { - simd_ushort8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(simd_ushort4 other) { - simd_ushort8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8_undef(simd_ushort4 other) { - simd_ushort8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(simd_ushort8 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of eight 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(simd_ushort16 other) { - return simd_make_ushort8(other.lo); -} - -/*! @abstract Truncates `other` to form a vector of eight 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort8 simd_make_ushort8(simd_ushort32 other) { - return simd_make_ushort8(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(simd_ushort8 lo, simd_ushort8 hi) { - simd_ushort16 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(unsigned short other) { - simd_ushort16 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16_undef(unsigned short other) { - simd_ushort16 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(simd_ushort2 other) { - simd_ushort16 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16_undef(simd_ushort2 other) { - simd_ushort16 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(simd_ushort3 other) { - simd_ushort16 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16_undef(simd_ushort3 other) { - simd_ushort16 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(simd_ushort4 other) { - simd_ushort16 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16_undef(simd_ushort4 other) { - simd_ushort16 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(simd_ushort8 other) { - simd_ushort16 result = 0; - result.lo = simd_make_ushort8(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16_undef(simd_ushort8 other) { - simd_ushort16 result; - result.lo = simd_make_ushort8(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(simd_ushort16 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of sixteen 16-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ushort16 simd_make_ushort16(simd_ushort32 other) { - return simd_make_ushort16(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 16-bit unsigned integers. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(simd_ushort16 lo, simd_ushort16 hi) { - simd_ushort32 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(unsigned short other) { - simd_ushort32 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32_undef(unsigned short other) { - simd_ushort32 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(simd_ushort2 other) { - simd_ushort32 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32_undef(simd_ushort2 other) { - simd_ushort32 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(simd_ushort3 other) { - simd_ushort32 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32_undef(simd_ushort3 other) { - simd_ushort32 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(simd_ushort4 other) { - simd_ushort32 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32_undef(simd_ushort4 other) { - simd_ushort32 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(simd_ushort8 other) { - simd_ushort32 result = 0; - result.lo = simd_make_ushort16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32_undef(simd_ushort8 other) { - simd_ushort32 result; - result.lo = simd_make_ushort16(other); - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(simd_ushort16 other) { - simd_ushort32 result = 0; - result.lo = simd_make_ushort16(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32_undef(simd_ushort16 other) { - simd_ushort32 result; - result.lo = simd_make_ushort16(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ushort32 simd_make_ushort32(simd_ushort32 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2(int x, int y) { - simd_int2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2(int other) { - simd_int2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2_undef(int other) { - simd_int2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2(simd_int2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2(simd_int3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2(simd_int4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2(simd_int8 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_int2 simd_make_int2(simd_int16 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(int x, int y, int z) { - simd_int3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(int x, simd_int2 yz) { - simd_int3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(simd_int2 xy, int z) { - simd_int3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(int other) { - simd_int3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3_undef(int other) { - simd_int3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(simd_int2 other) { - simd_int3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3_undef(simd_int2 other) { - simd_int3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(simd_int3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(simd_int4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(simd_int8 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int3 simd_make_int3(simd_int16 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 32-bit signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(int x, int y, int z, int w) { - simd_int4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(int x, int y, simd_int2 zw) { - simd_int4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(int x, simd_int2 yz, int w) { - simd_int4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int2 xy, int z, int w) { - simd_int4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(int x, simd_int3 yzw) { - simd_int4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int2 xy, simd_int2 zw) { - simd_int4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int3 xyz, int w) { - simd_int4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(int other) { - simd_int4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4_undef(int other) { - simd_int4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int2 other) { - simd_int4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4_undef(simd_int2 other) { - simd_int4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int3 other) { - simd_int4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4_undef(simd_int3 other) { - simd_int4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int8 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int4 simd_make_int4(simd_int16 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8(simd_int4 lo, simd_int4 hi) { - simd_int8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8(int other) { - simd_int8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8_undef(int other) { - simd_int8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8(simd_int2 other) { - simd_int8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8_undef(simd_int2 other) { - simd_int8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8(simd_int3 other) { - simd_int8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8_undef(simd_int3 other) { - simd_int8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8(simd_int4 other) { - simd_int8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8_undef(simd_int4 other) { - simd_int8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8(simd_int8 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of eight 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int8 simd_make_int8(simd_int16 other) { - return simd_make_int8(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16(simd_int8 lo, simd_int8 hi) { - simd_int16 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16(int other) { - simd_int16 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16_undef(int other) { - simd_int16 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16(simd_int2 other) { - simd_int16 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16_undef(simd_int2 other) { - simd_int16 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16(simd_int3 other) { - simd_int16 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16_undef(simd_int3 other) { - simd_int16 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16(simd_int4 other) { - simd_int16 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16_undef(simd_int4 other) { - simd_int16 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16(simd_int8 other) { - simd_int16 result = 0; - result.lo = simd_make_int8(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16_undef(simd_int8 other) { - simd_int16 result; - result.lo = simd_make_int8(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_int16 simd_make_int16(simd_int16 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2(unsigned int x, unsigned int y) { - simd_uint2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2(unsigned int other) { - simd_uint2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2_undef(unsigned int other) { - simd_uint2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2(simd_uint2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2(simd_uint3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2(simd_uint4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2(simd_uint8 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint2 simd_make_uint2(simd_uint16 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(unsigned int x, unsigned int y, unsigned int z) { - simd_uint3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(unsigned int x, simd_uint2 yz) { - simd_uint3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(simd_uint2 xy, unsigned int z) { - simd_uint3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(unsigned int other) { - simd_uint3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3_undef(unsigned int other) { - simd_uint3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(simd_uint2 other) { - simd_uint3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3_undef(simd_uint2 other) { - simd_uint3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(simd_uint3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(simd_uint4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(simd_uint8 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint3 simd_make_uint3(simd_uint16 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 32-bit unsigned integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(unsigned int x, unsigned int y, unsigned int z, unsigned int w) { - simd_uint4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(unsigned int x, unsigned int y, simd_uint2 zw) { - simd_uint4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(unsigned int x, simd_uint2 yz, unsigned int w) { - simd_uint4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint2 xy, unsigned int z, unsigned int w) { - simd_uint4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(unsigned int x, simd_uint3 yzw) { - simd_uint4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint2 xy, simd_uint2 zw) { - simd_uint4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint3 xyz, unsigned int w) { - simd_uint4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(unsigned int other) { - simd_uint4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4_undef(unsigned int other) { - simd_uint4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint2 other) { - simd_uint4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4_undef(simd_uint2 other) { - simd_uint4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint3 other) { - simd_uint4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4_undef(simd_uint3 other) { - simd_uint4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint8 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint4 simd_make_uint4(simd_uint16 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8(simd_uint4 lo, simd_uint4 hi) { - simd_uint8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8(unsigned int other) { - simd_uint8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8_undef(unsigned int other) { - simd_uint8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8(simd_uint2 other) { - simd_uint8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8_undef(simd_uint2 other) { - simd_uint8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8(simd_uint3 other) { - simd_uint8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8_undef(simd_uint3 other) { - simd_uint8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8(simd_uint4 other) { - simd_uint8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8_undef(simd_uint4 other) { - simd_uint8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8(simd_uint8 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of eight 32-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_uint8 simd_make_uint8(simd_uint16 other) { - return simd_make_uint8(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16(simd_uint8 lo, simd_uint8 hi) { - simd_uint16 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16(unsigned int other) { - simd_uint16 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16_undef(unsigned int other) { - simd_uint16 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16(simd_uint2 other) { - simd_uint16 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16_undef(simd_uint2 other) { - simd_uint16 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16(simd_uint3 other) { - simd_uint16 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16_undef(simd_uint3 other) { - simd_uint16 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16(simd_uint4 other) { - simd_uint16 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16_undef(simd_uint4 other) { - simd_uint16 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16(simd_uint8 other) { - simd_uint16 result = 0; - result.lo = simd_make_uint8(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16_undef(simd_uint8 other) { - simd_uint16 result; - result.lo = simd_make_uint8(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_uint16 simd_make_uint16(simd_uint16 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2(float x, float y) { - simd_float2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2(float other) { - simd_float2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 32-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2_undef(float other) { - simd_float2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2(simd_float2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2(simd_float3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2(simd_float4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2(simd_float8 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float2 simd_make_float2(simd_float16 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(float x, float y, float z) { - simd_float3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(float x, simd_float2 yz) { - simd_float3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(simd_float2 xy, float z) { - simd_float3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(float other) { - simd_float3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3_undef(float other) { - simd_float3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(simd_float2 other) { - simd_float3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3_undef(simd_float2 other) { - simd_float3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(simd_float3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(simd_float4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(simd_float8 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float3 simd_make_float3(simd_float16 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 32-bit floating-point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(float x, float y, float z, float w) { - simd_float4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(float x, float y, simd_float2 zw) { - simd_float4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(float x, simd_float2 yz, float w) { - simd_float4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float2 xy, float z, float w) { - simd_float4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(float x, simd_float3 yzw) { - simd_float4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float2 xy, simd_float2 zw) { - simd_float4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float3 xyz, float w) { - simd_float4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(float other) { - simd_float4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4_undef(float other) { - simd_float4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float2 other) { - simd_float4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4_undef(simd_float2 other) { - simd_float4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float3 other) { - simd_float4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 32-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4_undef(simd_float3 other) { - simd_float4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float8 other) { - return other.xyzw; -} - -/*! @abstract Truncates `other` to form a vector of four 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float4 simd_make_float4(simd_float16 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8(simd_float4 lo, simd_float4 hi) { - simd_float8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8(float other) { - simd_float8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8_undef(float other) { - simd_float8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8(simd_float2 other) { - simd_float8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8_undef(simd_float2 other) { - simd_float8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8(simd_float3 other) { - simd_float8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8_undef(simd_float3 other) { - simd_float8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8(simd_float4 other) { - simd_float8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8_undef(simd_float4 other) { - simd_float8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8(simd_float8 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of eight 32-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_float8 simd_make_float8(simd_float16 other) { - return simd_make_float8(other.lo); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16(simd_float8 lo, simd_float8 hi) { - simd_float16 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16(float other) { - simd_float16 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16_undef(float other) { - simd_float16 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16(simd_float2 other) { - simd_float16 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16_undef(simd_float2 other) { - simd_float16 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16(simd_float3 other) { - simd_float16 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16_undef(simd_float3 other) { - simd_float16 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16(simd_float4 other) { - simd_float16 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16_undef(simd_float4 other) { - simd_float16 result; - result.xyzw = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of sixteen 32-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16(simd_float8 other) { - simd_float16 result = 0; - result.lo = simd_make_float8(other); - return result; -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16_undef(simd_float8 other) { - simd_float16 result; - result.lo = simd_make_float8(other); - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_float16 simd_make_float16(simd_float16 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long2 simd_make_long2(simd_long1 x, simd_long1 y) { - simd_long2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long2 simd_make_long2(simd_long1 other) { - simd_long2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long2 simd_make_long2_undef(simd_long1 other) { - simd_long2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_long2 simd_make_long2(simd_long2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_long2 simd_make_long2(simd_long3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_long2 simd_make_long2(simd_long4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit signed (twos- - * complement) integers. */ -static inline SIMD_CFUNC simd_long2 simd_make_long2(simd_long8 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long1 x, simd_long1 y, simd_long1 z) { - simd_long3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long1 x, simd_long2 yz) { - simd_long3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long2 xy, simd_long1 z) { - simd_long3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long1 other) { - simd_long3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3_undef(simd_long1 other) { - simd_long3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long2 other) { - simd_long3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3_undef(simd_long2 other) { - simd_long3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long3 simd_make_long3(simd_long8 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 64-bit signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long1 x, simd_long1 y, simd_long1 z, simd_long1 w) { - simd_long4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long1 x, simd_long1 y, simd_long2 zw) { - simd_long4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long1 x, simd_long2 yz, simd_long1 w) { - simd_long4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long2 xy, simd_long1 z, simd_long1 w) { - simd_long4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long1 x, simd_long3 yzw) { - simd_long4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long2 xy, simd_long2 zw) { - simd_long4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long3 xyz, simd_long1 w) { - simd_long4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long1 other) { - simd_long4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4_undef(simd_long1 other) { - simd_long4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long2 other) { - simd_long4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4_undef(simd_long2 other) { - simd_long4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long3 other) { - simd_long4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4_undef(simd_long3 other) { - simd_long4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long4 simd_make_long4(simd_long8 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8(simd_long4 lo, simd_long4 hi) { - simd_long8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8(simd_long1 other) { - simd_long8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8_undef(simd_long1 other) { - simd_long8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8(simd_long2 other) { - simd_long8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8_undef(simd_long2 other) { - simd_long8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8(simd_long3 other) { - simd_long8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8_undef(simd_long3 other) { - simd_long8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8(simd_long4 other) { - simd_long8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8_undef(simd_long4 other) { - simd_long8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_long8 simd_make_long8(simd_long8 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong2 simd_make_ulong2(simd_ulong1 x, simd_ulong1 y) { - simd_ulong2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong2 simd_make_ulong2(simd_ulong1 other) { - simd_ulong2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong2 simd_make_ulong2_undef(simd_ulong1 other) { - simd_ulong2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ulong2 simd_make_ulong2(simd_ulong2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong2 simd_make_ulong2(simd_ulong3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong2 simd_make_ulong2(simd_ulong4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong2 simd_make_ulong2(simd_ulong8 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong1 x, simd_ulong1 y, simd_ulong1 z) { - simd_ulong3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong1 x, simd_ulong2 yz) { - simd_ulong3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong2 xy, simd_ulong1 z) { - simd_ulong3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong1 other) { - simd_ulong3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3_undef(simd_ulong1 other) { - simd_ulong3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong2 other) { - simd_ulong3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3_undef(simd_ulong2 other) { - simd_ulong3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong3 simd_make_ulong3(simd_ulong8 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 64-bit unsigned integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong1 x, simd_ulong1 y, simd_ulong1 z, simd_ulong1 w) { - simd_ulong4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong1 x, simd_ulong1 y, simd_ulong2 zw) { - simd_ulong4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong1 x, simd_ulong2 yz, simd_ulong1 w) { - simd_ulong4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong2 xy, simd_ulong1 z, simd_ulong1 w) { - simd_ulong4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong1 x, simd_ulong3 yzw) { - simd_ulong4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong2 xy, simd_ulong2 zw) { - simd_ulong4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong3 xyz, simd_ulong1 w) { - simd_ulong4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong1 other) { - simd_ulong4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4_undef(simd_ulong1 other) { - simd_ulong4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong2 other) { - simd_ulong4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4_undef(simd_ulong2 other) { - simd_ulong4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong3 other) { - simd_ulong4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4_undef(simd_ulong3 other) { - simd_ulong4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong4 simd_make_ulong4(simd_ulong8 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 64-bit - * unsigned integers. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8(simd_ulong4 lo, simd_ulong4 hi) { - simd_ulong8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8(simd_ulong1 other) { - simd_ulong8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8_undef(simd_ulong1 other) { - simd_ulong8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8(simd_ulong2 other) { - simd_ulong8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8_undef(simd_ulong2 other) { - simd_ulong8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8(simd_ulong3 other) { - simd_ulong8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8_undef(simd_ulong3 other) { - simd_ulong8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit unsigned - * integers. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8(simd_ulong4 other) { - simd_ulong8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8_undef(simd_ulong4 other) { - simd_ulong8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_ulong8 simd_make_ulong8(simd_ulong8 other) { - return other; -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double2 simd_make_double2(double x, double y) { - simd_double2 result; - result.x = x; - result.y = y; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of two 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double2 simd_make_double2(double other) { - simd_double2 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of two 64-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_double2 simd_make_double2_undef(double other) { - simd_double2 result; - result.x = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_double2 simd_make_double2(simd_double2 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double2 simd_make_double2(simd_double3 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double2 simd_make_double2(simd_double4 other) { - return other.xy; -} - -/*! @abstract Truncates `other` to form a vector of two 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double2 simd_make_double2(simd_double8 other) { - return other.xy; -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(double x, double y, double z) { - simd_double3 result; - result.x = x; - result.y = y; - result.z = z; - return result; -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(double x, simd_double2 yz) { - simd_double3 result; - result.x = x; - result.yz = yz; - return result; -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(simd_double2 xy, double z) { - simd_double3 result; - result.xy = xy; - result.z = z; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(double other) { - simd_double3 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3_undef(double other) { - simd_double3 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(simd_double2 other) { - simd_double3 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of three 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3_undef(simd_double2 other) { - simd_double3 result; - result.xy = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(simd_double3 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of three 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(simd_double4 other) { - return other.xyz; -} - -/*! @abstract Truncates `other` to form a vector of three 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double3 simd_make_double3(simd_double8 other) { - return other.xyz; -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 64-bit floating-point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(double x, double y, double z, double w) { - simd_double4 result; - result.x = x; - result.y = y; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(double x, double y, simd_double2 zw) { - simd_double4 result; - result.x = x; - result.y = y; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(double x, simd_double2 yz, double w) { - simd_double4 result; - result.x = x; - result.yz = yz; - result.w = w; - return result; -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(simd_double2 xy, double z, double w) { - simd_double4 result; - result.xy = xy; - result.z = z; - result.w = w; - return result; -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(double x, simd_double3 yzw) { - simd_double4 result; - result.x = x; - result.yzw = yzw; - return result; -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(simd_double2 xy, simd_double2 zw) { - simd_double4 result; - result.xy = xy; - result.zw = zw; - return result; -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(simd_double3 xyz, double w) { - simd_double4 result; - result.xyz = xyz; - result.w = w; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(double other) { - simd_double4 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4_undef(double other) { - simd_double4 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(simd_double2 other) { - simd_double4 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4_undef(simd_double2 other) { - simd_double4 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of four 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(simd_double3 other) { - simd_double4 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of four 64-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4_undef(simd_double3 other) { - simd_double4 result; - result.xyz = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(simd_double4 other) { - return other; -} - -/*! @abstract Truncates `other` to form a vector of four 64-bit floating- - * point numbers. */ -static inline SIMD_CFUNC simd_double4 simd_make_double4(simd_double8 other) { - return other.xyzw; -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8(simd_double4 lo, simd_double4 hi) { - simd_double8 result; - result.lo = lo; - result.hi = hi; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8(double other) { - simd_double8 result = 0; - result.x = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8_undef(double other) { - simd_double8 result; - result.x = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8(simd_double2 other) { - simd_double8 result = 0; - result.xy = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8_undef(simd_double2 other) { - simd_double8 result; - result.xy = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8(simd_double3 other) { - simd_double8 result = 0; - result.xyz = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8_undef(simd_double3 other) { - simd_double8 result; - result.xyz = other; - return result; -} - -/*! @abstract Zero-extends `other` to form a vector of eight 64-bit - * floating-point numbers. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8(simd_double4 other) { - simd_double8 result = 0; - result.xyzw = other; - return result; -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8_undef(simd_double4 other) { - simd_double8 result; - result.xyzw = other; - return result; -} - -/*! @abstract Returns `other` unmodified. This function is a convenience for - * templated and autogenerated code. */ -static inline SIMD_CFUNC simd_double8 simd_make_double8(simd_double8 other) { - return other; -} - -#ifdef __cplusplus -} /* extern "C" */ - -namespace simd { -/*! @abstract Concatenates `x` and `y` to form a vector of two 8-bit signed - * (twos-complement) integers. */ -static inline SIMD_CPPFUNC char2 make_char2(char x, char y) { - return ::simd_make_char2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 8-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC char2 make_char2(typeN other) { - return ::simd_make_char2(other); -} - -/*! @abstract Extends `other` to form a vector of two 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC char2 make_char2_undef(typeN other) { - return ::simd_make_char2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char3 make_char3(char x, char y, char z) { - return ::simd_make_char3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char3 make_char3(char x, char2 yz) { - return ::simd_make_char3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char3 make_char3(char2 xy, char z) { - return ::simd_make_char3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 8-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC char3 make_char3(typeN other) { - return ::simd_make_char3(other); -} - -/*! @abstract Extends `other` to form a vector of three 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC char3 make_char3_undef(typeN other) { - return ::simd_make_char3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 8-bit signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char4 make_char4(char x, char y, char z, char w) { - return ::simd_make_char4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char4 make_char4(char x, char y, char2 zw) { - return ::simd_make_char4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char4 make_char4(char x, char2 yz, char w) { - return ::simd_make_char4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char4 make_char4(char2 xy, char z, char w) { - return ::simd_make_char4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char4 make_char4(char x, char3 yzw) { - return ::simd_make_char4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char4 make_char4(char2 xy, char2 zw) { - return ::simd_make_char4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char4 make_char4(char3 xyz, char w) { - return ::simd_make_char4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 8-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC char4 make_char4(typeN other) { - return ::simd_make_char4(other); -} - -/*! @abstract Extends `other` to form a vector of four 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC char4 make_char4_undef(typeN other) { - return ::simd_make_char4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char8 make_char8(char4 lo, char4 hi) { - return ::simd_make_char8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 8-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC char8 make_char8(typeN other) { - return ::simd_make_char8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC char8 make_char8_undef(typeN other) { - return ::simd_make_char8_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 8-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char16 make_char16(char8 lo, char8 hi) { - return ::simd_make_char16(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen - * 8-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC char16 make_char16(typeN other) { - return ::simd_make_char16(other); -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -template static SIMD_CPPFUNC char16 make_char16_undef(typeN other) { - return ::simd_make_char16_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 8-bit signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char32 make_char32(char16 lo, char16 hi) { - return ::simd_make_char32(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of thirty- - * two 8-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC char32 make_char32(typeN other) { - return ::simd_make_char32(other); -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -template static SIMD_CPPFUNC char32 make_char32_undef(typeN other) { - return ::simd_make_char32_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixty-four - * 8-bit signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC char64 make_char64(char32 lo, char32 hi) { - return ::simd_make_char64(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixty- - * four 8-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC char64 make_char64(typeN other) { - return ::simd_make_char64(other); -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -template static SIMD_CPPFUNC char64 make_char64_undef(typeN other) { - return ::simd_make_char64_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar2 make_uchar2(unsigned char x, unsigned char y) { - return ::simd_make_uchar2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 8-bit unsigned integers. */ -template static SIMD_CPPFUNC uchar2 make_uchar2(typeN other) { - return ::simd_make_uchar2(other); -} - -/*! @abstract Extends `other` to form a vector of two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uchar2 make_uchar2_undef(typeN other) { - return ::simd_make_uchar2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar3 make_uchar3(unsigned char x, unsigned char y, unsigned char z) { - return ::simd_make_uchar3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar3 make_uchar3(unsigned char x, uchar2 yz) { - return ::simd_make_uchar3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar3 make_uchar3(uchar2 xy, unsigned char z) { - return ::simd_make_uchar3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 8-bit unsigned integers. */ -template static SIMD_CPPFUNC uchar3 make_uchar3(typeN other) { - return ::simd_make_uchar3(other); -} - -/*! @abstract Extends `other` to form a vector of three 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uchar3 make_uchar3_undef(typeN other) { - return ::simd_make_uchar3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 8-bit unsigned integers. */ -static inline SIMD_CPPFUNC uchar4 make_uchar4(unsigned char x, unsigned char y, unsigned char z, unsigned char w) { - return ::simd_make_uchar4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar4 make_uchar4(unsigned char x, unsigned char y, uchar2 zw) { - return ::simd_make_uchar4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar4 make_uchar4(unsigned char x, uchar2 yz, unsigned char w) { - return ::simd_make_uchar4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar4 make_uchar4(uchar2 xy, unsigned char z, unsigned char w) { - return ::simd_make_uchar4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar4 make_uchar4(unsigned char x, uchar3 yzw) { - return ::simd_make_uchar4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar4 make_uchar4(uchar2 xy, uchar2 zw) { - return ::simd_make_uchar4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar4 make_uchar4(uchar3 xyz, unsigned char w) { - return ::simd_make_uchar4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 8-bit unsigned integers. */ -template static SIMD_CPPFUNC uchar4 make_uchar4(typeN other) { - return ::simd_make_uchar4(other); -} - -/*! @abstract Extends `other` to form a vector of four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uchar4 make_uchar4_undef(typeN other) { - return ::simd_make_uchar4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar8 make_uchar8(uchar4 lo, uchar4 hi) { - return ::simd_make_uchar8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 8-bit unsigned integers. */ -template static SIMD_CPPFUNC uchar8 make_uchar8(typeN other) { - return ::simd_make_uchar8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uchar8 make_uchar8_undef(typeN other) { - return ::simd_make_uchar8_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 8-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uchar16 make_uchar16(uchar8 lo, uchar8 hi) { - return ::simd_make_uchar16(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen - * 8-bit unsigned integers. */ -template static SIMD_CPPFUNC uchar16 make_uchar16(typeN other) { - return ::simd_make_uchar16(other); -} - -/*! @abstract Extends `other` to form a vector of sixteen 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uchar16 make_uchar16_undef(typeN other) { - return ::simd_make_uchar16_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 8-bit unsigned integers. */ -static inline SIMD_CPPFUNC uchar32 make_uchar32(uchar16 lo, uchar16 hi) { - return ::simd_make_uchar32(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of thirty- - * two 8-bit unsigned integers. */ -template static SIMD_CPPFUNC uchar32 make_uchar32(typeN other) { - return ::simd_make_uchar32(other); -} - -/*! @abstract Extends `other` to form a vector of thirty-two 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uchar32 make_uchar32_undef(typeN other) { - return ::simd_make_uchar32_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixty-four - * 8-bit unsigned integers. */ -static inline SIMD_CPPFUNC uchar64 make_uchar64(uchar32 lo, uchar32 hi) { - return ::simd_make_uchar64(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixty- - * four 8-bit unsigned integers. */ -template static SIMD_CPPFUNC uchar64 make_uchar64(typeN other) { - return ::simd_make_uchar64(other); -} - -/*! @abstract Extends `other` to form a vector of sixty-four 8-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uchar64 make_uchar64_undef(typeN other) { - return ::simd_make_uchar64_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 16-bit signed - * (twos-complement) integers. */ -static inline SIMD_CPPFUNC short2 make_short2(short x, short y) { - return ::simd_make_short2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 16-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC short2 make_short2(typeN other) { - return ::simd_make_short2(other); -} - -/*! @abstract Extends `other` to form a vector of two 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC short2 make_short2_undef(typeN other) { - return ::simd_make_short2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short3 make_short3(short x, short y, short z) { - return ::simd_make_short3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short3 make_short3(short x, short2 yz) { - return ::simd_make_short3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short3 make_short3(short2 xy, short z) { - return ::simd_make_short3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 16-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC short3 make_short3(typeN other) { - return ::simd_make_short3(other); -} - -/*! @abstract Extends `other` to form a vector of three 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC short3 make_short3_undef(typeN other) { - return ::simd_make_short3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 16-bit signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short4 make_short4(short x, short y, short z, short w) { - return ::simd_make_short4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short4 make_short4(short x, short y, short2 zw) { - return ::simd_make_short4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short4 make_short4(short x, short2 yz, short w) { - return ::simd_make_short4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short4 make_short4(short2 xy, short z, short w) { - return ::simd_make_short4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short4 make_short4(short x, short3 yzw) { - return ::simd_make_short4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short4 make_short4(short2 xy, short2 zw) { - return ::simd_make_short4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short4 make_short4(short3 xyz, short w) { - return ::simd_make_short4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 16-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC short4 make_short4(typeN other) { - return ::simd_make_short4(other); -} - -/*! @abstract Extends `other` to form a vector of four 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC short4 make_short4_undef(typeN other) { - return ::simd_make_short4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short8 make_short8(short4 lo, short4 hi) { - return ::simd_make_short8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 16-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC short8 make_short8(typeN other) { - return ::simd_make_short8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC short8 make_short8_undef(typeN other) { - return ::simd_make_short8_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 16-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short16 make_short16(short8 lo, short8 hi) { - return ::simd_make_short16(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen - * 16-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC short16 make_short16(typeN other) { - return ::simd_make_short16(other); -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -template static SIMD_CPPFUNC short16 make_short16_undef(typeN other) { - return ::simd_make_short16_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 16-bit signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC short32 make_short32(short16 lo, short16 hi) { - return ::simd_make_short32(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of thirty- - * two 16-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC short32 make_short32(typeN other) { - return ::simd_make_short32(other); -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -template static SIMD_CPPFUNC short32 make_short32_undef(typeN other) { - return ::simd_make_short32_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort2 make_ushort2(unsigned short x, unsigned short y) { - return ::simd_make_ushort2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 16-bit unsigned integers. */ -template static SIMD_CPPFUNC ushort2 make_ushort2(typeN other) { - return ::simd_make_ushort2(other); -} - -/*! @abstract Extends `other` to form a vector of two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ushort2 make_ushort2_undef(typeN other) { - return ::simd_make_ushort2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort3 make_ushort3(unsigned short x, unsigned short y, unsigned short z) { - return ::simd_make_ushort3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort3 make_ushort3(unsigned short x, ushort2 yz) { - return ::simd_make_ushort3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort3 make_ushort3(ushort2 xy, unsigned short z) { - return ::simd_make_ushort3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 16-bit unsigned integers. */ -template static SIMD_CPPFUNC ushort3 make_ushort3(typeN other) { - return ::simd_make_ushort3(other); -} - -/*! @abstract Extends `other` to form a vector of three 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ushort3 make_ushort3_undef(typeN other) { - return ::simd_make_ushort3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 16-bit unsigned integers. */ -static inline SIMD_CPPFUNC ushort4 make_ushort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w) { - return ::simd_make_ushort4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort4 make_ushort4(unsigned short x, unsigned short y, ushort2 zw) { - return ::simd_make_ushort4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort4 make_ushort4(unsigned short x, ushort2 yz, unsigned short w) { - return ::simd_make_ushort4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort4 make_ushort4(ushort2 xy, unsigned short z, unsigned short w) { - return ::simd_make_ushort4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort4 make_ushort4(unsigned short x, ushort3 yzw) { - return ::simd_make_ushort4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort4 make_ushort4(ushort2 xy, ushort2 zw) { - return ::simd_make_ushort4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort4 make_ushort4(ushort3 xyz, unsigned short w) { - return ::simd_make_ushort4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 16-bit unsigned integers. */ -template static SIMD_CPPFUNC ushort4 make_ushort4(typeN other) { - return ::simd_make_ushort4(other); -} - -/*! @abstract Extends `other` to form a vector of four 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ushort4 make_ushort4_undef(typeN other) { - return ::simd_make_ushort4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort8 make_ushort8(ushort4 lo, ushort4 hi) { - return ::simd_make_ushort8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 16-bit unsigned integers. */ -template static SIMD_CPPFUNC ushort8 make_ushort8(typeN other) { - return ::simd_make_ushort8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ushort8 make_ushort8_undef(typeN other) { - return ::simd_make_ushort8_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 16-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ushort16 make_ushort16(ushort8 lo, ushort8 hi) { - return ::simd_make_ushort16(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen - * 16-bit unsigned integers. */ -template static SIMD_CPPFUNC ushort16 make_ushort16(typeN other) { - return ::simd_make_ushort16(other); -} - -/*! @abstract Extends `other` to form a vector of sixteen 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ushort16 make_ushort16_undef(typeN other) { - return ::simd_make_ushort16_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two - * 16-bit unsigned integers. */ -static inline SIMD_CPPFUNC ushort32 make_ushort32(ushort16 lo, ushort16 hi) { - return ::simd_make_ushort32(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of thirty- - * two 16-bit unsigned integers. */ -template static SIMD_CPPFUNC ushort32 make_ushort32(typeN other) { - return ::simd_make_ushort32(other); -} - -/*! @abstract Extends `other` to form a vector of thirty-two 16-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ushort32 make_ushort32_undef(typeN other) { - return ::simd_make_ushort32_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 32-bit signed - * (twos-complement) integers. */ -static inline SIMD_CPPFUNC int2 make_int2(int x, int y) { - return ::simd_make_int2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 32-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC int2 make_int2(typeN other) { - return ::simd_make_int2(other); -} - -/*! @abstract Extends `other` to form a vector of two 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC int2 make_int2_undef(typeN other) { - return ::simd_make_int2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int3 make_int3(int x, int y, int z) { - return ::simd_make_int3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int3 make_int3(int x, int2 yz) { - return ::simd_make_int3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int3 make_int3(int2 xy, int z) { - return ::simd_make_int3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 32-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC int3 make_int3(typeN other) { - return ::simd_make_int3(other); -} - -/*! @abstract Extends `other` to form a vector of three 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC int3 make_int3_undef(typeN other) { - return ::simd_make_int3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 32-bit signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int4 make_int4(int x, int y, int z, int w) { - return ::simd_make_int4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int4 make_int4(int x, int y, int2 zw) { - return ::simd_make_int4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int4 make_int4(int x, int2 yz, int w) { - return ::simd_make_int4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int4 make_int4(int2 xy, int z, int w) { - return ::simd_make_int4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int4 make_int4(int x, int3 yzw) { - return ::simd_make_int4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int4 make_int4(int2 xy, int2 zw) { - return ::simd_make_int4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int4 make_int4(int3 xyz, int w) { - return ::simd_make_int4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 32-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC int4 make_int4(typeN other) { - return ::simd_make_int4(other); -} - -/*! @abstract Extends `other` to form a vector of four 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC int4 make_int4_undef(typeN other) { - return ::simd_make_int4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int8 make_int8(int4 lo, int4 hi) { - return ::simd_make_int8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 32-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC int8 make_int8(typeN other) { - return ::simd_make_int8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC int8 make_int8_undef(typeN other) { - return ::simd_make_int8_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 32-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC int16 make_int16(int8 lo, int8 hi) { - return ::simd_make_int16(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen - * 32-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC int16 make_int16(typeN other) { - return ::simd_make_int16(other); -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit signed - * (twos-complement) integers. The contents of the newly-created vector - * lanes are unspecified. */ -template static SIMD_CPPFUNC int16 make_int16_undef(typeN other) { - return ::simd_make_int16_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint2 make_uint2(unsigned int x, unsigned int y) { - return ::simd_make_uint2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 32-bit unsigned integers. */ -template static SIMD_CPPFUNC uint2 make_uint2(typeN other) { - return ::simd_make_uint2(other); -} - -/*! @abstract Extends `other` to form a vector of two 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uint2 make_uint2_undef(typeN other) { - return ::simd_make_uint2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint3 make_uint3(unsigned int x, unsigned int y, unsigned int z) { - return ::simd_make_uint3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint3 make_uint3(unsigned int x, uint2 yz) { - return ::simd_make_uint3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint3 make_uint3(uint2 xy, unsigned int z) { - return ::simd_make_uint3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 32-bit unsigned integers. */ -template static SIMD_CPPFUNC uint3 make_uint3(typeN other) { - return ::simd_make_uint3(other); -} - -/*! @abstract Extends `other` to form a vector of three 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uint3 make_uint3_undef(typeN other) { - return ::simd_make_uint3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 32-bit unsigned integers. */ -static inline SIMD_CPPFUNC uint4 make_uint4(unsigned int x, unsigned int y, unsigned int z, unsigned int w) { - return ::simd_make_uint4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint4 make_uint4(unsigned int x, unsigned int y, uint2 zw) { - return ::simd_make_uint4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint4 make_uint4(unsigned int x, uint2 yz, unsigned int w) { - return ::simd_make_uint4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint4 make_uint4(uint2 xy, unsigned int z, unsigned int w) { - return ::simd_make_uint4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint4 make_uint4(unsigned int x, uint3 yzw) { - return ::simd_make_uint4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint4 make_uint4(uint2 xy, uint2 zw) { - return ::simd_make_uint4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint4 make_uint4(uint3 xyz, unsigned int w) { - return ::simd_make_uint4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 32-bit unsigned integers. */ -template static SIMD_CPPFUNC uint4 make_uint4(typeN other) { - return ::simd_make_uint4(other); -} - -/*! @abstract Extends `other` to form a vector of four 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uint4 make_uint4_undef(typeN other) { - return ::simd_make_uint4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint8 make_uint8(uint4 lo, uint4 hi) { - return ::simd_make_uint8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 32-bit unsigned integers. */ -template static SIMD_CPPFUNC uint8 make_uint8(typeN other) { - return ::simd_make_uint8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uint8 make_uint8_undef(typeN other) { - return ::simd_make_uint8_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 32-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC uint16 make_uint16(uint8 lo, uint8 hi) { - return ::simd_make_uint16(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen - * 32-bit unsigned integers. */ -template static SIMD_CPPFUNC uint16 make_uint16(typeN other) { - return ::simd_make_uint16(other); -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC uint16 make_uint16_undef(typeN other) { - return ::simd_make_uint16_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float2 make_float2(float x, float y) { - return ::simd_make_float2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 32-bit floating-point numbers. */ -template static SIMD_CPPFUNC float2 make_float2(typeN other) { - return ::simd_make_float2(other); -} - -/*! @abstract Extends `other` to form a vector of two 32-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -template static SIMD_CPPFUNC float2 make_float2_undef(typeN other) { - return ::simd_make_float2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float3 make_float3(float x, float y, float z) { - return ::simd_make_float3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float3 make_float3(float x, float2 yz) { - return ::simd_make_float3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float3 make_float3(float2 xy, float z) { - return ::simd_make_float3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 32-bit floating-point numbers. */ -template static SIMD_CPPFUNC float3 make_float3(typeN other) { - return ::simd_make_float3(other); -} - -/*! @abstract Extends `other` to form a vector of three 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC float3 make_float3_undef(typeN other) { - return ::simd_make_float3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 32-bit floating-point numbers. */ -static inline SIMD_CPPFUNC float4 make_float4(float x, float y, float z, float w) { - return ::simd_make_float4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float4 make_float4(float x, float y, float2 zw) { - return ::simd_make_float4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float4 make_float4(float x, float2 yz, float w) { - return ::simd_make_float4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float4 make_float4(float2 xy, float z, float w) { - return ::simd_make_float4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float4 make_float4(float x, float3 yzw) { - return ::simd_make_float4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float4 make_float4(float2 xy, float2 zw) { - return ::simd_make_float4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float4 make_float4(float3 xyz, float w) { - return ::simd_make_float4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 32-bit floating-point numbers. */ -template static SIMD_CPPFUNC float4 make_float4(typeN other) { - return ::simd_make_float4(other); -} - -/*! @abstract Extends `other` to form a vector of four 32-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -template static SIMD_CPPFUNC float4 make_float4_undef(typeN other) { - return ::simd_make_float4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float8 make_float8(float4 lo, float4 hi) { - return ::simd_make_float8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 32-bit floating-point numbers. */ -template static SIMD_CPPFUNC float8 make_float8(typeN other) { - return ::simd_make_float8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC float8 make_float8_undef(typeN other) { - return ::simd_make_float8_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 32-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC float16 make_float16(float8 lo, float8 hi) { - return ::simd_make_float16(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen - * 32-bit floating-point numbers. */ -template static SIMD_CPPFUNC float16 make_float16(typeN other) { - return ::simd_make_float16(other); -} - -/*! @abstract Extends `other` to form a vector of sixteen 32-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC float16 make_float16_undef(typeN other) { - return ::simd_make_float16_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 64-bit signed - * (twos-complement) integers. */ -static inline SIMD_CPPFUNC long2 make_long2(long1 x, long1 y) { - return ::simd_make_long2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 64-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC long2 make_long2(typeN other) { - return ::simd_make_long2(other); -} - -/*! @abstract Extends `other` to form a vector of two 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC long2 make_long2_undef(typeN other) { - return ::simd_make_long2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long3 make_long3(long1 x, long1 y, long1 z) { - return ::simd_make_long3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long3 make_long3(long1 x, long2 yz) { - return ::simd_make_long3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long3 make_long3(long2 xy, long1 z) { - return ::simd_make_long3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 64-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC long3 make_long3(typeN other) { - return ::simd_make_long3(other); -} - -/*! @abstract Extends `other` to form a vector of three 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC long3 make_long3_undef(typeN other) { - return ::simd_make_long3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 64-bit signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long4 make_long4(long1 x, long1 y, long1 z, long1 w) { - return ::simd_make_long4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long4 make_long4(long1 x, long1 y, long2 zw) { - return ::simd_make_long4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long4 make_long4(long1 x, long2 yz, long1 w) { - return ::simd_make_long4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long4 make_long4(long2 xy, long1 z, long1 w) { - return ::simd_make_long4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long4 make_long4(long1 x, long3 yzw) { - return ::simd_make_long4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long4 make_long4(long2 xy, long2 zw) { - return ::simd_make_long4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long4 make_long4(long3 xyz, long1 w) { - return ::simd_make_long4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 64-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC long4 make_long4(typeN other) { - return ::simd_make_long4(other); -} - -/*! @abstract Extends `other` to form a vector of four 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC long4 make_long4_undef(typeN other) { - return ::simd_make_long4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 64-bit - * signed (twos-complement) integers. */ -static inline SIMD_CPPFUNC long8 make_long8(long4 lo, long4 hi) { - return ::simd_make_long8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 64-bit signed (twos-complement) integers. */ -template static SIMD_CPPFUNC long8 make_long8(typeN other) { - return ::simd_make_long8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit signed (twos- - * complement) integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC long8 make_long8_undef(typeN other) { - return ::simd_make_long8_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong2 make_ulong2(ulong1 x, ulong1 y) { - return ::simd_make_ulong2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 64-bit unsigned integers. */ -template static SIMD_CPPFUNC ulong2 make_ulong2(typeN other) { - return ::simd_make_ulong2(other); -} - -/*! @abstract Extends `other` to form a vector of two 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ulong2 make_ulong2_undef(typeN other) { - return ::simd_make_ulong2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong3 make_ulong3(ulong1 x, ulong1 y, ulong1 z) { - return ::simd_make_ulong3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong3 make_ulong3(ulong1 x, ulong2 yz) { - return ::simd_make_ulong3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong3 make_ulong3(ulong2 xy, ulong1 z) { - return ::simd_make_ulong3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 64-bit unsigned integers. */ -template static SIMD_CPPFUNC ulong3 make_ulong3(typeN other) { - return ::simd_make_ulong3(other); -} - -/*! @abstract Extends `other` to form a vector of three 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ulong3 make_ulong3_undef(typeN other) { - return ::simd_make_ulong3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 64-bit unsigned integers. */ -static inline SIMD_CPPFUNC ulong4 make_ulong4(ulong1 x, ulong1 y, ulong1 z, ulong1 w) { - return ::simd_make_ulong4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong4 make_ulong4(ulong1 x, ulong1 y, ulong2 zw) { - return ::simd_make_ulong4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong4 make_ulong4(ulong1 x, ulong2 yz, ulong1 w) { - return ::simd_make_ulong4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong4 make_ulong4(ulong2 xy, ulong1 z, ulong1 w) { - return ::simd_make_ulong4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong4 make_ulong4(ulong1 x, ulong3 yzw) { - return ::simd_make_ulong4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong4 make_ulong4(ulong2 xy, ulong2 zw) { - return ::simd_make_ulong4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong4 make_ulong4(ulong3 xyz, ulong1 w) { - return ::simd_make_ulong4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 64-bit unsigned integers. */ -template static SIMD_CPPFUNC ulong4 make_ulong4(typeN other) { - return ::simd_make_ulong4(other); -} - -/*! @abstract Extends `other` to form a vector of four 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ulong4 make_ulong4_undef(typeN other) { - return ::simd_make_ulong4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 64-bit - * unsigned integers. */ -static inline SIMD_CPPFUNC ulong8 make_ulong8(ulong4 lo, ulong4 hi) { - return ::simd_make_ulong8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 64-bit unsigned integers. */ -template static SIMD_CPPFUNC ulong8 make_ulong8(typeN other) { - return ::simd_make_ulong8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit unsigned - * integers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC ulong8 make_ulong8_undef(typeN other) { - return ::simd_make_ulong8_undef(other); -} - -/*! @abstract Concatenates `x` and `y` to form a vector of two 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double2 make_double2(double x, double y) { - return ::simd_make_double2(x, y); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of two - * 64-bit floating-point numbers. */ -template static SIMD_CPPFUNC double2 make_double2(typeN other) { - return ::simd_make_double2(other); -} - -/*! @abstract Extends `other` to form a vector of two 64-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -template static SIMD_CPPFUNC double2 make_double2_undef(typeN other) { - return ::simd_make_double2_undef(other); -} - -/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double3 make_double3(double x, double y, double z) { - return ::simd_make_double3(x, y, z); -} - -/*! @abstract Concatenates `x` and `yz` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double3 make_double3(double x, double2 yz) { - return ::simd_make_double3(x, yz); -} - -/*! @abstract Concatenates `xy` and `z` to form a vector of three 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double3 make_double3(double2 xy, double z) { - return ::simd_make_double3(xy, z); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of three - * 64-bit floating-point numbers. */ -template static SIMD_CPPFUNC double3 make_double3(typeN other) { - return ::simd_make_double3(other); -} - -/*! @abstract Extends `other` to form a vector of three 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC double3 make_double3_undef(typeN other) { - return ::simd_make_double3_undef(other); -} - -/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four - * 64-bit floating-point numbers. */ -static inline SIMD_CPPFUNC double4 make_double4(double x, double y, double z, double w) { - return ::simd_make_double4(x, y, z, w); -} - -/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double4 make_double4(double x, double y, double2 zw) { - return ::simd_make_double4(x, y, zw); -} - -/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double4 make_double4(double x, double2 yz, double w) { - return ::simd_make_double4(x, yz, w); -} - -/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double4 make_double4(double2 xy, double z, double w) { - return ::simd_make_double4(xy, z, w); -} - -/*! @abstract Concatenates `x` and `yzw` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double4 make_double4(double x, double3 yzw) { - return ::simd_make_double4(x, yzw); -} - -/*! @abstract Concatenates `xy` and `zw` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double4 make_double4(double2 xy, double2 zw) { - return ::simd_make_double4(xy, zw); -} - -/*! @abstract Concatenates `xyz` and `w` to form a vector of four 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double4 make_double4(double3 xyz, double w) { - return ::simd_make_double4(xyz, w); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of four - * 64-bit floating-point numbers. */ -template static SIMD_CPPFUNC double4 make_double4(typeN other) { - return ::simd_make_double4(other); -} - -/*! @abstract Extends `other` to form a vector of four 64-bit floating-point - * numbers. The contents of the newly-created vector lanes are unspecified. */ -template static SIMD_CPPFUNC double4 make_double4_undef(typeN other) { - return ::simd_make_double4_undef(other); -} - -/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 64-bit - * floating-point numbers. */ -static inline SIMD_CPPFUNC double8 make_double8(double4 lo, double4 hi) { - return ::simd_make_double8(lo, hi); -} - -/*! @abstract Truncates or zero-extends `other` to form a vector of eight - * 64-bit floating-point numbers. */ -template static SIMD_CPPFUNC double8 make_double8(typeN other) { - return ::simd_make_double8(other); -} - -/*! @abstract Extends `other` to form a vector of eight 64-bit floating- - * point numbers. The contents of the newly-created vector lanes are - * unspecified. */ -template static SIMD_CPPFUNC double8 make_double8_undef(typeN other) { - return ::simd_make_double8_undef(other); -} - -} /* namespace simd */ -#endif /* __cplusplus */ -#endif /* SIMD_COMPILER_HAS_REQUIRED_FEATURES */ -#endif /* SIMD_VECTOR_CONSTRUCTORS */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/spawn.h b/lib/libc/include/x86_64-macos.10-none/spawn.h deleted file mode 100644 index 8441df3abe..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/spawn.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2006, 2010 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - - -#ifndef _SPAWN_H_ -#define _SPAWN_H_ - -/* - * [SPN] Support for _POSIX_SPAWN - */ - -#include -#include <_types.h> -#include /* shared types */ - -#include - -/* - * [SPN] Inclusion of the header may make visible symbols defined - * in the , , and headers. - */ -#include -#include -#include - -/* - * Opaque types for use with posix_spawn() family functions. Internals are - * not defined, and should not be accessed directly. Types are defined as - * mandated by POSIX. - */ -typedef void *posix_spawnattr_t; -typedef void *posix_spawn_file_actions_t; - -__BEGIN_DECLS -/* - * gcc under c99 mode won't compile "[ __restrict]" by itself. As a workaround, - * a dummy argument name is added. - */ - -int posix_spawn(pid_t * __restrict, const char * __restrict, - const posix_spawn_file_actions_t *, - const posix_spawnattr_t * __restrict, - char *const __argv[__restrict], - char *const __envp[__restrict]) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnp(pid_t * __restrict, const char * __restrict, - const posix_spawn_file_actions_t *, - const posix_spawnattr_t * __restrict, - char *const __argv[__restrict], - char *const __envp[__restrict]) __API_AVAILABLE(macos(10.5), ios(2.0)); - -int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, - int) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawn_file_actions_addopen( - posix_spawn_file_actions_t * __restrict, int, - const char * __restrict, int, mode_t) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawn_file_actions_init(posix_spawn_file_actions_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_destroy(posix_spawnattr_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict, - sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_getflags(const posix_spawnattr_t * __restrict, - short * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict, - pid_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict, - sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_init(posix_spawnattr_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setsigdefault(posix_spawnattr_t * __restrict, - const sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setflags(posix_spawnattr_t *, short) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict, - const sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -#if 0 /* _POSIX_PRIORITY_SCHEDULING [PS] : not supported */ -int posix_spawnattr_setschedparam(posix_spawnattr_t * __restrict, - const struct sched_param * __restrict); -int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int); -int posix_spawnattr_getschedparam(const posix_spawnattr_t * __restrict, - struct sched_param * __restrict); -int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict, - int * __restrict); -#endif /* 0 */ - -__END_DECLS - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -/* - * Darwin-specific extensions below - */ -#include -#include -#include - -#include - -__BEGIN_DECLS - -int posix_spawnattr_getbinpref_np(const posix_spawnattr_t * __restrict, - size_t, cpu_type_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setauditsessionport_np(posix_spawnattr_t * __restrict, - mach_port_t) __API_AVAILABLE(macos(10.6), ios(3.2)); - -int posix_spawnattr_setbinpref_np(posix_spawnattr_t * __restrict, - size_t, cpu_type_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setexceptionports_np(posix_spawnattr_t * __restrict, - exception_mask_t, mach_port_t, - exception_behavior_t, thread_state_flavor_t) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setspecialport_np(posix_spawnattr_t * __restrict, - mach_port_t, int) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawnattr_setsuidcredport_np(posix_spawnattr_t * __restrict, mach_port_t) __API_UNAVAILABLE(ios, macos); - -int posix_spawn_file_actions_addinherit_np(posix_spawn_file_actions_t *, - int) __API_AVAILABLE(macos(10.7), ios(4.3)) __API_UNAVAILABLE(watchos, tvos); - -int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *, - const char * __restrict) __API_AVAILABLE(macos(10.15)) __API_UNAVAILABLE(ios, tvos, watchos); - -int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, - int) __API_AVAILABLE(macos(10.15)) __API_UNAVAILABLE(ios, tvos, watchos); - -__END_DECLS - -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ -#endif /* _SPAWN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/string.h b/lib/libc/include/x86_64-macos.10-none/string.h deleted file mode 100644 index bca8f8c881..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/string.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2000, 2007, 2010 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)string.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _STRING_H_ -#define _STRING_H_ - -#include <_types.h> -#include -#include -#include -#include - -/* ANSI-C */ - -__BEGIN_DECLS -void *memchr(const void *__s, int __c, size_t __n); -int memcmp(const void *__s1, const void *__s2, size_t __n); -void *memcpy(void *__dst, const void *__src, size_t __n); -void *memmove(void *__dst, const void *__src, size_t __len); -void *memset(void *__b, int __c, size_t __len); -char *strcat(char *__s1, const char *__s2); -char *strchr(const char *__s, int __c); -int strcmp(const char *__s1, const char *__s2); -int strcoll(const char *__s1, const char *__s2); -char *strcpy(char *__dst, const char *__src); -size_t strcspn(const char *__s, const char *__charset); -char *strerror(int __errnum) __DARWIN_ALIAS(strerror); -size_t strlen(const char *__s); -char *strncat(char *__s1, const char *__s2, size_t __n); -int strncmp(const char *__s1, const char *__s2, size_t __n); -char *strncpy(char *__dst, const char *__src, size_t __n); -char *strpbrk(const char *__s, const char *__charset); -char *strrchr(const char *__s, int __c); -size_t strspn(const char *__s, const char *__charset); -char *strstr(const char *__big, const char *__little); -char *strtok(char *__str, const char *__sep); -size_t strxfrm(char *__s1, const char *__s2, size_t __n); -__END_DECLS - - - -/* Additional functionality provided by: - * POSIX.1c-1995, - * POSIX.1i-1995, - * and the omnibus ISO/IEC 9945-1: 1996 - */ - -#if __DARWIN_C_LEVEL >= 199506L -__BEGIN_DECLS -char *strtok_r(char *__str, const char *__sep, char **__lasts); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 199506L */ - - - -/* Additional functionality provided by: - * POSIX.1-2001 - */ - -#if __DARWIN_C_LEVEL >= 200112L -__BEGIN_DECLS -int strerror_r(int __errnum, char *__strerrbuf, size_t __buflen); -char *strdup(const char *__s1); -void *memccpy(void *__dst, const void *__src, int __c, size_t __n); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200112L */ - - - -/* Additional functionality provided by: - * POSIX.1-2008 - */ - -#if __DARWIN_C_LEVEL >= 200809L -__BEGIN_DECLS -char *stpcpy(char *__dst, const char *__src); -char *stpncpy(char *__dst, const char *__src, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -char *strndup(const char *__s1, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -size_t strnlen(const char *__s1, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -char *strsignal(int __sig); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200809L */ - -/* C11 Annex K */ - -#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 -#include -#include - -__BEGIN_DECLS -errno_t memset_s(void *__s, rsize_t __smax, int __c, rsize_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0); -__END_DECLS -#endif - -/* Darwin extensions */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#include - -__BEGIN_DECLS -void *memmem(const void *__big, size_t __big_len, const void *__little, size_t __little_len) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -void memset_pattern4(void *__b, const void *__pattern4, size_t __len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0); -void memset_pattern8(void *__b, const void *__pattern8, size_t __len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0); -void memset_pattern16(void *__b, const void *__pattern16, size_t __len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0); - -char *strcasestr(const char *__big, const char *__little); -char *strnstr(const char *__big, const char *__little, size_t __len); -size_t strlcat(char *__dst, const char *__source, size_t __size); -size_t strlcpy(char *__dst, const char *__source, size_t __size); -void strmode(int __mode, char *__bp); -char *strsep(char **__stringp, const char *__delim); - -/* SUS places swab() in unistd.h. It is listed here for source compatibility */ -void swab(const void * __restrict, void * __restrict, ssize_t); - -__OSX_AVAILABLE(10.12.1) __IOS_AVAILABLE(10.1) -__TVOS_AVAILABLE(10.0.1) __WATCHOS_AVAILABLE(3.1) -int timingsafe_bcmp(const void *__b1, const void *__b2, size_t __len); -__END_DECLS - -/* Some functions historically defined in string.h were placed in strings.h - * by SUS. We are using "strings.h" instead of to avoid an issue - * where /Developer/Headers/FlatCarbon/Strings.h could be included instead on - * case-insensitive file systems. - */ -#include "strings.h" -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - - -#ifdef _USE_EXTENDED_LOCALES_ -#include -#endif /* _USE_EXTENDED_LOCALES_ */ - -#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus) -/* Security checking functions. */ -#include -#endif - -#endif /* _STRING_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_attr_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_attr_t.h deleted file mode 100644 index a71842cb99..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_attr_t.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _PTHREAD_ATTR_T -#define _PTHREAD_ATTR_T -#include /* __darwin_pthread_attr_t */ -typedef __darwin_pthread_attr_t pthread_attr_t; -#endif /* _PTHREAD_ATTR_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_cond_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_cond_t.h deleted file mode 100644 index 3eceff6274..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_cond_t.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _PTHREAD_COND_T -#define _PTHREAD_COND_T -#include /* __darwin_pthread_cond_t */ -typedef __darwin_pthread_cond_t pthread_cond_t; -#endif /* _PTHREAD_COND_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_condattr_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_condattr_t.h deleted file mode 100644 index 7fd62badd7..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_condattr_t.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _PTHREAD_CONDATTR_T -#define _PTHREAD_CONDATTR_T -#include /* __darwin_pthread_condattr_t */ -typedef __darwin_pthread_condattr_t pthread_condattr_t; -#endif /* _PTHREAD_CONDATTR_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_rwlock_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_rwlock_t.h deleted file mode 100644 index dc1f013f3b..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_rwlock_t.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _PTHREAD_RWLOCK_T -#define _PTHREAD_RWLOCK_T -#include /* __darwin_pthread_rwlock_t */ -typedef __darwin_pthread_rwlock_t pthread_rwlock_t; -#endif /* _PTHREAD_RWLOCK_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_rwlockattr_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_rwlockattr_t.h deleted file mode 100644 index 99fda712f4..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_rwlockattr_t.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _PTHREAD_RWLOCKATTR_T -#define _PTHREAD_RWLOCKATTR_T -#include /* __darwin_pthread_rwlockattr_t */ -typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t; -#endif /* _PTHREAD_RWLOCKATTR_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_t.h deleted file mode 100644 index 87f42ee9aa..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_t.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _PTHREAD_T -#define _PTHREAD_T -#include /* __darwin_pthread_t */ -typedef __darwin_pthread_t pthread_t; -#endif /* _PTHREAD_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_types.h b/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_types.h deleted file mode 100644 index 7aa42bdff1..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_pthread/_pthread_types.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2003-2013 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _SYS__PTHREAD_TYPES_H_ -#define _SYS__PTHREAD_TYPES_H_ - -#include - -// pthread opaque structures -#if defined(__LP64__) -#define __PTHREAD_SIZE__ 8176 -#define __PTHREAD_ATTR_SIZE__ 56 -#define __PTHREAD_MUTEXATTR_SIZE__ 8 -#define __PTHREAD_MUTEX_SIZE__ 56 -#define __PTHREAD_CONDATTR_SIZE__ 8 -#define __PTHREAD_COND_SIZE__ 40 -#define __PTHREAD_ONCE_SIZE__ 8 -#define __PTHREAD_RWLOCK_SIZE__ 192 -#define __PTHREAD_RWLOCKATTR_SIZE__ 16 -#else // !__LP64__ -#define __PTHREAD_SIZE__ 4088 -#define __PTHREAD_ATTR_SIZE__ 36 -#define __PTHREAD_MUTEXATTR_SIZE__ 8 -#define __PTHREAD_MUTEX_SIZE__ 40 -#define __PTHREAD_CONDATTR_SIZE__ 4 -#define __PTHREAD_COND_SIZE__ 24 -#define __PTHREAD_ONCE_SIZE__ 4 -#define __PTHREAD_RWLOCK_SIZE__ 124 -#define __PTHREAD_RWLOCKATTR_SIZE__ 12 -#endif // !__LP64__ - -struct __darwin_pthread_handler_rec { - void (*__routine)(void *); // Routine to call - void *__arg; // Argument to pass - struct __darwin_pthread_handler_rec *__next; -}; - -struct _opaque_pthread_attr_t { - long __sig; - char __opaque[__PTHREAD_ATTR_SIZE__]; -}; - -struct _opaque_pthread_cond_t { - long __sig; - char __opaque[__PTHREAD_COND_SIZE__]; -}; - -struct _opaque_pthread_condattr_t { - long __sig; - char __opaque[__PTHREAD_CONDATTR_SIZE__]; -}; - -struct _opaque_pthread_mutex_t { - long __sig; - char __opaque[__PTHREAD_MUTEX_SIZE__]; -}; - -struct _opaque_pthread_mutexattr_t { - long __sig; - char __opaque[__PTHREAD_MUTEXATTR_SIZE__]; -}; - -struct _opaque_pthread_once_t { - long __sig; - char __opaque[__PTHREAD_ONCE_SIZE__]; -}; - -struct _opaque_pthread_rwlock_t { - long __sig; - char __opaque[__PTHREAD_RWLOCK_SIZE__]; -}; - -struct _opaque_pthread_rwlockattr_t { - long __sig; - char __opaque[__PTHREAD_RWLOCKATTR_SIZE__]; -}; - -struct _opaque_pthread_t { - long __sig; - struct __darwin_pthread_handler_rec *__cleanup_stack; - char __opaque[__PTHREAD_SIZE__]; -}; - -typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t; -typedef struct _opaque_pthread_cond_t __darwin_pthread_cond_t; -typedef struct _opaque_pthread_condattr_t __darwin_pthread_condattr_t; -typedef unsigned long __darwin_pthread_key_t; -typedef struct _opaque_pthread_mutex_t __darwin_pthread_mutex_t; -typedef struct _opaque_pthread_mutexattr_t __darwin_pthread_mutexattr_t; -typedef struct _opaque_pthread_once_t __darwin_pthread_once_t; -typedef struct _opaque_pthread_rwlock_t __darwin_pthread_rwlock_t; -typedef struct _opaque_pthread_rwlockattr_t __darwin_pthread_rwlockattr_t; -typedef struct _opaque_pthread_t *__darwin_pthread_t; - -#endif // _SYS__PTHREAD_TYPES_H_ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_select.h b/lib/libc/include/x86_64-macos.10-none/sys/_select.h deleted file mode 100644 index 70842ca2f5..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_select.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2005, 2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -/* - * This is called from sys/select.h and sys/time.h for the common prototype - * of select(). Setting _DARWIN_C_SOURCE or _DARWIN_UNLIMITED_SELECT uses - * the version of select() that does not place a limit on the first argument - * (nfds). In the UNIX conformance case, values of nfds greater than - * FD_SETSIZE will return an error of EINVAL. - */ -#ifndef _SYS__SELECT_H_ -#define _SYS__SELECT_H_ - -int select(int, fd_set * __restrict, fd_set * __restrict, - fd_set * __restrict, struct timeval * __restrict) -#if defined(_DARWIN_C_SOURCE) || defined(_DARWIN_UNLIMITED_SELECT) -__DARWIN_EXTSN_C(select) -#else /* !_DARWIN_C_SOURCE && !_DARWIN_UNLIMITED_SELECT */ -# if defined(__LP64__) && !__DARWIN_NON_CANCELABLE -__DARWIN_1050(select) -# else /* !__LP64__ || __DARWIN_NON_CANCELABLE */ -__DARWIN_ALIAS_C(select) -# endif /* __LP64__ && !__DARWIN_NON_CANCELABLE */ -#endif /* _DARWIN_C_SOURCE || _DARWIN_UNLIMITED_SELECT */ -; - -#endif /* !_SYS__SELECT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_types/_fd_def.h b/lib/libc/include/x86_64-macos.10-none/sys/_types/_fd_def.h deleted file mode 100644 index ec0bad4289..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_types/_fd_def.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _FD_SET -#define _FD_SET - -#include /* __int32_t and uintptr_t */ -#include - -/* - * Select uses bit masks of file descriptors in longs. These macros - * manipulate such bit fields (the filesystem macros use chars). The - * extra protection here is to permit application redefinition above - * the default size. - */ -#ifdef FD_SETSIZE -#define __DARWIN_FD_SETSIZE FD_SETSIZE -#else /* !FD_SETSIZE */ -#define __DARWIN_FD_SETSIZE 1024 -#endif /* FD_SETSIZE */ -#define __DARWIN_NBBY 8 /* bits in a byte */ -#define __DARWIN_NFDBITS (sizeof(__int32_t) * __DARWIN_NBBY) /* bits per mask */ -#define __DARWIN_howmany(x, y) ((((x) % (y)) == 0) ? ((x) / (y)) : (((x) / (y)) + 1)) /* # y's == x bits? */ - -__BEGIN_DECLS -typedef struct fd_set { - __int32_t fds_bits[__DARWIN_howmany(__DARWIN_FD_SETSIZE, __DARWIN_NFDBITS)]; -} fd_set; - -int __darwin_check_fd_set_overflow(int, const void *, int) __attribute__((__weak_import__)); -__END_DECLS - -__header_always_inline int -__darwin_check_fd_set(int _a, const void *_b) -{ - if ((uintptr_t)&__darwin_check_fd_set_overflow != (uintptr_t) 0) { -#if defined(_DARWIN_UNLIMITED_SELECT) || defined(_DARWIN_C_SOURCE) - return __darwin_check_fd_set_overflow(_a, _b, 1); -#else - return __darwin_check_fd_set_overflow(_a, _b, 0); -#endif - } else { - return 1; - } -} - -/* This inline avoids argument side-effect issues with FD_ISSET() */ -__header_always_inline int -__darwin_fd_isset(int _fd, const struct fd_set *_p) -{ - if (__darwin_check_fd_set(_fd, (const void *) _p)) { - return _p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] & ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))); - } - - return 0; -} - -__header_always_inline void -__darwin_fd_set(int _fd, struct fd_set *const _p) -{ - if (__darwin_check_fd_set(_fd, (const void *) _p)) { - (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] |= ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS)))); - } -} - -__header_always_inline void -__darwin_fd_clr(int _fd, struct fd_set *const _p) -{ - if (__darwin_check_fd_set(_fd, (const void *) _p)) { - (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] &= ~((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS)))); - } -} - - -#define __DARWIN_FD_SET(n, p) __darwin_fd_set((n), (p)) -#define __DARWIN_FD_CLR(n, p) __darwin_fd_clr((n), (p)) -#define __DARWIN_FD_ISSET(n, p) __darwin_fd_isset((n), (p)) - -#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3 -/* - * Use the built-in bzero function instead of the library version so that - * we do not pollute the namespace or introduce prototype warnings. - */ -#define __DARWIN_FD_ZERO(p) __builtin_bzero(p, sizeof(*(p))) -#else -#define __DARWIN_FD_ZERO(p) bzero(p, sizeof(*(p))) -#endif - -#define __DARWIN_FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) -#endif /* _FD_SET */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_types/_int8_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_types/_int8_t.h deleted file mode 100644 index 15b281d533..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_types/_int8_t.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _INT8_T -#define _INT8_T -typedef __signed char int8_t; -#endif /* _INT8_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_types/_ucontext.h b/lib/libc/include/x86_64-macos.10-none/sys/_types/_ucontext.h deleted file mode 100644 index 1e563f4581..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_types/_ucontext.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _STRUCT_UCONTEXT - -#include /* __DARWIN_UNIX03 */ - -#if __DARWIN_UNIX03 -#define _STRUCT_UCONTEXT struct __darwin_ucontext -#else /* !__DARWIN_UNIX03 */ -#define _STRUCT_UCONTEXT struct ucontext -#endif /* __DARWIN_UNIX03 */ - -#include /* __darwin_size_t */ -#include /* _STRUCT_MCONTEXT */ -#include /* __darwin_sigset_t */ - -_STRUCT_UCONTEXT -{ - int uc_onstack; - __darwin_sigset_t uc_sigmask; /* signal mask used by this context */ - _STRUCT_SIGALTSTACK uc_stack; /* stack used by this context */ - _STRUCT_UCONTEXT *uc_link; /* pointer to resuming context */ - __darwin_size_t uc_mcsize; /* size of the machine context passed in */ - _STRUCT_MCONTEXT *uc_mcontext; /* pointer to machine specific context */ -#ifdef _XOPEN_SOURCE - _STRUCT_MCONTEXT __mcontext_data; -#endif /* _XOPEN_SOURCE */ -}; - -/* user context */ -typedef _STRUCT_UCONTEXT ucontext_t; /* [???] user context */ - -#endif /* _STRUCT_UCONTEXT */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/_types/_uintptr_t.h b/lib/libc/include/x86_64-macos.10-none/sys/_types/_uintptr_t.h deleted file mode 100644 index 7971dbc86a..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/_types/_uintptr_t.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2003-2012 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifndef _UINTPTR_T -#define _UINTPTR_T -typedef unsigned long uintptr_t; -#endif /* _UINTPTR_T */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/acl.h b/lib/libc/include/x86_64-macos.10-none/sys/acl.h deleted file mode 100644 index dc134613d1..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/acl.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2004, 2010 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _SYS_ACL_H -#define _SYS_ACL_H - -#include -#include - -#define __DARWIN_ACL_READ_DATA (1<<1) -#define __DARWIN_ACL_LIST_DIRECTORY __DARWIN_ACL_READ_DATA -#define __DARWIN_ACL_WRITE_DATA (1<<2) -#define __DARWIN_ACL_ADD_FILE __DARWIN_ACL_WRITE_DATA -#define __DARWIN_ACL_EXECUTE (1<<3) -#define __DARWIN_ACL_SEARCH __DARWIN_ACL_EXECUTE -#define __DARWIN_ACL_DELETE (1<<4) -#define __DARWIN_ACL_APPEND_DATA (1<<5) -#define __DARWIN_ACL_ADD_SUBDIRECTORY __DARWIN_ACL_APPEND_DATA -#define __DARWIN_ACL_DELETE_CHILD (1<<6) -#define __DARWIN_ACL_READ_ATTRIBUTES (1<<7) -#define __DARWIN_ACL_WRITE_ATTRIBUTES (1<<8) -#define __DARWIN_ACL_READ_EXTATTRIBUTES (1<<9) -#define __DARWIN_ACL_WRITE_EXTATTRIBUTES (1<<10) -#define __DARWIN_ACL_READ_SECURITY (1<<11) -#define __DARWIN_ACL_WRITE_SECURITY (1<<12) -#define __DARWIN_ACL_CHANGE_OWNER (1<<13) -#define __DARWIN_ACL_SYNCHRONIZE (1<<20) - -#define __DARWIN_ACL_EXTENDED_ALLOW 1 -#define __DARWIN_ACL_EXTENDED_DENY 2 - -#define __DARWIN_ACL_ENTRY_INHERITED (1<<4) -#define __DARWIN_ACL_ENTRY_FILE_INHERIT (1<<5) -#define __DARWIN_ACL_ENTRY_DIRECTORY_INHERIT (1<<6) -#define __DARWIN_ACL_ENTRY_LIMIT_INHERIT (1<<7) -#define __DARWIN_ACL_ENTRY_ONLY_INHERIT (1<<8) -#define __DARWIN_ACL_FLAG_NO_INHERIT (1<<17) - -/* - * Implementation constants. - * - * The ACL_TYPE_EXTENDED binary format permits 169 entries plus - * the ACL header in a page. Give ourselves some room to grow; - * this limit is arbitrary. - */ -#define ACL_MAX_ENTRIES 128 - -/* 23.2.2 Individual object access permissions - nonstandard */ -typedef enum { - ACL_READ_DATA = __DARWIN_ACL_READ_DATA, - ACL_LIST_DIRECTORY = __DARWIN_ACL_LIST_DIRECTORY, - ACL_WRITE_DATA = __DARWIN_ACL_WRITE_DATA, - ACL_ADD_FILE = __DARWIN_ACL_ADD_FILE, - ACL_EXECUTE = __DARWIN_ACL_EXECUTE, - ACL_SEARCH = __DARWIN_ACL_SEARCH, - ACL_DELETE = __DARWIN_ACL_DELETE, - ACL_APPEND_DATA = __DARWIN_ACL_APPEND_DATA, - ACL_ADD_SUBDIRECTORY = __DARWIN_ACL_ADD_SUBDIRECTORY, - ACL_DELETE_CHILD = __DARWIN_ACL_DELETE_CHILD, - ACL_READ_ATTRIBUTES = __DARWIN_ACL_READ_ATTRIBUTES, - ACL_WRITE_ATTRIBUTES = __DARWIN_ACL_WRITE_ATTRIBUTES, - ACL_READ_EXTATTRIBUTES = __DARWIN_ACL_READ_EXTATTRIBUTES, - ACL_WRITE_EXTATTRIBUTES = __DARWIN_ACL_WRITE_EXTATTRIBUTES, - ACL_READ_SECURITY = __DARWIN_ACL_READ_SECURITY, - ACL_WRITE_SECURITY = __DARWIN_ACL_WRITE_SECURITY, - ACL_CHANGE_OWNER = __DARWIN_ACL_CHANGE_OWNER, - ACL_SYNCHRONIZE = __DARWIN_ACL_SYNCHRONIZE, -} acl_perm_t; - -/* 23.2.5 ACL entry tag type bits - nonstandard */ -typedef enum { - ACL_UNDEFINED_TAG = 0, - ACL_EXTENDED_ALLOW = __DARWIN_ACL_EXTENDED_ALLOW, - ACL_EXTENDED_DENY = __DARWIN_ACL_EXTENDED_DENY -} acl_tag_t; - -/* 23.2.6 Individual ACL types */ -typedef enum { - ACL_TYPE_EXTENDED = 0x00000100, -/* Posix 1003.1e types - not supported */ - ACL_TYPE_ACCESS = 0x00000000, - ACL_TYPE_DEFAULT = 0x00000001, -/* The following types are defined on FreeBSD/Linux - not supported */ - ACL_TYPE_AFS = 0x00000002, - ACL_TYPE_CODA = 0x00000003, - ACL_TYPE_NTFS = 0x00000004, - ACL_TYPE_NWFS = 0x00000005 -} acl_type_t; - -/* 23.2.7 ACL qualifier constants */ - -#define ACL_UNDEFINED_ID NULL /* XXX ? */ - -/* 23.2.8 ACL Entry Constants */ -typedef enum { - ACL_FIRST_ENTRY = 0, - ACL_NEXT_ENTRY = -1, - ACL_LAST_ENTRY = -2 -} acl_entry_id_t; - -/* nonstandard ACL / entry flags */ -typedef enum { - ACL_FLAG_DEFER_INHERIT = (1 << 0), /* tentative */ - ACL_FLAG_NO_INHERIT = __DARWIN_ACL_FLAG_NO_INHERIT, - ACL_ENTRY_INHERITED = __DARWIN_ACL_ENTRY_INHERITED, - ACL_ENTRY_FILE_INHERIT = __DARWIN_ACL_ENTRY_FILE_INHERIT, - ACL_ENTRY_DIRECTORY_INHERIT = __DARWIN_ACL_ENTRY_DIRECTORY_INHERIT, - ACL_ENTRY_LIMIT_INHERIT = __DARWIN_ACL_ENTRY_LIMIT_INHERIT, - ACL_ENTRY_ONLY_INHERIT = __DARWIN_ACL_ENTRY_ONLY_INHERIT -} acl_flag_t; - -/* "External" ACL types */ - -struct _acl; -struct _acl_entry; -struct _acl_permset; -struct _acl_flagset; - -typedef struct _acl *acl_t; -typedef struct _acl_entry *acl_entry_t; -typedef struct _acl_permset *acl_permset_t; -typedef struct _acl_flagset *acl_flagset_t; - -typedef u_int64_t acl_permset_mask_t; - -__BEGIN_DECLS -/* 23.1.6.1 ACL Storage Management */ -extern acl_t acl_dup(acl_t acl); -extern int acl_free(void *obj_p); -extern acl_t acl_init(int count); - -/* 23.1.6.2 (1) ACL Entry manipulation */ -extern int acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d); -extern int acl_create_entry(acl_t *acl_p, acl_entry_t *entry_p); -extern int acl_create_entry_np(acl_t *acl_p, acl_entry_t *entry_p, int entry_index); -extern int acl_delete_entry(acl_t acl, acl_entry_t entry_d); -extern int acl_get_entry(acl_t acl, int entry_id, acl_entry_t *entry_p); -extern int acl_valid(acl_t acl); -extern int acl_valid_fd_np(int fd, acl_type_t type, acl_t acl); -extern int acl_valid_file_np(const char *path, acl_type_t type, acl_t acl); -extern int acl_valid_link_np(const char *path, acl_type_t type, acl_t acl); - -/* 23.1.6.2 (2) Manipulate permissions within an ACL entry */ -extern int acl_add_perm(acl_permset_t permset_d, acl_perm_t perm); -extern int acl_calc_mask(acl_t *acl_p); /* not supported */ -extern int acl_clear_perms(acl_permset_t permset_d); -extern int acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm); -extern int acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm); -extern int acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p); -extern int acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d); - -/* nonstandard - manipulate permissions within an ACL entry using bitmasks */ -extern int acl_maximal_permset_mask_np(acl_permset_mask_t * mask_p) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -extern int acl_get_permset_mask_np(acl_entry_t entry_d, acl_permset_mask_t * mask_p) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -extern int acl_set_permset_mask_np(acl_entry_t entry_d, acl_permset_mask_t mask) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); - -/* nonstandard - manipulate flags on ACLs and entries */ -extern int acl_add_flag_np(acl_flagset_t flagset_d, acl_flag_t flag); -extern int acl_clear_flags_np(acl_flagset_t flagset_d); -extern int acl_delete_flag_np(acl_flagset_t flagset_d, acl_flag_t flag); -extern int acl_get_flag_np(acl_flagset_t flagset_d, acl_flag_t flag); -extern int acl_get_flagset_np(void *obj_p, acl_flagset_t *flagset_p); -extern int acl_set_flagset_np(void *obj_p, acl_flagset_t flagset_d); - -/* 23.1.6.2 (3) Manipulate ACL entry tag type and qualifier */ -extern void *acl_get_qualifier(acl_entry_t entry_d); -extern int acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p); -extern int acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p); -extern int acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type); - -/* 23.1.6.3 ACL manipulation on an Object */ -extern int acl_delete_def_file(const char *path_p); /* not supported */ -extern acl_t acl_get_fd(int fd); -extern acl_t acl_get_fd_np(int fd, acl_type_t type); -extern acl_t acl_get_file(const char *path_p, acl_type_t type); -extern acl_t acl_get_link_np(const char *path_p, acl_type_t type); -extern int acl_set_fd(int fd, acl_t acl); -extern int acl_set_fd_np(int fd, acl_t acl, acl_type_t acl_type); -extern int acl_set_file(const char *path_p, acl_type_t type, acl_t acl); -extern int acl_set_link_np(const char *path_p, acl_type_t type, acl_t acl); - -/* 23.1.6.4 ACL Format translation */ -extern ssize_t acl_copy_ext(void *buf_p, acl_t acl, ssize_t size); -extern ssize_t acl_copy_ext_native(void *buf_p, acl_t acl, ssize_t size); -extern acl_t acl_copy_int(const void *buf_p); -extern acl_t acl_copy_int_native(const void *buf_p); -extern acl_t acl_from_text(const char *buf_p); -extern ssize_t acl_size(acl_t acl); -extern char *acl_to_text(acl_t acl, ssize_t *len_p); -__END_DECLS - -#endif /* _SYS_ACL_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/attr.h b/lib/libc/include/x86_64-macos.10-none/sys/attr.h deleted file mode 100644 index 7de047ec5b..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/attr.h +++ /dev/null @@ -1,579 +0,0 @@ -/* - * Copyright (c) 2000-2018 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -/* - * attr.h - attribute data structures and interfaces - * - * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved. - */ - -#ifndef _SYS_ATTR_H_ -#define _SYS_ATTR_H_ - -#include - -#ifdef __APPLE_API_UNSTABLE -#include -#include -#include -#include - -#define FSOPT_NOFOLLOW 0x00000001 -#define FSOPT_NOINMEMUPDATE 0x00000002 -#define FSOPT_REPORT_FULLSIZE 0x00000004 -/* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */ -#define FSOPT_PACK_INVAL_ATTRS 0x00000008 - - -#define FSOPT_ATTR_CMN_EXTENDED 0x00000020 - -/* we currently aren't anywhere near this amount for a valid - * fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2 - * but we put a sanity check in to avoid abuse of the value passed in from - * user land. - */ -#define SEARCHFS_MAX_SEARCHPARMS 4096 - -typedef u_int32_t text_encoding_t; - -typedef u_int32_t fsobj_type_t; - -typedef u_int32_t fsobj_tag_t; - -typedef u_int32_t fsfile_type_t; - -typedef u_int32_t fsvolid_t; - -#include /* file object id type */ - -typedef u_int32_t attrgroup_t; - -struct attrlist { - u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */ - u_int16_t reserved; /* (to maintain 4-byte alignment) */ - attrgroup_t commonattr; /* common attribute group */ - attrgroup_t volattr; /* Volume attribute group */ - attrgroup_t dirattr; /* directory attribute group */ - attrgroup_t fileattr; /* file attribute group */ - attrgroup_t forkattr; /* fork attribute group */ -}; -#define ATTR_BIT_MAP_COUNT 5 - -typedef struct attribute_set { - attrgroup_t commonattr; /* common attribute group */ - attrgroup_t volattr; /* Volume attribute group */ - attrgroup_t dirattr; /* directory attribute group */ - attrgroup_t fileattr; /* file attribute group */ - attrgroup_t forkattr; /* fork attribute group */ -} attribute_set_t; - -typedef struct attrreference { - int32_t attr_dataoffset; - u_int32_t attr_length; -} attrreference_t; - -/* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */ - -struct diskextent { - u_int32_t startblock; /* first block allocated */ - u_int32_t blockcount; /* number of blocks allocated */ -}; - -typedef struct diskextent extentrecord[8]; - -typedef u_int32_t vol_capabilities_set_t[4]; - -#define VOL_CAPABILITIES_FORMAT 0 -#define VOL_CAPABILITIES_INTERFACES 1 -#define VOL_CAPABILITIES_RESERVED1 2 -#define VOL_CAPABILITIES_RESERVED2 3 - -typedef struct vol_capabilities_attr { - vol_capabilities_set_t capabilities; - vol_capabilities_set_t valid; -} vol_capabilities_attr_t; - -/* - * XXX this value needs to be raised - 3893388 - */ -#define ATTR_MAX_BUFFER 8192 - -/* - * VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs - * that are persistent (retain their values even when the volume is - * unmounted and remounted), and a file or directory can be looked up - * by ID. Volumes that support VolFS and can support Carbon File ID - * references should set this bit. - * - * VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic - * links. The symlink(), readlink(), and lstat() calls all use this - * symbolic link. - * - * VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links. - * The link() call creates hard links. - * - * VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting - * a journal used to speed recovery in case of unplanned shutdown - * (such as a power outage or crash). This bit does not necessarily - * mean the volume is actively using a journal for recovery. - * - * VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using - * a journal for use in speeding recovery after an unplanned shutdown. - * This bit can be set only if VOL_CAP_FMT_JOURNAL is also set. - * - * VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not - * store reliable times for the root directory, so you should not - * depend on them to detect changes, etc. - * - * VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files. - * That is, files which can have "holes" that have never been written - * to, and are not allocated on disk. Sparse files may have an - * allocated size that is less than the file's logical length. - * - * VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs) - * that have never been written to must appear to contain zeroes. When - * this bit is set, the volume keeps track of allocated but unwritten - * runs of a file so that it can substitute zeroes without actually - * writing zeroes to the media. This provides performance similar to - * sparse files, but not the space savings. - * - * VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are - * case sensitive (upper and lower case are different). When clear, - * an upper case character is equivalent to a lower case character, - * and you can't have two names that differ solely in the case of - * the characters. - * - * VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names - * preserve the difference between upper and lower case. If clear, - * the volume may change the case of some characters (typically - * making them all upper or all lower case). A volume that sets - * VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING. - * - * VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers - * (especially Carbon) that statfs() is fast enough that its results - * need not be cached by those upper layers. A volume that caches - * the statfs information in its in-memory structures should set this bit. - * A volume that must always read from disk or always perform a network - * transaction should not set this bit. - * - * VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports - * file sizes larger than 4GB, and potentially up to 2TB; it does not - * indicate whether the filesystem supports files larger than that. - * - * VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny - * modes (e.g. "open for read write, deny write"; effectively, mandatory - * file locking based on open modes). - * - * VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN - * file flag, and the UF_HIDDEN flag is mapped to that volume's native - * "hidden" or "invisible" bit (which may be the invisible bit from the - * Finder Info extended attribute). - * - * VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability - * to derive a pathname to the root of the file system given only the - * id of an object. This also implies that object ids on this file - * system are persistent and not recycled. This is a very specialized - * capability and it is assumed that most file systems will not support - * it. Its use is for legacy non-posix APIs like ResolveFileIDRef. - * - * VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support - * returning values for total data blocks, available blocks, or free blocks - * (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically, - * those values were set to 0xFFFFFFFF for volumes that did not support them. - * - * VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent - * decompression of compressed files using decmpfs. - * - * VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that - * are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the - * only legitimate attributes for obtaining object IDs from this volume and the - * 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID, - * ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined. - * - * VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory - * hard links. - * - * VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs - * (an ID which persists across object ID changes) for document revisions. - * - * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write - * generation counts (a count of how many times an object has been modified) - * - * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support - * setting the UF_IMMUTABLE flag. - * - * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting - * permissions. - * - * VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with - * other filesystems i.e. multiple logical filesystems can exist in the same - * "partition". An implication of this is that the filesystem which sets - * this capability treats waitfor arguments to VFS_SYNC as bit flags. - * - * VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group - * that implies multiple volumes must be mounted in order to boot and root the - * operating system. Typically, this means a read-only system volume and a - * writable data volume. - */ -#define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001 -#define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002 -#define VOL_CAP_FMT_HARDLINKS 0x00000004 -#define VOL_CAP_FMT_JOURNAL 0x00000008 -#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010 -#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020 -#define VOL_CAP_FMT_SPARSE_FILES 0x00000040 -#define VOL_CAP_FMT_ZERO_RUNS 0x00000080 -#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100 -#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200 -#define VOL_CAP_FMT_FAST_STATFS 0x00000400 -#define VOL_CAP_FMT_2TB_FILESIZE 0x00000800 -#define VOL_CAP_FMT_OPENDENYMODES 0x00001000 -#define VOL_CAP_FMT_HIDDEN_FILES 0x00002000 -#define VOL_CAP_FMT_PATH_FROM_ID 0x00004000 -#define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000 -#define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000 -#define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000 -#define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000 -#define VOL_CAP_FMT_DOCUMENT_ID 0x00080000 -#define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000 -#define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000 -#define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000 -#define VOL_CAP_FMT_SHARED_SPACE 0x00800000 -#define VOL_CAP_FMT_VOL_GROUPS 0x01000000 - -/* - * VOL_CAP_INT_SEARCHFS: When set, the volume implements the - * searchfs() system call (the vnop_searchfs vnode operation). - * - * VOL_CAP_INT_ATTRLIST: When set, the volume implements the - * getattrlist() and setattrlist() system calls (vnop_getattrlist - * and vnop_setattrlist vnode operations) for the volume, files, - * and directories. The volume may or may not implement the - * readdirattr() system call. XXX Is there any minimum set - * of attributes that should be supported? To determine the - * set of supported attributes, get the ATTR_VOL_ATTRIBUTES - * attribute of the volume. - * - * VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting - * of NFS volumes. - * - * VOL_CAP_INT_READDIRATTR: When set, the volume implements the - * readdirattr() system call (vnop_readdirattr vnode operation). - * - * VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the - * exchangedata() system call (VNOP_EXCHANGE vnode operation). - * - * VOL_CAP_INT_COPYFILE: When set, the volume implements the - * VOP_COPYFILE vnode operation. (XXX There should be a copyfile() - * system call in .) - * - * VOL_CAP_INT_ALLOCATE: When set, the volume implements the - * VNOP_ALLOCATE vnode operation, which means it implements the - * F_PREALLOCATE selector of fcntl(2). - * - * VOL_CAP_INT_VOL_RENAME: When set, the volume implements the - * ATTR_VOL_NAME attribute for both getattrlist() and setattrlist(). - * The volume can be renamed by setting ATTR_VOL_NAME with setattrlist(). - * - * VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style - * byte range locks via vnop_advlock (accessible from fcntl(2)). - * - * VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2) - * style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK - * flags of the open(2) call. - * - * VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements - * extended security (ACLs). - * - * VOL_CAP_INT_USERACCESS: When set, the volume supports the - * ATTR_CMN_USERACCESS attribute (used to get the user's access - * mode to the file). - * - * VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style - * mandatory byte range locks via an ioctl(). - * - * VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements - * native extended attribues. - * - * VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports - * native named streams. - * - * VOL_CAP_INT_CLONE: When set, the volume supports clones. - * - * VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots. - * - * VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping - * file system objects. - * - * VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an - * exclusive rename operation. - * - * VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename - * operations on files that are open. - */ -#define VOL_CAP_INT_SEARCHFS 0x00000001 -#define VOL_CAP_INT_ATTRLIST 0x00000002 -#define VOL_CAP_INT_NFSEXPORT 0x00000004 -#define VOL_CAP_INT_READDIRATTR 0x00000008 -#define VOL_CAP_INT_EXCHANGEDATA 0x00000010 -#define VOL_CAP_INT_COPYFILE 0x00000020 -#define VOL_CAP_INT_ALLOCATE 0x00000040 -#define VOL_CAP_INT_VOL_RENAME 0x00000080 -#define VOL_CAP_INT_ADVLOCK 0x00000100 -#define VOL_CAP_INT_FLOCK 0x00000200 -#define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400 -#define VOL_CAP_INT_USERACCESS 0x00000800 -#define VOL_CAP_INT_MANLOCK 0x00001000 -#define VOL_CAP_INT_NAMEDSTREAMS 0x00002000 -#define VOL_CAP_INT_EXTENDED_ATTR 0x00004000 -#define VOL_CAP_INT_CLONE 0x00010000 -#define VOL_CAP_INT_SNAPSHOT 0x00020000 -#define VOL_CAP_INT_RENAME_SWAP 0x00040000 -#define VOL_CAP_INT_RENAME_EXCL 0x00080000 -#define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 - -typedef struct vol_attributes_attr { - attribute_set_t validattr; - attribute_set_t nativeattr; -} vol_attributes_attr_t; - -#define ATTR_CMN_NAME 0x00000001 -#define ATTR_CMN_DEVID 0x00000002 -#define ATTR_CMN_FSID 0x00000004 -#define ATTR_CMN_OBJTYPE 0x00000008 -#define ATTR_CMN_OBJTAG 0x00000010 -#define ATTR_CMN_OBJID 0x00000020 -#define ATTR_CMN_OBJPERMANENTID 0x00000040 -#define ATTR_CMN_PAROBJID 0x00000080 -#define ATTR_CMN_SCRIPT 0x00000100 -#define ATTR_CMN_CRTIME 0x00000200 -#define ATTR_CMN_MODTIME 0x00000400 -#define ATTR_CMN_CHGTIME 0x00000800 -#define ATTR_CMN_ACCTIME 0x00001000 -#define ATTR_CMN_BKUPTIME 0x00002000 -#define ATTR_CMN_FNDRINFO 0x00004000 -#define ATTR_CMN_OWNERID 0x00008000 -#define ATTR_CMN_GRPID 0x00010000 -#define ATTR_CMN_ACCESSMASK 0x00020000 -#define ATTR_CMN_FLAGS 0x00040000 - -/* The following were defined as: */ -/* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */ -/* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */ -/* These bits have been salvaged for use as: */ -/* #define ATTR_CMN_GEN_COUNT 0x00080000 */ -/* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */ -/* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */ -/* option flag. */ - -#define ATTR_CMN_GEN_COUNT 0x00080000 -#define ATTR_CMN_DOCUMENT_ID 0x00100000 - -#define ATTR_CMN_USERACCESS 0x00200000 -#define ATTR_CMN_EXTENDED_SECURITY 0x00400000 -#define ATTR_CMN_UUID 0x00800000 -#define ATTR_CMN_GRPUUID 0x01000000 -#define ATTR_CMN_FILEID 0x02000000 -#define ATTR_CMN_PARENTID 0x04000000 -#define ATTR_CMN_FULLPATH 0x08000000 -#define ATTR_CMN_ADDEDTIME 0x10000000 -#define ATTR_CMN_ERROR 0x20000000 -#define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000 - -/* - * ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and - * getattrlistbulk(2). It is always the first attribute in the return buffer. - */ -#define ATTR_CMN_RETURNED_ATTRS 0x80000000 - -#define ATTR_CMN_VALIDMASK 0xFFFFFFFF -/* - * The settable ATTR_CMN_* attributes include the following: - * ATTR_CMN_SCRIPT - * ATTR_CMN_CRTIME - * ATTR_CMN_MODTIME - * ATTR_CMN_CHGTIME - * - * ATTR_CMN_ACCTIME - * ATTR_CMN_BKUPTIME - * ATTR_CMN_FNDRINFO - * ATTR_CMN_OWNERID - * - * ATTR_CMN_GRPID - * ATTR_CMN_ACCESSMASK - * ATTR_CMN_FLAGS - * - * ATTR_CMN_EXTENDED_SECURITY - * ATTR_CMN_UUID - * - * ATTR_CMN_GRPUUID - * - * ATTR_CMN_DATA_PROTECT_FLAGS - */ -#define ATTR_CMN_SETMASK 0x51C7FF00 -#define ATTR_CMN_VOLSETMASK 0x00006700 - -#define ATTR_VOL_FSTYPE 0x00000001 -#define ATTR_VOL_SIGNATURE 0x00000002 -#define ATTR_VOL_SIZE 0x00000004 -#define ATTR_VOL_SPACEFREE 0x00000008 -#define ATTR_VOL_SPACEAVAIL 0x00000010 -#define ATTR_VOL_MINALLOCATION 0x00000020 -#define ATTR_VOL_ALLOCATIONCLUMP 0x00000040 -#define ATTR_VOL_IOBLOCKSIZE 0x00000080 -#define ATTR_VOL_OBJCOUNT 0x00000100 -#define ATTR_VOL_FILECOUNT 0x00000200 -#define ATTR_VOL_DIRCOUNT 0x00000400 -#define ATTR_VOL_MAXOBJCOUNT 0x00000800 -#define ATTR_VOL_MOUNTPOINT 0x00001000 -#define ATTR_VOL_NAME 0x00002000 -#define ATTR_VOL_MOUNTFLAGS 0x00004000 -#define ATTR_VOL_MOUNTEDDEVICE 0x00008000 -#define ATTR_VOL_ENCODINGSUSED 0x00010000 -#define ATTR_VOL_CAPABILITIES 0x00020000 -#define ATTR_VOL_UUID 0x00040000 -#define ATTR_VOL_QUOTA_SIZE 0x10000000 -#define ATTR_VOL_RESERVED_SIZE 0x20000000 -#define ATTR_VOL_ATTRIBUTES 0x40000000 -#define ATTR_VOL_INFO 0x80000000 - -#define ATTR_VOL_VALIDMASK 0xF007FFFF - -/* - * The list of settable ATTR_VOL_* attributes include the following: - * ATTR_VOL_NAME - * ATTR_VOL_INFO - */ -#define ATTR_VOL_SETMASK 0x80002000 - - -/* File/directory attributes: */ -#define ATTR_DIR_LINKCOUNT 0x00000001 -#define ATTR_DIR_ENTRYCOUNT 0x00000002 -#define ATTR_DIR_MOUNTSTATUS 0x00000004 -#define ATTR_DIR_ALLOCSIZE 0x00000008 -#define ATTR_DIR_IOBLOCKSIZE 0x00000010 -#define ATTR_DIR_DATALENGTH 0x00000020 - -/* ATTR_DIR_MOUNTSTATUS Flags: */ -#define DIR_MNTSTATUS_MNTPOINT 0x00000001 -#define DIR_MNTSTATUS_TRIGGER 0x00000002 - -#define ATTR_DIR_VALIDMASK 0x0000003f -#define ATTR_DIR_SETMASK 0x00000000 - -#define ATTR_FILE_LINKCOUNT 0x00000001 -#define ATTR_FILE_TOTALSIZE 0x00000002 -#define ATTR_FILE_ALLOCSIZE 0x00000004 -#define ATTR_FILE_IOBLOCKSIZE 0x00000008 -#define ATTR_FILE_DEVTYPE 0x00000020 -#define ATTR_FILE_FORKCOUNT 0x00000080 -#define ATTR_FILE_FORKLIST 0x00000100 -#define ATTR_FILE_DATALENGTH 0x00000200 -#define ATTR_FILE_DATAALLOCSIZE 0x00000400 -#define ATTR_FILE_RSRCLENGTH 0x00001000 -#define ATTR_FILE_RSRCALLOCSIZE 0x00002000 - -#define ATTR_FILE_VALIDMASK 0x000037FF -/* - * Settable ATTR_FILE_* attributes include: - * ATTR_FILE_DEVTYPE - */ -#define ATTR_FILE_SETMASK 0x00000020 - -/* CMNEXT attributes extend the common attributes, but in the forkattr field */ -#define ATTR_CMNEXT_RELPATH 0x00000004 -#define ATTR_CMNEXT_PRIVATESIZE 0x00000008 -#define ATTR_CMNEXT_LINKID 0x00000010 -#define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020 -#define ATTR_CMNEXT_REALDEVID 0x00000040 -#define ATTR_CMNEXT_REALFSID 0x00000080 -#define ATTR_CMNEXT_CLONEID 0x00000100 -#define ATTR_CMNEXT_EXT_FLAGS 0x00000200 - -#define ATTR_CMNEXT_VALIDMASK 0x000003fc -#define ATTR_CMNEXT_SETMASK 0x00000000 - -/* Deprecated fork attributes */ -#define ATTR_FORK_TOTALSIZE 0x00000001 -#define ATTR_FORK_ALLOCSIZE 0x00000002 -#define ATTR_FORK_RESERVED 0xffffffff - -#define ATTR_FORK_VALIDMASK 0x00000003 -#define ATTR_FORK_SETMASK 0x00000000 - -/* Obsolete, implemented, not supported */ -#define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 -#define ATTR_CMN_NAMEDATTRLIST 0x00100000 -#define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */ -#define ATTR_FILE_FILETYPE 0x00000040 /* always zero */ -#define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */ -#define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */ - -/* Required attributes for getattrlistbulk(2) */ -#define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS) - -/* - * Searchfs - */ -#define SRCHFS_START 0x00000001 -#define SRCHFS_MATCHPARTIALNAMES 0x00000002 -#define SRCHFS_MATCHDIRS 0x00000004 -#define SRCHFS_MATCHFILES 0x00000008 -#define SRCHFS_SKIPLINKS 0x00000010 -#define SRCHFS_SKIPINVISIBLE 0x00000020 -#define SRCHFS_SKIPPACKAGES 0x00000040 -#define SRCHFS_SKIPINAPPROPRIATE 0x00000080 - -#define SRCHFS_NEGATEPARAMS 0x80000000 -#define SRCHFS_VALIDOPTIONSMASK 0x800000FF - -struct fssearchblock { - struct attrlist *returnattrs; - void *returnbuffer; - size_t returnbuffersize; - u_long maxmatches; - struct timeval timelimit; - void *searchparams1; - size_t sizeofsearchparams1; - void *searchparams2; - size_t sizeofsearchparams2; - struct attrlist searchattrs; -}; - - -struct searchstate { - uint32_t ss_union_flags; // for SRCHFS_START - uint32_t ss_union_layer; // 0 = top - u_char ss_fsstate[548]; // fs private -} __attribute__((packed)); - -#define FST_EOF (-1) /* end-of-file offset */ - -#endif /* __APPLE_API_UNSTABLE */ -#endif /* !_SYS_ATTR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/ioccom.h b/lib/libc/include/x86_64-macos.10-none/sys/ioccom.h deleted file mode 100644 index 39c6964568..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/ioccom.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_IOCCOM_H_ -#define _SYS_IOCCOM_H_ - -#include - -/* - * Ioctl's have the command encoded in the lower word, and the size of - * any in or out parameters in the upper word. The high 3 bits of the - * upper word are used to encode the in/out status of the parameter. - */ -#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ -#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) -#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) -#define IOCGROUP(x) (((x) >> 8) & 0xff) - -#define IOCPARM_MAX (IOCPARM_MASK + 1) /* max size of ioctl args */ -/* no parameters */ -#define IOC_VOID (__uint32_t)0x20000000 -/* copy parameters out */ -#define IOC_OUT (__uint32_t)0x40000000 -/* copy parameters in */ -#define IOC_IN (__uint32_t)0x80000000 -/* copy paramters in and out */ -#define IOC_INOUT (IOC_IN|IOC_OUT) -/* mask for IN/OUT/VOID */ -#define IOC_DIRMASK (__uint32_t)0xe0000000 - -#define _IOC(inout, group, num, len) \ - (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) -#define _IO(g, n) _IOC(IOC_VOID, (g), (n), 0) -#define _IOR(g, n, t) _IOC(IOC_OUT, (g), (n), sizeof(t)) -#define _IOW(g, n, t) _IOC(IOC_IN, (g), (n), sizeof(t)) -/* this should be _IORW, but stdio got there first */ -#define _IOWR(g, n, t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) - -#endif /* !_SYS_IOCCOM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/kauth.h b/lib/libc/include/x86_64-macos.10-none/sys/kauth.h deleted file mode 100644 index 99784e35c8..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/kauth.h +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (c) 2004-2010 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce - * support for mandatory and extensible security protections. This notice - * is included in support of clause 2.2 (b) of the Apple Public License, - * Version 2.0. - */ - -#ifndef _SYS_KAUTH_H -#define _SYS_KAUTH_H - -#include -#include -#include -#include /* __offsetof() */ -#include /* NGROUPS_MAX */ - -#ifdef __APPLE_API_EVOLVING - -/* - * Identities. - */ - -#define KAUTH_UID_NONE (~(uid_t)0 - 100) /* not a valid UID */ -#define KAUTH_GID_NONE (~(gid_t)0 - 100) /* not a valid GID */ - -#include - -/* NT Security Identifier, structure as defined by Microsoft */ -#pragma pack(1) /* push packing of 1 byte */ -typedef struct { - u_int8_t sid_kind; - u_int8_t sid_authcount; - u_int8_t sid_authority[6]; -#define KAUTH_NTSID_MAX_AUTHORITIES 16 - u_int32_t sid_authorities[KAUTH_NTSID_MAX_AUTHORITIES]; -} ntsid_t; -#pragma pack() /* pop packing to previous packing level */ -#define _NTSID_T - -/* valid byte count inside a SID structure */ -#define KAUTH_NTSID_HDRSIZE (8) -#define KAUTH_NTSID_SIZE(_s) (KAUTH_NTSID_HDRSIZE + ((_s)->sid_authcount * sizeof(u_int32_t))) - -/* - * External lookup message payload; this structure is shared between the - * kernel group membership resolver, and the user space group membership - * resolver daemon, and is use to communicate resolution requests from the - * kernel to user space, and the result of that request from user space to - * the kernel. - */ -struct kauth_identity_extlookup { - u_int32_t el_seqno; /* request sequence number */ - u_int32_t el_result; /* lookup result */ -#define KAUTH_EXTLOOKUP_SUCCESS 0 /* results here are good */ -#define KAUTH_EXTLOOKUP_BADRQ 1 /* request badly formatted */ -#define KAUTH_EXTLOOKUP_FAILURE 2 /* transient failure during lookup */ -#define KAUTH_EXTLOOKUP_FATAL 3 /* permanent failure during lookup */ -#define KAUTH_EXTLOOKUP_INPROG 100 /* request in progress */ - u_int32_t el_flags; -#define KAUTH_EXTLOOKUP_VALID_UID (1<<0) -#define KAUTH_EXTLOOKUP_VALID_UGUID (1<<1) -#define KAUTH_EXTLOOKUP_VALID_USID (1<<2) -#define KAUTH_EXTLOOKUP_VALID_GID (1<<3) -#define KAUTH_EXTLOOKUP_VALID_GGUID (1<<4) -#define KAUTH_EXTLOOKUP_VALID_GSID (1<<5) -#define KAUTH_EXTLOOKUP_WANT_UID (1<<6) -#define KAUTH_EXTLOOKUP_WANT_UGUID (1<<7) -#define KAUTH_EXTLOOKUP_WANT_USID (1<<8) -#define KAUTH_EXTLOOKUP_WANT_GID (1<<9) -#define KAUTH_EXTLOOKUP_WANT_GGUID (1<<10) -#define KAUTH_EXTLOOKUP_WANT_GSID (1<<11) -#define KAUTH_EXTLOOKUP_WANT_MEMBERSHIP (1<<12) -#define KAUTH_EXTLOOKUP_VALID_MEMBERSHIP (1<<13) -#define KAUTH_EXTLOOKUP_ISMEMBER (1<<14) -#define KAUTH_EXTLOOKUP_VALID_PWNAM (1<<15) -#define KAUTH_EXTLOOKUP_WANT_PWNAM (1<<16) -#define KAUTH_EXTLOOKUP_VALID_GRNAM (1<<17) -#define KAUTH_EXTLOOKUP_WANT_GRNAM (1<<18) -#define KAUTH_EXTLOOKUP_VALID_SUPGRPS (1<<19) -#define KAUTH_EXTLOOKUP_WANT_SUPGRPS (1<<20) - - __darwin_pid_t el_info_pid; /* request on behalf of PID */ - u_int64_t el_extend; /* extension field */ - u_int32_t el_info_reserved_1; /* reserved (APPLE) */ - - uid_t el_uid; /* user ID */ - guid_t el_uguid; /* user GUID */ - u_int32_t el_uguid_valid; /* TTL on translation result (seconds) */ - ntsid_t el_usid; /* user NT SID */ - u_int32_t el_usid_valid; /* TTL on translation result (seconds) */ - gid_t el_gid; /* group ID */ - guid_t el_gguid; /* group GUID */ - u_int32_t el_gguid_valid; /* TTL on translation result (seconds) */ - ntsid_t el_gsid; /* group SID */ - u_int32_t el_gsid_valid; /* TTL on translation result (seconds) */ - u_int32_t el_member_valid; /* TTL on group lookup result */ - u_int32_t el_sup_grp_cnt; /* count of supplemental groups up to NGROUPS */ - gid_t el_sup_groups[NGROUPS_MAX]; /* supplemental group list */ -}; - -struct kauth_cache_sizes { - u_int32_t kcs_group_size; - u_int32_t kcs_id_size; -}; - -#define KAUTH_EXTLOOKUP_REGISTER (0) -#define KAUTH_EXTLOOKUP_RESULT (1<<0) -#define KAUTH_EXTLOOKUP_WORKER (1<<1) -#define KAUTH_EXTLOOKUP_DEREGISTER (1<<2) -#define KAUTH_GET_CACHE_SIZES (1<<3) -#define KAUTH_SET_CACHE_SIZES (1<<4) -#define KAUTH_CLEAR_CACHES (1<<5) - -#define IDENTITYSVC_ENTITLEMENT "com.apple.private.identitysvc" - - - -/* - * Generic Access Control Lists. - */ -#if defined(KERNEL) || defined (_SYS_ACL_H) - -typedef u_int32_t kauth_ace_rights_t; - -/* Access Control List Entry (ACE) */ -struct kauth_ace { - guid_t ace_applicable; - u_int32_t ace_flags; -#define KAUTH_ACE_KINDMASK 0xf -#define KAUTH_ACE_PERMIT 1 -#define KAUTH_ACE_DENY 2 -#define KAUTH_ACE_AUDIT 3 /* not implemented */ -#define KAUTH_ACE_ALARM 4 /* not implemented */ -#define KAUTH_ACE_INHERITED (1<<4) -#define KAUTH_ACE_FILE_INHERIT (1<<5) -#define KAUTH_ACE_DIRECTORY_INHERIT (1<<6) -#define KAUTH_ACE_LIMIT_INHERIT (1<<7) -#define KAUTH_ACE_ONLY_INHERIT (1<<8) -#define KAUTH_ACE_SUCCESS (1<<9) /* not implemented (AUDIT/ALARM) */ -#define KAUTH_ACE_FAILURE (1<<10) /* not implemented (AUDIT/ALARM) */ -/* All flag bits controlling ACE inheritance */ -#define KAUTH_ACE_INHERIT_CONTROL_FLAGS \ - (KAUTH_ACE_FILE_INHERIT | \ - KAUTH_ACE_DIRECTORY_INHERIT | \ - KAUTH_ACE_LIMIT_INHERIT | \ - KAUTH_ACE_ONLY_INHERIT) - kauth_ace_rights_t ace_rights; /* scope specific */ - /* These rights are never tested, but may be present in an ACL */ -#define KAUTH_ACE_GENERIC_ALL (1<<21) -#define KAUTH_ACE_GENERIC_EXECUTE (1<<22) -#define KAUTH_ACE_GENERIC_WRITE (1<<23) -#define KAUTH_ACE_GENERIC_READ (1<<24) -}; - -#ifndef _KAUTH_ACE -#define _KAUTH_ACE -typedef struct kauth_ace *kauth_ace_t; -#endif - - -/* Access Control List */ -struct kauth_acl { - u_int32_t acl_entrycount; - u_int32_t acl_flags; - - struct kauth_ace acl_ace[1]; -}; - -/* - * XXX this value needs to be raised - 3893388 - */ -#define KAUTH_ACL_MAX_ENTRIES 128 - -/* - * The low 16 bits of the flags field are reserved for filesystem - * internal use and must be preserved by all APIs. This includes - * round-tripping flags through user-space interfaces. - */ -#define KAUTH_ACL_FLAGS_PRIVATE (0xffff) - -/* - * The high 16 bits of the flags are used to store attributes and - * to request specific handling of the ACL. - */ - -/* inheritance will be deferred until the first rename operation */ -#define KAUTH_ACL_DEFER_INHERIT (1<<16) -/* this ACL must not be overwritten as part of an inheritance operation */ -#define KAUTH_ACL_NO_INHERIT (1<<17) - -/* acl_entrycount that tells us the ACL is not valid */ -#define KAUTH_FILESEC_NOACL ((u_int32_t)(-1)) - -/* - * If the acl_entrycount field is KAUTH_FILESEC_NOACL, then the size is the - * same as a kauth_acl structure; the intent is to put an actual entrycount of - * KAUTH_FILESEC_NOACL on disk to distinguish a kauth_filesec_t with an empty - * entry (Windows treats this as "deny all") from one that merely indicates a - * file group and/or owner guid values. - */ -#define KAUTH_ACL_SIZE(c) (__offsetof(struct kauth_acl, acl_ace) + ((u_int32_t)(c) != KAUTH_FILESEC_NOACL ? ((c) * sizeof(struct kauth_ace)) : 0)) -#define KAUTH_ACL_COPYSIZE(p) KAUTH_ACL_SIZE((p)->acl_entrycount) - - -#ifndef _KAUTH_ACL -#define _KAUTH_ACL -typedef struct kauth_acl *kauth_acl_t; -#endif - - - -/* - * Extended File Security. - */ - -/* File Security information */ -struct kauth_filesec { - u_int32_t fsec_magic; -#define KAUTH_FILESEC_MAGIC 0x012cc16d - guid_t fsec_owner; - guid_t fsec_group; - - struct kauth_acl fsec_acl; -}; - -/* backwards compatibility */ -#define fsec_entrycount fsec_acl.acl_entrycount -#define fsec_flags fsec_acl.acl_flags -#define fsec_ace fsec_acl.acl_ace -#define KAUTH_FILESEC_FLAGS_PRIVATE KAUTH_ACL_FLAGS_PRIVATE -#define KAUTH_FILESEC_DEFER_INHERIT KAUTH_ACL_DEFER_INHERIT -#define KAUTH_FILESEC_NO_INHERIT KAUTH_ACL_NO_INHERIT -#define KAUTH_FILESEC_NONE ((kauth_filesec_t)0) -#define KAUTH_FILESEC_WANTED ((kauth_filesec_t)1) - -#ifndef _KAUTH_FILESEC -#define _KAUTH_FILESEC -typedef struct kauth_filesec *kauth_filesec_t; -#endif - -#define KAUTH_FILESEC_SIZE(c) (__offsetof(struct kauth_filesec, fsec_acl) + __offsetof(struct kauth_acl, acl_ace) + (c) * sizeof(struct kauth_ace)) -#define KAUTH_FILESEC_COPYSIZE(p) KAUTH_FILESEC_SIZE(((p)->fsec_entrycount == KAUTH_FILESEC_NOACL) ? 0 : (p)->fsec_entrycount) -#define KAUTH_FILESEC_COUNT(s) (((s) - KAUTH_FILESEC_SIZE(0)) / sizeof(struct kauth_ace)) -#define KAUTH_FILESEC_VALID(s) ((s) >= KAUTH_FILESEC_SIZE(0) && (((s) - KAUTH_FILESEC_SIZE(0)) % sizeof(struct kauth_ace)) == 0) - -#define KAUTH_FILESEC_XATTR "com.apple.system.Security" - -/* Allowable first arguments to kauth_filesec_acl_setendian() */ -#define KAUTH_ENDIAN_HOST 0x00000001 /* set host endianness */ -#define KAUTH_ENDIAN_DISK 0x00000002 /* set disk endianness */ - -#endif /* KERNEL || */ - - - -/* Actions, also rights bits in an ACE */ - -#if defined(KERNEL) || defined (_SYS_ACL_H) -#define KAUTH_VNODE_READ_DATA (1U<<1) -#define KAUTH_VNODE_LIST_DIRECTORY KAUTH_VNODE_READ_DATA -#define KAUTH_VNODE_WRITE_DATA (1U<<2) -#define KAUTH_VNODE_ADD_FILE KAUTH_VNODE_WRITE_DATA -#define KAUTH_VNODE_EXECUTE (1U<<3) -#define KAUTH_VNODE_SEARCH KAUTH_VNODE_EXECUTE -#define KAUTH_VNODE_DELETE (1U<<4) -#define KAUTH_VNODE_APPEND_DATA (1U<<5) -#define KAUTH_VNODE_ADD_SUBDIRECTORY KAUTH_VNODE_APPEND_DATA -#define KAUTH_VNODE_DELETE_CHILD (1U<<6) -#define KAUTH_VNODE_READ_ATTRIBUTES (1U<<7) -#define KAUTH_VNODE_WRITE_ATTRIBUTES (1U<<8) -#define KAUTH_VNODE_READ_EXTATTRIBUTES (1U<<9) -#define KAUTH_VNODE_WRITE_EXTATTRIBUTES (1U<<10) -#define KAUTH_VNODE_READ_SECURITY (1U<<11) -#define KAUTH_VNODE_WRITE_SECURITY (1U<<12) -#define KAUTH_VNODE_TAKE_OWNERSHIP (1U<<13) - -/* backwards compatibility only */ -#define KAUTH_VNODE_CHANGE_OWNER KAUTH_VNODE_TAKE_OWNERSHIP - -/* For Windows interoperability only */ -#define KAUTH_VNODE_SYNCHRONIZE (1U<<20) - -/* (1<<21) - (1<<24) are reserved for generic rights bits */ - -/* Actions not expressed as rights bits */ -/* - * Authorizes the vnode as the target of a hard link. - */ -#define KAUTH_VNODE_LINKTARGET (1U<<25) - -/* - * Indicates that other steps have been taken to authorise the action, - * but authorisation should be denied for immutable objects. - */ -#define KAUTH_VNODE_CHECKIMMUTABLE (1U<<26) - -/* Action modifiers */ -/* - * The KAUTH_VNODE_ACCESS bit is passed to the callback if the authorisation - * request in progress is advisory, rather than authoritative. Listeners - * performing consequential work (i.e. not strictly checking authorisation) - * may test this flag to avoid performing unnecessary work. - * - * This bit will never be present in an ACE. - */ -#define KAUTH_VNODE_ACCESS (1U<<31) - -/* - * The KAUTH_VNODE_NOIMMUTABLE bit is passed to the callback along with the - * KAUTH_VNODE_WRITE_SECURITY bit (and no others) to indicate that the - * caller wishes to change one or more of the immutable flags, and the - * state of these flags should not be considered when authorizing the request. - * The system immutable flags are only ignored when the system securelevel - * is low enough to allow their removal. - */ -#define KAUTH_VNODE_NOIMMUTABLE (1U<<30) - - -/* - * fake right that is composed by the following... - * vnode must have search for owner, group and world allowed - * plus there must be no deny modes present for SEARCH... this fake - * right is used by the fast lookup path to avoid checking - * for an exact match on the last credential to lookup - * the component being acted on - */ -#define KAUTH_VNODE_SEARCHBYANYONE (1U<<29) - - -/* - * when passed as an 'action' to "vnode_uncache_authorized_actions" - * it indicates that all of the cached authorizations for that - * vnode should be invalidated - */ -#define KAUTH_INVALIDATE_CACHED_RIGHTS ((kauth_action_t)~0) - - - -/* The expansions of the GENERIC bits at evaluation time */ -#define KAUTH_VNODE_GENERIC_READ_BITS (KAUTH_VNODE_READ_DATA | \ - KAUTH_VNODE_READ_ATTRIBUTES | \ - KAUTH_VNODE_READ_EXTATTRIBUTES | \ - KAUTH_VNODE_READ_SECURITY) - -#define KAUTH_VNODE_GENERIC_WRITE_BITS (KAUTH_VNODE_WRITE_DATA | \ - KAUTH_VNODE_APPEND_DATA | \ - KAUTH_VNODE_DELETE | \ - KAUTH_VNODE_DELETE_CHILD | \ - KAUTH_VNODE_WRITE_ATTRIBUTES | \ - KAUTH_VNODE_WRITE_EXTATTRIBUTES | \ - KAUTH_VNODE_WRITE_SECURITY) - -#define KAUTH_VNODE_GENERIC_EXECUTE_BITS (KAUTH_VNODE_EXECUTE) - -#define KAUTH_VNODE_GENERIC_ALL_BITS (KAUTH_VNODE_GENERIC_READ_BITS | \ - KAUTH_VNODE_GENERIC_WRITE_BITS | \ - KAUTH_VNODE_GENERIC_EXECUTE_BITS) - -/* - * Some sets of bits, defined here for convenience. - */ -#define KAUTH_VNODE_WRITE_RIGHTS (KAUTH_VNODE_ADD_FILE | \ - KAUTH_VNODE_ADD_SUBDIRECTORY | \ - KAUTH_VNODE_DELETE_CHILD | \ - KAUTH_VNODE_WRITE_DATA | \ - KAUTH_VNODE_APPEND_DATA | \ - KAUTH_VNODE_DELETE | \ - KAUTH_VNODE_WRITE_ATTRIBUTES | \ - KAUTH_VNODE_WRITE_EXTATTRIBUTES | \ - KAUTH_VNODE_WRITE_SECURITY | \ - KAUTH_VNODE_TAKE_OWNERSHIP | \ - KAUTH_VNODE_LINKTARGET | \ - KAUTH_VNODE_CHECKIMMUTABLE) - - -#endif /* KERNEL || */ - - -#endif /* __APPLE_API_EVOLVING */ -#endif /* _SYS_KAUTH_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/mman.h b/lib/libc/include/x86_64-macos.10-none/sys/mman.h deleted file mode 100644 index fec1caac71..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/mman.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ -/*- - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mman.h 8.1 (Berkeley) 6/2/93 - */ - -/* - * Currently unsupported: - * - * [TYM] POSIX_TYPED_MEM_ALLOCATE - * [TYM] POSIX_TYPED_MEM_ALLOCATE_CONTIG - * [TYM] POSIX_TYPED_MEM_MAP_ALLOCATABLE - * [TYM] struct posix_typed_mem_info - * [TYM] posix_mem_offset() - * [TYM] posix_typed_mem_get_info() - * [TYM] posix_typed_mem_open() - */ - -#ifndef _SYS_MMAN_H_ -#define _SYS_MMAN_H_ - -#include -#include - -#include - -/* - * [various] The mode_t, off_t, and size_t types shall be defined as - * described in - */ -#include -#include -#include - -/* - * Protections are chosen from these bits, or-ed together - */ -#define PROT_NONE 0x00 /* [MC2] no permissions */ -#define PROT_READ 0x01 /* [MC2] pages can be read */ -#define PROT_WRITE 0x02 /* [MC2] pages can be written */ -#define PROT_EXEC 0x04 /* [MC2] pages can be executed */ - -/* - * Flags contain sharing type and options. - * Sharing types; choose one. - */ -#define MAP_SHARED 0x0001 /* [MF|SHM] share changes */ -#define MAP_PRIVATE 0x0002 /* [MF|SHM] changes are private */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define MAP_COPY MAP_PRIVATE /* Obsolete */ -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - -/* - * Other flags - */ -#define MAP_FIXED 0x0010 /* [MF|SHM] interpret addr exactly */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ -#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ -#define MAP_RESERVED0080 0x0080 /* previously unimplemented MAP_INHERIT */ -#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ -#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ -#define MAP_NOCACHE 0x0400 /* don't cache pages for this mapping */ -#define MAP_JIT 0x0800 /* Allocate a region that will be used for JIT purposes */ - -/* - * Mapping type - */ -#define MAP_FILE 0x0000 /* map from file (default) */ -#define MAP_ANON 0x1000 /* allocated from memory, swap space */ -#define MAP_ANONYMOUS MAP_ANON - -/* - * The MAP_RESILIENT_* flags can be used when the caller wants to map some - * possibly unreliable memory and be able to access it safely, possibly - * getting the wrong contents rather than raising any exception. - * For safety reasons, such mappings have to be read-only (PROT_READ access - * only). - * - * MAP_RESILIENT_CODESIGN: - * accessing this mapping will not generate code-signing violations, - * even if the contents are tainted. - * MAP_RESILIENT_MEDIA: - * accessing this mapping will not generate an exception if the contents - * are not available (unreachable removable or remote media, access beyond - * end-of-file, ...). Missing contents will be replaced with zeroes. - */ -#define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */ -#define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */ - -#if !defined(CONFIG_EMBEDDED) -#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only: Requires entitlement */ -#endif /* !defined(CONFIG_EMBEDDED) */ - -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - -/* - * Process memory locking - */ -#define MCL_CURRENT 0x0001 /* [ML] Lock only current memory */ -#define MCL_FUTURE 0x0002 /* [ML] Lock all future memory as well */ - -/* - * Error return from mmap() - */ -#define MAP_FAILED ((void *)-1) /* [MF|SHM] mmap failed */ - -/* - * msync() flags - */ -#define MS_ASYNC 0x0001 /* [MF|SIO] return immediately */ -#define MS_INVALIDATE 0x0002 /* [MF|SIO] invalidate all cached data */ -#define MS_SYNC 0x0010 /* [MF|SIO] msync synchronously */ - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define MS_KILLPAGES 0x0004 /* invalidate pages, leave mapped */ -#define MS_DEACTIVATE 0x0008 /* deactivate pages, leave mapped */ - -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - - -/* - * Advice to madvise - */ -#define POSIX_MADV_NORMAL 0 /* [MC1] no further special treatment */ -#define POSIX_MADV_RANDOM 1 /* [MC1] expect random page refs */ -#define POSIX_MADV_SEQUENTIAL 2 /* [MC1] expect sequential page refs */ -#define POSIX_MADV_WILLNEED 3 /* [MC1] will need these pages */ -#define POSIX_MADV_DONTNEED 4 /* [MC1] dont need these pages */ - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define MADV_NORMAL POSIX_MADV_NORMAL -#define MADV_RANDOM POSIX_MADV_RANDOM -#define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL -#define MADV_WILLNEED POSIX_MADV_WILLNEED -#define MADV_DONTNEED POSIX_MADV_DONTNEED -#define MADV_FREE 5 /* pages unneeded, discard contents */ -#define MADV_ZERO_WIRED_PAGES 6 /* zero the wired pages that have not been unwired before the entry is deleted */ -#define MADV_FREE_REUSABLE 7 /* pages can be reused (by anyone) */ -#define MADV_FREE_REUSE 8 /* caller wants to reuse those pages */ -#define MADV_CAN_REUSE 9 -#define MADV_PAGEOUT 10 /* page out now (internal only) */ - -/* - * Return bits from mincore - */ -#define MINCORE_INCORE 0x1 /* Page is incore */ -#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */ -#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */ -#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ -#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ -#define MINCORE_PAGED_OUT 0x20 /* Page has been paged out */ -#define MINCORE_COPIED 0x40 /* Page has been copied */ -#define MINCORE_ANONYMOUS 0x80 /* Page belongs to an anonymous object */ -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - - - -__BEGIN_DECLS -/* [ML] */ -int mlockall(int); -int munlockall(void); -/* [MR] */ -int mlock(const void *, size_t); -#ifndef _MMAP -#define _MMAP -/* [MC3]*/ -void * mmap(void *, size_t, int, int, int, off_t) __DARWIN_ALIAS(mmap); -#endif -/* [MPR] */ -int mprotect(void *, size_t, int) __DARWIN_ALIAS(mprotect); -/* [MF|SIO] */ -int msync(void *, size_t, int) __DARWIN_ALIAS_C(msync); -/* [MR] */ -int munlock(const void *, size_t); -/* [MC3]*/ -int munmap(void *, size_t) __DARWIN_ALIAS(munmap); -/* [SHM] */ -int shm_open(const char *, int, ...); -int shm_unlink(const char *); -/* [ADV] */ -int posix_madvise(void *, size_t, int); - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -int madvise(void *, size_t, int); -int mincore(const void *, size_t, char *); -int minherit(void *, size_t, int); -#endif - - -__END_DECLS - -#endif /* !_SYS_MMAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/param.h b/lib/libc/include/x86_64-macos.10-none/sys/param.h deleted file mode 100644 index 88330ebbe7..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/param.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ -/*- - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)param.h 8.3 (Berkeley) 4/4/95 - */ - -#ifndef _SYS_PARAM_H_ -#define _SYS_PARAM_H_ - -#define BSD 199506 /* System version (year & month). */ -#define BSD4_3 1 -#define BSD4_4 1 - -#define NeXTBSD 1995064 /* NeXTBSD version (year, month, release) */ -#define NeXTBSD4_0 0 /* NeXTBSD 4.0 */ - -#include -#include - -#ifndef LOCORE -#include -#endif - -/* - * Machine-independent constants (some used in following include files). - * Redefined constants are from POSIX 1003.1 limits file. - * - * MAXCOMLEN should be >= sizeof(ac_comm) (see ) - * MAXLOGNAME should be >= UT_NAMESIZE (see ) - */ -#include - -#define MAXCOMLEN 16 /* max command name remembered */ -#define MAXINTERP 64 /* max interpreter file name length */ -#define MAXLOGNAME 255 /* max login name length */ -#define MAXUPRC CHILD_MAX /* max simultaneous processes */ -#define NCARGS ARG_MAX /* max bytes for an exec function */ -#define NGROUPS NGROUPS_MAX /* max number groups */ -#define NOFILE 256 /* default max open files per process */ -#define NOGROUP 65535 /* marker for empty group set member */ -#define MAXHOSTNAMELEN 256 /* max hostname size */ -#define MAXDOMNAMELEN 256 /* maximum domain name length */ - -/* Machine type dependent parameters. */ -#include - -/* More types and definitions used throughout the kernel. */ -#include - -/* Signals. */ -#include - -/* - * Priorities. Note that with 32 run queues, differences less than 4 are - * insignificant. - */ -#define PSWP 0 -#define PVM 4 -#define PINOD 8 -#define PRIBIO 16 -#define PVFS 20 -#define PZERO 22 /* No longer magic, shouldn't be here. XXX */ -#define PSOCK 24 -#define PWAIT 32 -#define PLOCK 36 -#define PPAUSE 40 -#define PUSER 50 -#define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */ - -#define PRIMASK 0x0ff -#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ -#define PTTYBLOCK 0x200 /* for tty SIGTTOU and SIGTTIN blocking */ -#define PDROP 0x400 /* OR'd with pri to stop re-aquistion of mutex upon wakeup */ -#define PSPIN 0x800 /* OR'd with pri to require mutex in spin mode upon wakeup */ - -#define NBPW sizeof(int) /* number of bytes per word (integer) */ - -#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ -#define NODEV (dev_t)(-1) /* non-existent device */ - -/* - * Clustering of hardware pages on machines with ridiculously small - * page sizes is done here. The paging subsystem deals with units of - * CLSIZE pte's describing NBPG (from machine/param.h) pages each. - */ -#define CLBYTES (CLSIZE*NBPG) -#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ -#define claligned(x) ((((int)(x))&CLOFSET)==0) -#define CLOFF CLOFSET -#define CLSHIFT (PGSHIFT+CLSIZELOG2) - -#if CLSIZE == 1 -#define clbase(i) (i) -#define clrnd(i) (i) -#else -/* Give the base virtual address (first of CLSIZE). */ -#define clbase(i) ((i) &~ (CLSIZE-1)) -/* Round a number of clicks up to a whole cluster. */ -#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) -#endif - -#define CBLOCK 64 /* Clist block size, must be a power of 2. */ -#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ - /* Data chars/clist. */ -#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) -#define CROUND (CBLOCK - 1) /* Clist rounding. */ - -/* - * File system parameters and macros. - * - * The file system is made out of blocks of at most MAXPHYS units, with - * smaller units (fragments) only in the last direct block. MAXBSIZE - * primarily determines the size of buffers in the buffer pool. It may be - * made larger than MAXPHYS without any effect on existing file systems; - * however making it smaller may make some file systems unmountable. - * We set this to track the value of MAX_UPL_TRANSFER_BYTES from - * osfmk/mach/memory_object_types.h to bound it at the maximum UPL size. - */ -#define MAXBSIZE (256 * 4096) -#define MAXPHYSIO MAXPHYS -#define MAXFRAG 8 - -#define MAXPHYSIO_WIRED (16 * 1024 * 1024) - -/* - * MAXPATHLEN defines the longest permissable path length after expanding - * symbolic links. It is used to allocate a temporary buffer from the buffer - * pool in which to do the name expansion, hence should be a power of two, - * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the - * maximum number of symbolic links that may be expanded in a path name. - * It should be set high enough to allow all legitimate uses, but halt - * infinite loops reasonably quickly. - */ -#define MAXPATHLEN PATH_MAX -#define MAXSYMLINKS 32 - -/* Bit map related macros. */ -#define setbit(a, i) (((char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a, i) (((char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a, i) (((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a, i) ((((char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) - -/* Macros for counting and rounding. */ -#ifndef howmany -#define howmany(x, y) ((((x) % (y)) == 0) ? ((x) / (y)) : (((x) / (y)) + 1)) -#endif -#define roundup(x, y) ((((x) % (y)) == 0) ? \ - (x) : ((x) + ((y) - ((x) % (y))))) -#define powerof2(x) ((((x)-1)&(x))==0) - -/* Macros for min/max. */ -#ifndef MIN -#define MIN(a, b) (((a)<(b))?(a):(b)) -#endif /* MIN */ -#ifndef MAX -#define MAX(a, b) (((a)>(b))?(a):(b)) -#endif /* MAX */ - -/* - * Constants for setting the parameters of the kernel memory allocator. - * - * 2 ** MINBUCKET is the smallest unit of memory that will be - * allocated. It must be at least large enough to hold a pointer. - * - * Units of memory less or equal to MAXALLOCSAVE will permanently - * allocate physical memory; requests for these size pieces of - * memory are quite fast. Allocations greater than MAXALLOCSAVE must - * always allocate and free physical memory; requests for these - * size allocations should be done infrequently as they will be slow. - * - * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and - * MAXALLOCSIZE must be a power of two. - */ -#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ -#define MAXALLOCSAVE (2 * CLBYTES) - -/* - * Scale factor for scaled integers used to count %cpu time and load avgs. - * - * The number of CPU `tick's that map to a unique `%age' can be expressed - * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that - * can be calculated (assuming 32 bits) can be closely approximated using - * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). - * - * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', - * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. - */ -#define FSHIFT 11 /* bits to right of fixed binary point */ -#define FSCALE (1< -#include -#include /* For struct selinfo. */ -#include -#include -#include -#include -#include -#include - - - -struct session; -struct pgrp; -struct proc; - -/* Exported fields for kern sysctls */ -struct extern_proc { - union { - struct { - struct proc *__p_forw; /* Doubly-linked run/sleep queue. */ - struct proc *__p_back; - } p_st1; - struct timeval __p_starttime; /* process start time */ - } p_un; -#define p_forw p_un.p_st1.__p_forw -#define p_back p_un.p_st1.__p_back -#define p_starttime p_un.__p_starttime - struct vmspace *p_vmspace; /* Address space. */ - struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */ - int p_flag; /* P_* flags. */ - char p_stat; /* S* process status. */ - pid_t p_pid; /* Process identifier. */ - pid_t p_oppid; /* Save parent pid during ptrace. XXX */ - int p_dupfd; /* Sideways return value from fdopen. XXX */ - /* Mach related */ - caddr_t user_stack; /* where user stack was allocated */ - void *exit_thread; /* XXX Which thread is exiting? */ - int p_debugger; /* allow to debug */ - boolean_t sigwait; /* indication to suspend */ - /* scheduling */ - u_int p_estcpu; /* Time averaged value of p_cpticks. */ - int p_cpticks; /* Ticks of cpu time. */ - fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ - void *p_wchan; /* Sleep address. */ - char *p_wmesg; /* Reason for sleep. */ - u_int p_swtime; /* Time swapped in or out. */ - u_int p_slptime; /* Time since last blocked. */ - struct itimerval p_realtimer; /* Alarm timer. */ - struct timeval p_rtime; /* Real time. */ - u_quad_t p_uticks; /* Statclock hits in user mode. */ - u_quad_t p_sticks; /* Statclock hits in system mode. */ - u_quad_t p_iticks; /* Statclock hits processing intr. */ - int p_traceflag; /* Kernel trace points. */ - struct vnode *p_tracep; /* Trace to vnode. */ - int p_siglist; /* DEPRECATED. */ - struct vnode *p_textvp; /* Vnode of executable. */ - int p_holdcnt; /* If non-zero, don't swap. */ - sigset_t p_sigmask; /* DEPRECATED. */ - sigset_t p_sigignore; /* Signals being ignored. */ - sigset_t p_sigcatch; /* Signals being caught by user. */ - u_char p_priority; /* Process priority. */ - u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ - char p_nice; /* Process "nice" value. */ - char p_comm[MAXCOMLEN + 1]; - struct pgrp *p_pgrp; /* Pointer to process group. */ - struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */ - u_short p_xstat; /* Exit status for wait; also stop signal. */ - u_short p_acflag; /* Accounting flags. */ - struct rusage *p_ru; /* Exit information. XXX */ -}; - - -/* Status values. */ -#define SIDL 1 /* Process being created by fork. */ -#define SRUN 2 /* Currently runnable. */ -#define SSLEEP 3 /* Sleeping on an address. */ -#define SSTOP 4 /* Process debugging or suspension. */ -#define SZOMB 5 /* Awaiting collection by parent. */ - -/* These flags are kept in extern_proc.p_flag. */ -#define P_ADVLOCK 0x00000001 /* Process may hold POSIX adv. lock */ -#define P_CONTROLT 0x00000002 /* Has a controlling terminal */ -#define P_LP64 0x00000004 /* Process is LP64 */ -#define P_NOCLDSTOP 0x00000008 /* No SIGCHLD when children stop */ - -#define P_PPWAIT 0x00000010 /* Parent waiting for chld exec/exit */ -#define P_PROFIL 0x00000020 /* Has started profiling */ -#define P_SELECT 0x00000040 /* Selecting; wakeup/waiting danger */ -#define P_CONTINUED 0x00000080 /* Process was stopped and continued */ - -#define P_SUGID 0x00000100 /* Has set privileges since last exec */ -#define P_SYSTEM 0x00000200 /* Sys proc: no sigs, stats or swap */ -#define P_TIMEOUT 0x00000400 /* Timing out during sleep */ -#define P_TRACED 0x00000800 /* Debugged process being traced */ - -#define P_DISABLE_ASLR 0x00001000 /* Disable address space layout randomization */ -#define P_WEXIT 0x00002000 /* Working on exiting */ -#define P_EXEC 0x00004000 /* Process called exec. */ - -/* Should be moved to machine-dependent areas. */ -#define P_OWEUPC 0x00008000 /* Owe process an addupc() call at next ast. */ - -#define P_AFFINITY 0x00010000 /* xxx */ -#define P_TRANSLATED 0x00020000 /* xxx */ -#define P_CLASSIC P_TRANSLATED /* xxx */ - -#define P_DELAYIDLESLEEP 0x00040000 /* Process is marked to delay idle sleep on disk IO */ -#define P_CHECKOPENEVT 0x00080000 /* check if a vnode has the OPENEVT flag set on open */ - -#define P_DEPENDENCY_CAPABLE 0x00100000 /* process is ok to call vfs_markdependency() */ -#define P_REBOOT 0x00200000 /* Process called reboot() */ -#define P_RESV6 0x00400000 /* used to be P_TBE */ -#define P_RESV7 0x00800000 /* (P_SIGEXC)signal exceptions */ - -#define P_THCWD 0x01000000 /* process has thread cwd */ -#define P_RESV9 0x02000000 /* (P_VFORK)process has vfork children */ -#define P_ADOPTPERSONA 0x04000000 /* process adopted a persona (used to be P_NOATTACH) */ -#define P_RESV11 0x08000000 /* (P_INVFORK) proc in vfork */ - -#define P_NOSHLIB 0x10000000 /* no shared libs are in use for proc */ - /* flag set on exec */ -#define P_FORCEQUOTA 0x20000000 /* Force quota for root */ -#define P_NOCLDWAIT 0x40000000 /* No zombies when chil procs exit */ -#define P_NOREMOTEHANG 0x80000000 /* Don't hang on remote FS ops */ - -#define P_INMEM 0 /* Obsolete: retained for compilation */ -#define P_NOSWAP 0 /* Obsolete: retained for compilation */ -#define P_PHYSIO 0 /* Obsolete: retained for compilation */ -#define P_FSTRACE 0 /* Obsolete: retained for compilation */ -#define P_SSTEP 0 /* Obsolete: retained for compilation */ - -#define P_DIRTY_TRACK 0x00000001 /* track dirty state */ -#define P_DIRTY_ALLOW_IDLE_EXIT 0x00000002 /* process can be idle-exited when clean */ -#define P_DIRTY_DEFER 0x00000004 /* defer initial opt-in to idle-exit */ -#define P_DIRTY 0x00000008 /* process is dirty */ -#define P_DIRTY_SHUTDOWN 0x00000010 /* process is dirty during shutdown */ -#define P_DIRTY_TERMINATED 0x00000020 /* process has been marked for termination */ -#define P_DIRTY_BUSY 0x00000040 /* serialization flag */ -#define P_DIRTY_MARKED 0x00000080 /* marked dirty previously */ -#define P_DIRTY_AGING_IN_PROGRESS 0x00000100 /* aging in one of the 'aging bands' */ -#define P_DIRTY_LAUNCH_IN_PROGRESS 0x00000200 /* launch is in progress */ -#define P_DIRTY_DEFER_ALWAYS 0x00000400 /* defer going to idle-exit after every dirty->clean transition. - * For legacy jetsam policy only. This is the default with the other policies.*/ - -#define P_DIRTY_IS_DIRTY (P_DIRTY | P_DIRTY_SHUTDOWN) -#define P_DIRTY_IDLE_EXIT_ENABLED (P_DIRTY_TRACK|P_DIRTY_ALLOW_IDLE_EXIT) - - - - -#endif /* !_SYS_PROC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/shm.h b/lib/libc/include/x86_64-macos.10-none/sys/shm.h deleted file mode 100644 index 0e5070a03b..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/shm.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */ - -/* - * Copyright (c) 1994 Adam Glass - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Glass. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * As defined+described in "X/Open System Interfaces and Headers" - * Issue 4, p. XXX - */ - -#ifndef _SYS_SHM_H_ -#define _SYS_SHM_H_ - -#include -#include - -/* - * [XSI] All of the symbols from SHALL be defined - * when this header is included - */ -#include - -/* - * [XSI] The pid_t, time_t, key_t, and size_t types shall be defined as - * described in . - * - * NOTE: The definition of the key_t type is implicit from the - * inclusion of - */ -#include -#include -#include - -/* - * [XSI] The unsigned integer type used for the number of current attaches - * that MUST be able to store values at least as large as a type unsigned - * short. - */ -typedef unsigned short shmatt_t; - - -/* - * Possible flag values which may be OR'ed into the third argument to - * shmat() - */ -#define SHM_RDONLY 010000 /* [XSI] Attach read-only (else read-write) */ -#define SHM_RND 020000 /* [XSI] Round attach address to SHMLBA */ - -/* - * This value is symbolic, and generally not expected to be sed by user - * programs directly, although such ise is permitted by the standard. Its - * value in our implementation is equal to the number of bytes per page. - * - * NOTE: We DO NOT obtain this value from the appropriate system - * headers at this time, to avoid the resulting namespace - * pollution, which is why we discourages its use. - */ -#define SHMLBA 4096 /* [XSI] Segment low boundary address multiple*/ - -/* "official" access mode definitions; somewhat braindead since you have - * to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */ -#define SHM_R (IPC_R) -#define SHM_W (IPC_W) - -#pragma pack(4) - -/* - * Technically, we should force all code references to the new structure - * definition, not in just the standards conformance case, and leave the - * legacy interface there for binary compatibility only. Currently, we - * are only forcing this for programs requesting standards conformance. - */ -#if __DARWIN_UNIX03 || defined(KERNEL) -/* - * Structure used internally. - * - * This structure is exposed because standards dictate that it is used as - * the third argment to shmctl(). - * - * NOTE: The field shm_internal is not meaningful in user space, - * and must not be used there. - */ -#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)) -struct shmid_ds -#else -#define shmid_ds __shmid_ds_new -struct __shmid_ds_new -#endif -{ - struct __ipc_perm_new shm_perm; /* [XSI] Operation permission value */ - size_t shm_segsz; /* [XSI] Size of segment in bytes */ - pid_t shm_lpid; /* [XSI] PID of last shared memory op */ - pid_t shm_cpid; /* [XSI] PID of creator */ - shmatt_t shm_nattch; /* [XSI] Number of current attaches */ - time_t shm_atime; /* [XSI] Time of last shmat() */ - time_t shm_dtime; /* [XSI] Time of last shmdt() */ - time_t shm_ctime; /* [XSI] Time of last shmctl() change */ - void *shm_internal; /* reserved for kernel use */ -}; -#else /* !__DARWIN_UNIX03 */ -#define shmid_ds __shmid_ds_old -#endif /* !__DARWIN_UNIX03 */ - -#if !__DARWIN_UNIX03 -struct __shmid_ds_old { - struct __ipc_perm_old shm_perm; /* [XSI] Operation permission value */ - size_t shm_segsz; /* [XSI] Size of segment in bytes */ - pid_t shm_lpid; /* [XSI] PID of last shared memory op */ - pid_t shm_cpid; /* [XSI] PID of creator */ - shmatt_t shm_nattch; /* [XSI] Number of current attaches */ - time_t shm_atime; /* [XSI] Time of last shmat() */ - time_t shm_dtime; /* [XSI] Time of last shmdt() */ - time_t shm_ctime; /* [XSI] Time of last shmctl() change */ - void *shm_internal; /* reserved for kernel use */ -}; -#endif /* !__DARWIN_UNIX03 */ - -#pragma pack() - - -__BEGIN_DECLS -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -int shmsys(int, ...); -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ -void *shmat(int, const void *, int); -int shmctl(int, int, struct shmid_ds *) __DARWIN_ALIAS(shmctl); -int shmdt(const void *); -int shmget(key_t, size_t, int); -__END_DECLS - - -#endif /* !_SYS_SHM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/sockio.h b/lib/libc/include/x86_64-macos.10-none/sys/sockio.h deleted file mode 100644 index c18d55b522..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/sockio.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2000-2019 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sockio.h 8.1 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_SOCKIO_H_ -#define _SYS_SOCKIO_H_ - -#include - -#include - -/* Socket ioctl's. */ -#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ -#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ -#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ -#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ -#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ -#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ -#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ - -/* - * OSIOCGIF* ioctls are deprecated; they are kept for binary compatibility. - */ -#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ -#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ -#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ -#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ -#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ -#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ -#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ -#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ -#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ -#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ - -#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ -#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ -#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ -#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ -#define SIOCAUTOADDR _IOWR('i', 38, struct ifreq) /* autoconf address */ -#define SIOCAUTONETMASK _IOW('i', 39, struct ifreq) /* autoconf netmask */ -#define SIOCARPIPLL _IOWR('i', 40, struct ifreq) /* arp for IPv4LL address */ - -#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ -#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ -#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ -#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ -#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ -#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ -#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ - -/* - * The command SIOCGIFMEDIA does not allow a process to access the extended - * media subtype and extended subtype values are returned as IFM_OTHER. - */ -#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get compatible net media */ - -#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */ -#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */ -#define SIOCRSLVMULTI _IOWR('i', 59, struct rslvmulti_req) - -#define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set link level addr */ -#define SIOCGIFSTATUS _IOWR('i', 61, struct ifstat) /* get IF status */ -#define SIOCSIFPHYADDR _IOW('i', 62, struct ifaliasreq) /* set gif addres */ -#define SIOCGIFPSRCADDR _IOWR('i', 63, struct ifreq) /* get gif psrc addr */ -#define SIOCGIFPDSTADDR _IOWR('i', 64, struct ifreq) /* get gif pdst addr */ -#define SIOCDIFPHYADDR _IOW('i', 65, struct ifreq) /* delete gif addrs */ - -#define SIOCGIFDEVMTU _IOWR('i', 68, struct ifreq) /* get if ifdevmtu */ -#define SIOCSIFALTMTU _IOW('i', 69, struct ifreq) /* set if alternate mtu */ -#define SIOCGIFALTMTU _IOWR('i', 72, struct ifreq) /* get if alternate mtu */ -#define SIOCSIFBOND _IOW('i', 70, struct ifreq) /* set bond if config */ -#define SIOCGIFBOND _IOWR('i', 71, struct ifreq) /* get bond if config */ - -/* - * The command SIOCGIFXMEDIA is meant to be used by processes only to be able - * to access the extended media subtypes with the extended IFM_TMASK. - * - * An ifnet must not implement SIOCGIFXMEDIA as it gets the extended - * media subtypes by simply compiling with - */ -#define SIOCGIFXMEDIA _IOWR('i', 72, struct ifmediareq) /* get net extended media */ - - -#define SIOCSIFCAP _IOW('i', 90, struct ifreq) /* set IF features */ -#define SIOCGIFCAP _IOWR('i', 91, struct ifreq) /* get IF features */ - -#define SIOCIFCREATE _IOWR('i', 120, struct ifreq) /* create clone if */ -#define SIOCIFDESTROY _IOW('i', 121, struct ifreq) /* destroy clone if */ -#define SIOCIFCREATE2 _IOWR('i', 122, struct ifreq) /* create clone if with data */ - -#define SIOCSDRVSPEC _IOW('i', 123, struct ifdrv) /* set driver-specific - * parameters */ -#define SIOCGDRVSPEC _IOWR('i', 123, struct ifdrv) /* get driver-specific - * parameters */ -#define SIOCSIFVLAN _IOW('i', 126, struct ifreq) /* set VLAN config */ -#define SIOCGIFVLAN _IOWR('i', 127, struct ifreq) /* get VLAN config */ -#define SIOCSETVLAN SIOCSIFVLAN -#define SIOCGETVLAN SIOCGIFVLAN - -#define SIOCIFGCLONERS _IOWR('i', 129, struct if_clonereq) /* get cloners */ - -#define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq) /* get ppp asyncmap */ -#define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */ - - - -#define SIOCGIFMAC _IOWR('i', 130, struct ifreq) /* get IF MAC label */ -#define SIOCSIFMAC _IOW('i', 131, struct ifreq) /* set IF MAC label */ -#define SIOCSIFKPI _IOW('i', 134, struct ifreq) /* set interface kext param - root only */ -#define SIOCGIFKPI _IOWR('i', 135, struct ifreq) /* get interface kext param */ - -#define SIOCGIFWAKEFLAGS _IOWR('i', 136, struct ifreq) /* get interface wake property flags */ - -#define SIOCGIFFUNCTIONALTYPE _IOWR('i', 173, struct ifreq) /* get interface functional type */ - -#define SIOCSIF6LOWPAN _IOW('i', 196, struct ifreq) /* set 6LOWPAN config */ -#define SIOCGIF6LOWPAN _IOWR('i', 197, struct ifreq) /* get 6LOWPAN config */ - - -#endif /* !_SYS_SOCKIO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/syslimits.h b/lib/libc/include/x86_64-macos.10-none/sys/syslimits.h deleted file mode 100644 index ff60b66ff5..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/syslimits.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* $NetBSD: syslimits.h,v 1.15 1997/06/25 00:48:09 lukem Exp $ */ - -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_SYSLIMITS_H_ -#define _SYS_SYSLIMITS_H_ - -#include - -#if !defined(_ANSI_SOURCE) -/* - * Note: CHILD_MAX *must* be less than hard_maxproc, which is set at - * compile time; you *cannot* set it higher than the hard limit!! - */ -#define ARG_MAX (256 * 1024) /* max bytes for an exec function */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define CHILD_MAX 266 /* max simultaneous processes */ -#define GID_MAX 2147483647U /* max value for a gid_t (2^31-2) */ -#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ -#define LINK_MAX 32767 /* max file link count */ -#define MAX_CANON 1024 /* max bytes in term canon input line */ -#define MAX_INPUT 1024 /* max bytes in terminal input */ -#define NAME_MAX 255 /* max bytes in a file name */ -#define NGROUPS_MAX 16 /* max supplemental group id's */ -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -#define UID_MAX 2147483647U /* max value for a uid_t (2^31-2) */ - -#define OPEN_MAX 10240 /* max open files per process - todo, make a config option? */ - -#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ -#define PATH_MAX 1024 /* max bytes in pathname */ -#define PIPE_BUF 512 /* max bytes for atomic pipe writes */ - -#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ -#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ -#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ -#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ -#define CHARCLASS_NAME_MAX 14 /* max character class name size */ -#define COLL_WEIGHTS_MAX 2 /* max weights for order keyword */ -#define EQUIV_CLASS_MAX 2 -#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ -#define LINE_MAX 2048 /* max bytes in an input line */ -#define RE_DUP_MAX 255 /* max RE's in interval notation */ - -#if __DARWIN_UNIX03 -#define NZERO 20 /* default priority [XSI] */ - /* = ((PRIO_MAX - PRIO_MIN) / 2) + 1 */ - /* range: 0 - 39 [(2 * NZERO) - 1] */ - /* 0 is not actually used */ -#else /* !__DARWIN_UNIX03 */ -#define NZERO 0 /* default priority */ - /* range: -20 - 20 */ - /* (PRIO_MIN - PRIO_MAX) */ -#endif /* __DARWIN_UNIX03 */ -#endif /* !_ANSI_SOURCE */ - -#endif /* !_SYS_SYSLIMITS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/ttycom.h b/lib/libc/include/x86_64-macos.10-none/sys/ttycom.h deleted file mode 100644 index e3830c8627..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/ttycom.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_TTYCOM_H_ -#define _SYS_TTYCOM_H_ - -#include -/* - * Tty ioctl's except for those supported only for backwards compatibility - * with the old tty driver. - */ - -/* - * Window/terminal size structure. This information is stored by the kernel - * in order to provide a consistent interface, but is not used by the kernel. - */ -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ -}; - -#define TIOCMODG _IOR('t', 3, int) /* get modem control state */ -#define TIOCMODS _IOW('t', 4, int) /* set modem control state */ -#define TIOCM_LE 0001 /* line enable */ -#define TIOCM_DTR 0002 /* data terminal ready */ -#define TIOCM_RTS 0004 /* request to send */ -#define TIOCM_ST 0010 /* secondary transmit */ -#define TIOCM_SR 0020 /* secondary receive */ -#define TIOCM_CTS 0040 /* clear to send */ -#define TIOCM_CAR 0100 /* carrier detect */ -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RNG 0200 /* ring */ -#define TIOCM_RI TIOCM_RNG -#define TIOCM_DSR 0400 /* data set ready */ - /* 8-10 compat */ -#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ -#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ - /* 15 unused */ -#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ - /* 17-18 compat */ -#define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ -#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ -#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ -#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ -#define TIOCGETD _IOR('t', 26, int) /* get line discipline */ -#define TIOCSETD _IOW('t', 27, int) /* set line discipline */ -#define TIOCIXON _IO('t', 129) /* internal input VSTART */ -#define TIOCIXOFF _IO('t', 128) /* internal input VSTOP */ - /* 127-124 compat */ -#define TIOCSBRK _IO('t', 123) /* set break bit */ -#define TIOCCBRK _IO('t', 122) /* clear break bit */ -#define TIOCSDTR _IO('t', 121) /* set data terminal ready */ -#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ -#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ -#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ - /* 117-116 compat */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ -#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ -#define TIOCNOTTY _IO('t', 113) /* void tty association */ -#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ -#define TIOCPKT_DATA 0x00 /* data packet */ -#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ -#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ -#define TIOCPKT_STOP 0x04 /* stop output */ -#define TIOCPKT_START 0x08 /* start output */ -#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ -#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ -#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ -#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ -#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ -#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ -#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ -#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ -#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ -#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ -#define TIOCSTAT _IO('t', 101) /* simulate ^T status message */ -#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ -#define TIOCSCONS _IO('t', 99) /* 4.2 compatibility */ -#define TIOCCONS _IOW('t', 98, int) /* become virtual console */ -#define TIOCSCTTY _IO('t', 97) /* become controlling tty */ -#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ -#define TIOCSIG _IO('t', 95) /* pty: generate signal */ -#define TIOCDRAIN _IO('t', 94) /* wait till output drained */ -#define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */ -#define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */ -#define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* enable/get timestamp - * of last input event */ -#define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* enable/get timestamp - * of last DCd rise */ -#define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */ -#define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */ -#define TIOCDSIMICROCODE _IO('t', 85) /* download microcode to - * DSI Softmodem */ -#define TIOCPTYGRANT _IO('t', 84) /* grantpt(3) */ -#define TIOCPTYGNAME _IOC(IOC_OUT, 't', 83, 128) /* ptsname(3) */ -#define TIOCPTYUNLK _IO('t', 82) /* unlockpt(3) */ - -#define TTYDISC 0 /* termios tty line discipline */ -#define TABLDISC 3 /* tablet discipline */ -#define SLIPDISC 4 /* serial IP discipline */ -#define PPPDISC 5 /* PPP discipline */ - -#endif /* !_SYS_TTYCOM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/ucontext.h b/lib/libc/include/x86_64-macos.10-none/sys/ucontext.h deleted file mode 100644 index e4468f2e40..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/ucontext.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ - -#ifndef _SYS_UCONTEXT_H_ -#define _SYS_UCONTEXT_H_ - -#include -#include - -#include -#include -#include - -#include - - -#endif /* _SYS_UCONTEXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/sys/un.h b/lib/libc/include/x86_64-macos.10-none/sys/un.h deleted file mode 100644 index a27ead5406..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/sys/un.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)un.h 8.3 (Berkeley) 2/19/95 - */ - -#ifndef _SYS_UN_H_ -#define _SYS_UN_H_ - -#include -#include -#include - -/* [XSI] The sa_family_t type shall be defined as described in */ -#include - -/* - * [XSI] Definitions for UNIX IPC domain. - */ -struct sockaddr_un { - unsigned char sun_len; /* sockaddr len including null */ - sa_family_t sun_family; /* [XSI] AF_UNIX */ - char sun_path[104]; /* [XSI] path name (gag) */ -}; - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) - -/* Level number of get/setsockopt for local domain sockets */ -#define SOL_LOCAL 0 - -/* Socket options. */ -#define LOCAL_PEERCRED 0x001 /* retrieve peer credentials */ -#define LOCAL_PEERPID 0x002 /* retrieve peer pid */ -#define LOCAL_PEEREPID 0x003 /* retrieve eff. peer pid */ -#define LOCAL_PEERUUID 0x004 /* retrieve peer UUID */ -#define LOCAL_PEEREUUID 0x005 /* retrieve eff. peer UUID */ - -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - - - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -/* actual length of an initialized sockaddr_un */ -#define SUN_LEN(su) \ - (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - - -#endif /* !_SYS_UN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/time.h b/lib/libc/include/x86_64-macos.10-none/time.h deleted file mode 100644 index b2edfb95cd..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/time.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)time.h 8.3 (Berkeley) 1/21/94 - */ - -#ifndef _TIME_H_ -#define _TIME_H_ - -#include <_types.h> -#include -#include -#include -#include -#include -#include -#include - -struct tm { - int tm_sec; /* seconds after the minute [0-60] */ - int tm_min; /* minutes after the hour [0-59] */ - int tm_hour; /* hours since midnight [0-23] */ - int tm_mday; /* day of the month [1-31] */ - int tm_mon; /* months since January [0-11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday [0-6] */ - int tm_yday; /* days since January 1 [0-365] */ - int tm_isdst; /* Daylight Savings Time flag */ - long tm_gmtoff; /* offset from UTC in seconds */ - char *tm_zone; /* timezone abbreviation */ -}; - -#if __DARWIN_UNIX03 -#define CLOCKS_PER_SEC 1000000 /* [XSI] */ -#else /* !__DARWIN_UNIX03 */ -#include /* Include file containing CLK_TCK. */ - -#define CLOCKS_PER_SEC (__DARWIN_CLK_TCK) -#endif /* __DARWIN_UNIX03 */ - -#ifndef _ANSI_SOURCE -extern char *tzname[]; -#endif - -extern int getdate_err; -#if __DARWIN_UNIX03 -extern long timezone __DARWIN_ALIAS(timezone); -#endif /* __DARWIN_UNIX03 */ -extern int daylight; - -__BEGIN_DECLS -char *asctime(const struct tm *); -clock_t clock(void) __DARWIN_ALIAS(clock); -char *ctime(const time_t *); -double difftime(time_t, time_t); -struct tm *getdate(const char *); -struct tm *gmtime(const time_t *); -struct tm *localtime(const time_t *); -time_t mktime(struct tm *) __DARWIN_ALIAS(mktime); -size_t strftime(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict) __DARWIN_ALIAS(strftime); -char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict) __DARWIN_ALIAS(strptime); -time_t time(time_t *); - -#ifndef _ANSI_SOURCE -void tzset(void); -#endif /* not ANSI */ - -/* [TSF] Thread safe functions */ -char *asctime_r(const struct tm * __restrict, char * __restrict); -char *ctime_r(const time_t *, char *); -struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict); -struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict); - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -time_t posix2time(time_t); -#if !__DARWIN_UNIX03 -char *timezone(int, int); -#endif /* !__DARWIN_UNIX03 */ -void tzsetwall(void); -time_t time2posix(time_t); -time_t timelocal(struct tm * const); -time_t timegm(struct tm * const); -#endif /* neither ANSI nor POSIX */ - -#if !defined(_ANSI_SOURCE) -int nanosleep(const struct timespec *__rqtp, struct timespec *__rmtp) __DARWIN_ALIAS_C(nanosleep); -#endif - -#if !defined(_DARWIN_FEATURE_CLOCK_GETTIME) || _DARWIN_FEATURE_CLOCK_GETTIME != 0 -#if __DARWIN_C_LEVEL >= 199309L -#if __has_feature(enumerator_attributes) -#define __CLOCK_AVAILABILITY __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) -#else -#define __CLOCK_AVAILABILITY -#endif - -typedef enum { -_CLOCK_REALTIME __CLOCK_AVAILABILITY = 0, -#define CLOCK_REALTIME _CLOCK_REALTIME -_CLOCK_MONOTONIC __CLOCK_AVAILABILITY = 6, -#define CLOCK_MONOTONIC _CLOCK_MONOTONIC -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -_CLOCK_MONOTONIC_RAW __CLOCK_AVAILABILITY = 4, -#define CLOCK_MONOTONIC_RAW _CLOCK_MONOTONIC_RAW -_CLOCK_MONOTONIC_RAW_APPROX __CLOCK_AVAILABILITY = 5, -#define CLOCK_MONOTONIC_RAW_APPROX _CLOCK_MONOTONIC_RAW_APPROX -_CLOCK_UPTIME_RAW __CLOCK_AVAILABILITY = 8, -#define CLOCK_UPTIME_RAW _CLOCK_UPTIME_RAW -_CLOCK_UPTIME_RAW_APPROX __CLOCK_AVAILABILITY = 9, -#define CLOCK_UPTIME_RAW_APPROX _CLOCK_UPTIME_RAW_APPROX -#endif -_CLOCK_PROCESS_CPUTIME_ID __CLOCK_AVAILABILITY = 12, -#define CLOCK_PROCESS_CPUTIME_ID _CLOCK_PROCESS_CPUTIME_ID -_CLOCK_THREAD_CPUTIME_ID __CLOCK_AVAILABILITY = 16 -#define CLOCK_THREAD_CPUTIME_ID _CLOCK_THREAD_CPUTIME_ID -} clockid_t; - -__CLOCK_AVAILABILITY -int clock_getres(clockid_t __clock_id, struct timespec *__res); - -__CLOCK_AVAILABILITY -int clock_gettime(clockid_t __clock_id, struct timespec *__tp); - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) -__CLOCK_AVAILABILITY -__uint64_t clock_gettime_nsec_np(clockid_t __clock_id); -#endif - -__OSX_AVAILABLE(10.12) __IOS_PROHIBITED -__TVOS_PROHIBITED __WATCHOS_PROHIBITED -int clock_settime(clockid_t __clock_id, const struct timespec *__tp); - -#undef __CLOCK_AVAILABILITY -#endif /* __DARWIN_C_LEVEL */ -#endif /* _DARWIN_FEATURE_CLOCK_GETTIME */ - -#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) && \ - ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ - (defined(__cplusplus) && __cplusplus >= 201703L)) -/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */ -#define TIME_UTC 1 /* time elapsed since epoch */ -__API_AVAILABLE(macosx(10.15), ios(13.0), tvos(13.0), watchos(6.0)) -int timespec_get(struct timespec *ts, int base); -#endif - -__END_DECLS - -#ifdef _USE_EXTENDED_LOCALES_ -#include -#endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* !_TIME_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/ucontext.h b/lib/libc/include/x86_64-macos.10-none/ucontext.h deleted file mode 100644 index 32ffa65b7e..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/ucontext.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2008, 2009 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -/* - * These routines are DEPRECATED and should not be used. - */ -#ifndef _UCONTEXT_H_ -#define _UCONTEXT_H_ - -#include - -#ifdef _XOPEN_SOURCE -#include -#include - -__BEGIN_DECLS -int getcontext(ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -void makecontext(ucontext_t *, void (*)(), int, ...) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int setcontext(const ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -__END_DECLS -#else /* !_XOPEN_SOURCE */ -#error The deprecated ucontext routines require _XOPEN_SOURCE to be defined -#endif /* _XOPEN_SOURCE */ - -#endif /* _UCONTEXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/unistd.h b/lib/libc/include/x86_64-macos.10-none/unistd.h deleted file mode 100644 index d07a4a61f5..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/unistd.h +++ /dev/null @@ -1,787 +0,0 @@ -/* - * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/*- - * Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved - * Copyright (c) 1991, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)unistd.h 8.12 (Berkeley) 4/27/95 - * - * Copyright (c) 1998 Apple Compter, Inc. - * All Rights Reserved - */ - -/* History: - 7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr - 3/26/98 CHW at Apple added real interface to searchfs call - 3/5/98 CHW at Apple added hfs semantic system calls headers -*/ - -#ifndef _UNISTD_H_ -#define _UNISTD_H_ - -#include <_types.h> -#include -#include -#include -#include -#include -#include -/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: - * _GCC_SIZE_T */ -#include -#include -#include -#include -#include - -#define STDIN_FILENO 0 /* standard input file descriptor */ -#define STDOUT_FILENO 1 /* standard output file descriptor */ -#define STDERR_FILENO 2 /* standard error file descriptor */ - - -/* Version test macros */ -/* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */ -#define _XOPEN_VERSION 600 /* [XSI] */ -#define _XOPEN_XCU_VERSION 4 /* Older standard */ - - -/* Please keep this list in the same order as the applicable standard */ -#define _POSIX_ADVISORY_INFO (-1) /* [ADV] */ -#define _POSIX_ASYNCHRONOUS_IO (-1) /* [AIO] */ -#define _POSIX_BARRIERS (-1) /* [BAR] */ -#define _POSIX_CHOWN_RESTRICTED 200112L -#define _POSIX_CLOCK_SELECTION (-1) /* [CS] */ -#define _POSIX_CPUTIME (-1) /* [CPT] */ -#define _POSIX_FSYNC 200112L /* [FSC] */ -#define _POSIX_IPV6 200112L -#define _POSIX_JOB_CONTROL 200112L -#define _POSIX_MAPPED_FILES 200112L /* [MF] */ -#define _POSIX_MEMLOCK (-1) /* [ML] */ -#define _POSIX_MEMLOCK_RANGE (-1) /* [MR] */ -#define _POSIX_MEMORY_PROTECTION 200112L /* [MPR] */ -#define _POSIX_MESSAGE_PASSING (-1) /* [MSG] */ -#define _POSIX_MONOTONIC_CLOCK (-1) /* [MON] */ -#define _POSIX_NO_TRUNC 200112L -#define _POSIX_PRIORITIZED_IO (-1) /* [PIO] */ -#define _POSIX_PRIORITY_SCHEDULING (-1) /* [PS] */ -#define _POSIX_RAW_SOCKETS (-1) /* [RS] */ -#define _POSIX_READER_WRITER_LOCKS 200112L /* [THR] */ -#define _POSIX_REALTIME_SIGNALS (-1) /* [RTS] */ -#define _POSIX_REGEXP 200112L -#define _POSIX_SAVED_IDS 200112L /* XXX required */ -#define _POSIX_SEMAPHORES (-1) /* [SEM] */ -#define _POSIX_SHARED_MEMORY_OBJECTS (-1) /* [SHM] */ -#define _POSIX_SHELL 200112L -#define _POSIX_SPAWN (-1) /* [SPN] */ -#define _POSIX_SPIN_LOCKS (-1) /* [SPI] */ -#define _POSIX_SPORADIC_SERVER (-1) /* [SS] */ -#define _POSIX_SYNCHRONIZED_IO (-1) /* [SIO] */ -#define _POSIX_THREAD_ATTR_STACKADDR 200112L /* [TSA] */ -#define _POSIX_THREAD_ATTR_STACKSIZE 200112L /* [TSS] */ -#define _POSIX_THREAD_CPUTIME (-1) /* [TCT] */ -#define _POSIX_THREAD_PRIO_INHERIT (-1) /* [TPI] */ -#define _POSIX_THREAD_PRIO_PROTECT (-1) /* [TPP] */ -#define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* [TPS] */ -#define _POSIX_THREAD_PROCESS_SHARED 200112L /* [TSH] */ -#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L /* [TSF] */ -#define _POSIX_THREAD_SPORADIC_SERVER (-1) /* [TSP] */ -#define _POSIX_THREADS 200112L /* [THR] */ -#define _POSIX_TIMEOUTS (-1) /* [TMO] */ -#define _POSIX_TIMERS (-1) /* [TMR] */ -#define _POSIX_TRACE (-1) /* [TRC] */ -#define _POSIX_TRACE_EVENT_FILTER (-1) /* [TEF] */ -#define _POSIX_TRACE_INHERIT (-1) /* [TRI] */ -#define _POSIX_TRACE_LOG (-1) /* [TRL] */ -#define _POSIX_TYPED_MEMORY_OBJECTS (-1) /* [TYM] */ -#ifndef _POSIX_VDISABLE -#define _POSIX_VDISABLE 0xff /* same as sys/termios.h */ -#endif /* _POSIX_VDISABLE */ - -#if __DARWIN_C_LEVEL >= 199209L -#define _POSIX2_C_BIND 200112L -#define _POSIX2_C_DEV 200112L /* c99 command */ -#define _POSIX2_CHAR_TERM 200112L -#define _POSIX2_FORT_DEV (-1) /* fort77 command */ -#define _POSIX2_FORT_RUN 200112L -#define _POSIX2_LOCALEDEF 200112L /* localedef command */ -#define _POSIX2_PBS (-1) -#define _POSIX2_PBS_ACCOUNTING (-1) -#define _POSIX2_PBS_CHECKPOINT (-1) -#define _POSIX2_PBS_LOCATE (-1) -#define _POSIX2_PBS_MESSAGE (-1) -#define _POSIX2_PBS_TRACK (-1) -#define _POSIX2_SW_DEV 200112L -#define _POSIX2_UPE 200112L /* XXXX no fc, newgrp, tabs */ -#endif /* __DARWIN_C_LEVEL */ - -#define __ILP32_OFF32 (-1) -#define __ILP32_OFFBIG (-1) - -#define __LP64_OFF64 (1) -#define __LPBIG_OFFBIG (1) - -#if __DARWIN_C_LEVEL >= 200112L -#define _POSIX_V6_ILP32_OFF32 __ILP32_OFF32 -#define _POSIX_V6_ILP32_OFFBIG __ILP32_OFFBIG -#define _POSIX_V6_LP64_OFF64 __LP64_OFF64 -#define _POSIX_V6_LPBIG_OFFBIG __LPBIG_OFFBIG -#endif /* __DARWIN_C_LEVEL >= 200112L */ - -#if __DARWIN_C_LEVEL >= 200809L -#define _POSIX_V7_ILP32_OFF32 __ILP32_OFF32 -#define _POSIX_V7_ILP32_OFFBIG __ILP32_OFFBIG -#define _POSIX_V7_LP64_OFF64 __LP64_OFF64 -#define _POSIX_V7_LPBIG_OFFBIG __LPBIG_OFFBIG -#endif /* __DARWIN_C_LEVEL >= 200809L */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define _V6_ILP32_OFF32 __ILP32_OFF32 -#define _V6_ILP32_OFFBIG __ILP32_OFFBIG -#define _V6_LP64_OFF64 __LP64_OFF64 -#define _V6_LPBIG_OFFBIG __LPBIG_OFFBIG -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL -/* Removed in Issue 7 */ -#define _XBS5_ILP32_OFF32 __ILP32_OFF32 -#define _XBS5_ILP32_OFFBIG __ILP32_OFFBIG -#define _XBS5_LP64_OFF64 __LP64_OFF64 -#define _XBS5_LPBIG_OFFBIG __LPBIG_OFFBIG -#endif /* __DARWIN_C_LEVEL < 200809L */ - -#if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */ -#define _XOPEN_CRYPT (1) -#define _XOPEN_ENH_I18N (1) /* XXX required */ -#define _XOPEN_LEGACY (-1) /* no ftime gcvt, wcswcs */ -#define _XOPEN_REALTIME (-1) /* no q'ed signals, mq_* */ -#define _XOPEN_REALTIME_THREADS (-1) /* no posix_spawn, et. al. */ -#define _XOPEN_SHM (1) -#define _XOPEN_STREAMS (-1) /* Issue 6 */ -#define _XOPEN_UNIX (1) -#endif /* XSI */ - -/* configurable system variables */ -#define _SC_ARG_MAX 1 -#define _SC_CHILD_MAX 2 -#define _SC_CLK_TCK 3 -#define _SC_NGROUPS_MAX 4 -#define _SC_OPEN_MAX 5 -#define _SC_JOB_CONTROL 6 -#define _SC_SAVED_IDS 7 -#define _SC_VERSION 8 -#define _SC_BC_BASE_MAX 9 -#define _SC_BC_DIM_MAX 10 -#define _SC_BC_SCALE_MAX 11 -#define _SC_BC_STRING_MAX 12 -#define _SC_COLL_WEIGHTS_MAX 13 -#define _SC_EXPR_NEST_MAX 14 -#define _SC_LINE_MAX 15 -#define _SC_RE_DUP_MAX 16 -#define _SC_2_VERSION 17 -#define _SC_2_C_BIND 18 -#define _SC_2_C_DEV 19 -#define _SC_2_CHAR_TERM 20 -#define _SC_2_FORT_DEV 21 -#define _SC_2_FORT_RUN 22 -#define _SC_2_LOCALEDEF 23 -#define _SC_2_SW_DEV 24 -#define _SC_2_UPE 25 -#define _SC_STREAM_MAX 26 -#define _SC_TZNAME_MAX 27 - -#if __DARWIN_C_LEVEL >= 199309L -#define _SC_ASYNCHRONOUS_IO 28 -#define _SC_PAGESIZE 29 -#define _SC_MEMLOCK 30 -#define _SC_MEMLOCK_RANGE 31 -#define _SC_MEMORY_PROTECTION 32 -#define _SC_MESSAGE_PASSING 33 -#define _SC_PRIORITIZED_IO 34 -#define _SC_PRIORITY_SCHEDULING 35 -#define _SC_REALTIME_SIGNALS 36 -#define _SC_SEMAPHORES 37 -#define _SC_FSYNC 38 -#define _SC_SHARED_MEMORY_OBJECTS 39 -#define _SC_SYNCHRONIZED_IO 40 -#define _SC_TIMERS 41 -#define _SC_AIO_LISTIO_MAX 42 -#define _SC_AIO_MAX 43 -#define _SC_AIO_PRIO_DELTA_MAX 44 -#define _SC_DELAYTIMER_MAX 45 -#define _SC_MQ_OPEN_MAX 46 -#define _SC_MAPPED_FILES 47 /* swap _SC_PAGESIZE vs. BSD */ -#define _SC_RTSIG_MAX 48 -#define _SC_SEM_NSEMS_MAX 49 -#define _SC_SEM_VALUE_MAX 50 -#define _SC_SIGQUEUE_MAX 51 -#define _SC_TIMER_MAX 52 -#endif /* __DARWIN_C_LEVEL >= 199309L */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define _SC_NPROCESSORS_CONF 57 -#define _SC_NPROCESSORS_ONLN 58 -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -#if __DARWIN_C_LEVEL >= 200112L -#define _SC_2_PBS 59 -#define _SC_2_PBS_ACCOUNTING 60 -#define _SC_2_PBS_CHECKPOINT 61 -#define _SC_2_PBS_LOCATE 62 -#define _SC_2_PBS_MESSAGE 63 -#define _SC_2_PBS_TRACK 64 -#define _SC_ADVISORY_INFO 65 -#define _SC_BARRIERS 66 -#define _SC_CLOCK_SELECTION 67 -#define _SC_CPUTIME 68 -#define _SC_FILE_LOCKING 69 -#define _SC_GETGR_R_SIZE_MAX 70 -#define _SC_GETPW_R_SIZE_MAX 71 -#define _SC_HOST_NAME_MAX 72 -#define _SC_LOGIN_NAME_MAX 73 -#define _SC_MONOTONIC_CLOCK 74 -#define _SC_MQ_PRIO_MAX 75 -#define _SC_READER_WRITER_LOCKS 76 -#define _SC_REGEXP 77 -#define _SC_SHELL 78 -#define _SC_SPAWN 79 -#define _SC_SPIN_LOCKS 80 -#define _SC_SPORADIC_SERVER 81 -#define _SC_THREAD_ATTR_STACKADDR 82 -#define _SC_THREAD_ATTR_STACKSIZE 83 -#define _SC_THREAD_CPUTIME 84 -#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 -#define _SC_THREAD_KEYS_MAX 86 -#define _SC_THREAD_PRIO_INHERIT 87 -#define _SC_THREAD_PRIO_PROTECT 88 -#define _SC_THREAD_PRIORITY_SCHEDULING 89 -#define _SC_THREAD_PROCESS_SHARED 90 -#define _SC_THREAD_SAFE_FUNCTIONS 91 -#define _SC_THREAD_SPORADIC_SERVER 92 -#define _SC_THREAD_STACK_MIN 93 -#define _SC_THREAD_THREADS_MAX 94 -#define _SC_TIMEOUTS 95 -#define _SC_THREADS 96 -#define _SC_TRACE 97 -#define _SC_TRACE_EVENT_FILTER 98 -#define _SC_TRACE_INHERIT 99 -#define _SC_TRACE_LOG 100 -#define _SC_TTY_NAME_MAX 101 -#define _SC_TYPED_MEMORY_OBJECTS 102 -#define _SC_V6_ILP32_OFF32 103 -#define _SC_V6_ILP32_OFFBIG 104 -#define _SC_V6_LP64_OFF64 105 -#define _SC_V6_LPBIG_OFFBIG 106 -#define _SC_IPV6 118 -#define _SC_RAW_SOCKETS 119 -#define _SC_SYMLOOP_MAX 120 -#endif /* __DARWIN_C_LEVEL >= 200112L */ - -#if __DARWIN_C_LEVEL >= 199506L /* Really XSI */ -#define _SC_ATEXIT_MAX 107 -#define _SC_IOV_MAX 56 -#define _SC_PAGE_SIZE _SC_PAGESIZE -#define _SC_XOPEN_CRYPT 108 -#define _SC_XOPEN_ENH_I18N 109 -#define _SC_XOPEN_LEGACY 110 /* Issue 6 */ -#define _SC_XOPEN_REALTIME 111 /* Issue 6 */ -#define _SC_XOPEN_REALTIME_THREADS 112 /* Issue 6 */ -#define _SC_XOPEN_SHM 113 -#define _SC_XOPEN_STREAMS 114 /* Issue 6 */ -#define _SC_XOPEN_UNIX 115 -#define _SC_XOPEN_VERSION 116 -#define _SC_XOPEN_XCU_VERSION 121 -#endif /* XSI */ - -#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL -/* Removed in Issue 7 */ -#define _SC_XBS5_ILP32_OFF32 122 -#define _SC_XBS5_ILP32_OFFBIG 123 -#define _SC_XBS5_LP64_OFF64 124 -#define _SC_XBS5_LPBIG_OFFBIG 125 -#endif /* __DARWIN_C_LEVEL <= 200809L */ - -#if __DARWIN_C_LEVEL >= 200112L -#define _SC_SS_REPL_MAX 126 -#define _SC_TRACE_EVENT_NAME_MAX 127 -#define _SC_TRACE_NAME_MAX 128 -#define _SC_TRACE_SYS_MAX 129 -#define _SC_TRACE_USER_EVENT_MAX 130 -#endif - -#if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL -/* Removed in Issue 6 */ -#define _SC_PASS_MAX 131 -#endif - -/* 132-199 available for future use */ -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define _SC_PHYS_PAGES 200 -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -#if __DARWIN_C_LEVEL >= 199209L -#ifndef _CS_PATH /* Defined in */ -#define _CS_PATH 1 -#endif -#endif - -#if __DARWIN_C_LEVEL >= 200112 -#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2 -#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3 -#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4 -#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5 -#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6 -#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7 -#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8 -#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9 -#define _CS_POSIX_V6_LP64_OFF64_LIBS 10 -#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11 -#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12 -#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13 -#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14 -#endif - -#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL -/* Removed in Issue 7 */ -#define _CS_XBS5_ILP32_OFF32_CFLAGS 20 -#define _CS_XBS5_ILP32_OFF32_LDFLAGS 21 -#define _CS_XBS5_ILP32_OFF32_LIBS 22 -#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 23 -#define _CS_XBS5_ILP32_OFFBIG_CFLAGS 24 -#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 25 -#define _CS_XBS5_ILP32_OFFBIG_LIBS 26 -#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 27 -#define _CS_XBS5_LP64_OFF64_CFLAGS 28 -#define _CS_XBS5_LP64_OFF64_LDFLAGS 29 -#define _CS_XBS5_LP64_OFF64_LIBS 30 -#define _CS_XBS5_LP64_OFF64_LINTFLAGS 31 -#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 32 -#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 33 -#define _CS_XBS5_LPBIG_OFFBIG_LIBS 34 -#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 35 -#endif - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define _CS_DARWIN_USER_DIR 65536 -#define _CS_DARWIN_USER_TEMP_DIR 65537 -#define _CS_DARWIN_USER_CACHE_DIR 65538 -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - - -#ifdef _DARWIN_UNLIMITED_GETGROUPS -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 -#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it." -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6 -#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it." -#endif -#endif - -/* POSIX.1-1990 */ - -__BEGIN_DECLS -void _exit(int) __dead2; -int access(const char *, int); -unsigned int - alarm(unsigned int); -int chdir(const char *); -int chown(const char *, uid_t, gid_t); - -int close(int) __DARWIN_ALIAS_C(close); - -int dup(int); -int dup2(int, int); -int execl(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int execle(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int execlp(const char * __file, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int execv(const char * __path, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int execve(const char * __file, char * const * __argv, char * const * __envp) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int execvp(const char * __file, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -long fpathconf(int, int); -char *getcwd(char *, size_t); -gid_t getegid(void); -uid_t geteuid(void); -gid_t getgid(void); -#if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE) -int getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups)); -#else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */ -int getgroups(int, gid_t []); -#endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */ -char *getlogin(void); -pid_t getpgrp(void); -pid_t getpid(void); -pid_t getppid(void); -uid_t getuid(void); -int isatty(int); -int link(const char *, const char *); -off_t lseek(int, off_t, int); -long pathconf(const char *, int); - -int pause(void) __DARWIN_ALIAS_C(pause); - -int pipe(int [2]); - -ssize_t read(int, void *, size_t) __DARWIN_ALIAS_C(read); - -int rmdir(const char *); -int setgid(gid_t); -int setpgid(pid_t, pid_t); -pid_t setsid(void); -int setuid(uid_t); - -unsigned int - sleep(unsigned int) __DARWIN_ALIAS_C(sleep); - -long sysconf(int); -pid_t tcgetpgrp(int); -int tcsetpgrp(int, pid_t); -char *ttyname(int); - -#if __DARWIN_UNIX03 -int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r); -#else /* !__DARWIN_UNIX03 */ -char *ttyname_r(int, char *, size_t); -#endif /* __DARWIN_UNIX03 */ - -int unlink(const char *); - -ssize_t write(int __fd, const void * __buf, size_t __nbyte) __DARWIN_ALIAS_C(write); -__END_DECLS - - - -/* Additional functionality provided by: - * POSIX.2-1992 C Language Binding Option - */ - -#if __DARWIN_C_LEVEL >= 199209L -__BEGIN_DECLS -size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr); - -int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt); - -extern char *optarg; /* getopt(3) external variables */ -extern int optind, opterr, optopt; -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 199209L */ - - - -/* Additional functionality provided by: - * POSIX.1c-1995, - * POSIX.1i-1995, - * and the omnibus ISO/IEC 9945-1: 1996 - */ - -#if __DARWIN_C_LEVEL >= 199506L -#include <_ctermid.h> - /* These F_* are really XSI or Issue 6 */ -#define F_ULOCK 0 /* unlock locked section */ -#define F_LOCK 1 /* lock a section for exclusive use */ -#define F_TLOCK 2 /* test and lock a section for exclusive use */ -#define F_TEST 3 /* test a section for locks by other procs */ - - __BEGIN_DECLS - -/* Begin XSI */ -/* Removed in Issue 6 */ -#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L -#if !defined(_POSIX_C_SOURCE) -__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED -#endif -void *brk(const void *); -int chroot(const char *) __POSIX_C_DEPRECATED(199506L); -#endif - -char *crypt(const char *, const char *); -#if __DARWIN_UNIX03 -void encrypt(char *, int) __DARWIN_ALIAS(encrypt); -#else /* !__DARWIN_UNIX03 */ -int encrypt(char *, int); -#endif /* __DARWIN_UNIX03 */ -int fchdir(int); -long gethostid(void); -pid_t getpgid(pid_t); -pid_t getsid(pid_t); - -/* Removed in Issue 6 */ -#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L -int getdtablesize(void) __POSIX_C_DEPRECATED(199506L); -int getpagesize(void) __pure2 __POSIX_C_DEPRECATED(199506L); -char *getpass(const char *) __POSIX_C_DEPRECATED(199506L); -#endif - -/* Removed in Issue 7 */ -#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L -char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */ -#endif - -int lchown(const char *, uid_t, gid_t) __DARWIN_ALIAS(lchown); - -int lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf); - -int nice(int) __DARWIN_ALIAS(nice); - -ssize_t pread(int __fd, void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pread); - -ssize_t pwrite(int __fd, const void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pwrite); - -/* Removed in Issue 6 */ -#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L -/* Note that Issue 5 changed the argument as intprt_t, - * but we keep it as int for binary compatability. */ -#if !defined(_POSIX_C_SOURCE) -__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED -#endif -void *sbrk(int); -#endif - -#if __DARWIN_UNIX03 -pid_t setpgrp(void) __DARWIN_ALIAS(setpgrp); -#else /* !__DARWIN_UNIX03 */ -int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */ -#endif /* __DARWIN_UNIX03 */ - -int setregid(gid_t, gid_t) __DARWIN_ALIAS(setregid); - -int setreuid(uid_t, uid_t) __DARWIN_ALIAS(setreuid); - -void swab(const void * __restrict, void * __restrict, ssize_t); -void sync(void); -int truncate(const char *, off_t); -useconds_t ualarm(useconds_t, useconds_t); -int usleep(useconds_t) __DARWIN_ALIAS_C(usleep); -pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -/* End XSI */ - -int fsync(int) __DARWIN_ALIAS_C(fsync); - -int ftruncate(int, off_t); -int getlogin_r(char *, size_t); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 199506L */ - - - -/* Additional functionality provided by: - * POSIX.1-2001 - * ISO C99 - */ - -#if __DARWIN_C_LEVEL >= 200112L -__BEGIN_DECLS -int fchown(int, uid_t, gid_t); -int gethostname(char *, size_t); -ssize_t readlink(const char * __restrict, char * __restrict, size_t); -int setegid(gid_t); -int seteuid(uid_t); -int symlink(const char *, const char *); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200112L */ - - - -/* Darwin extensions */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#include - -#include -#include -#include - -__BEGIN_DECLS -void _Exit(int) __dead2; -int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t); -int acct(const char *); -int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -void endusershell(void); -int execvP(const char * __file, const char * __searchpath, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -char *fflagstostr(unsigned long); -int getdomainname(char *, int); -int getgrouplist(const char *, int, int *, int *); -#if defined(__has_include) -#if __has_include() -#include -#else -#include -#endif -#else -#include -#endif -mode_t getmode(const void *, mode_t); -int getpeereid(int, uid_t *, gid_t *); -int getsgroups_np(int *, uuid_t); -char *getusershell(void); -int getwgroups_np(int *, uuid_t); -int initgroups(const char *, int); -int issetugid(void); -char *mkdtemp(char *); -int mknod(const char *, mode_t, dev_t); -int mkpath_np(const char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */ -int mkpathat_np(int dfd, const char *path, mode_t omode) /* returns errno */ - __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) - __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); -int mkstemp(char *); -int mkstemps(char *, int); -char *mktemp(char *); -int mkostemp(char *path, int oflags) - __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) - __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); -int mkostemps(char *path, int slen, int oflags) - __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) - __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); -/* Non-portable mkstemp that uses open_dprotected_np */ -int mkstemp_dprotected_np(char *path, int dpclass, int dpflags) - __OSX_UNAVAILABLE __IOS_AVAILABLE(10.0) - __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0); -char *mkdtempat_np(int dfd, char *path) - __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) - __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); -int mkstempsat_np(int dfd, char *path, int slen) - __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) - __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); -int mkostempsat_np(int dfd, char *path, int slen, int oflags) - __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) - __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); -int nfssvc(int, void *); -int profil(char *, size_t, unsigned long, unsigned int); - -__deprecated_msg("Use of per-thread security contexts is error-prone and discouraged.") -int pthread_setugid_np(uid_t, gid_t); -int pthread_getugid_np( uid_t *, gid_t *); - -int reboot(int); -int revoke(const char *); - -__deprecated int rcmd(char **, int, const char *, const char *, const char *, int *); -__deprecated int rcmd_af(char **, int, const char *, const char *, const char *, int *, - int); -__deprecated int rresvport(int *); -__deprecated int rresvport_af(int *, int); -__deprecated int iruserok(unsigned long, int, const char *, const char *); -__deprecated int iruserok_sa(const void *, int, int, const char *, const char *); -__deprecated int ruserok(const char *, int, const char *, const char *); - -int setdomainname(const char *, int); -int setgroups(int, const gid_t *); -void sethostid(long); -int sethostname(const char *, int); -#if __DARWIN_UNIX03 -void setkey(const char *) __DARWIN_ALIAS(setkey); -#else /* !__DARWIN_UNIX03 */ -int setkey(const char *); -#endif /* __DARWIN_UNIX03 */ -int setlogin(const char *); -void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(setmode)); -int setrgid(gid_t); -int setruid(uid_t); -int setsgroups_np(int, const uuid_t); -void setusershell(void); -int setwgroups_np(int, const uuid_t); -int strtofflags(char **, unsigned long *, unsigned long *); -int swapon(const char *); -int ttyslot(void); -int undelete(const char *); -int unwhiteout(const char *); -void *valloc(size_t); - -__WATCHOS_PROHIBITED __TVOS_PROHIBITED -__OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; " - "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().") -__OS_AVAILABILITY_MSG(macosx,deprecated=10.12,"syscall(2) is unsupported; " - "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().") -int syscall(int, ...); - -extern char *suboptarg; /* getsubopt(3) external variable */ -int getsubopt(char **, char * const *, char **); - -/* HFS & HFS Plus semantics system calls go here */ -#ifdef __LP64__ -int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); -int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); -int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist); -int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist); -int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; - -#else /* __LP64__ */ -int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); -int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); -int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist); -int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist); -int exchangedata(const char*,const char*,unsigned long) - __OSX_DEPRECATED(10.0, 10.13, "use renamex_np with the RENAME_SWAP flag") - __IOS_DEPRECATED(2.0, 11.0, "use renamex_np with the RENAME_SWAP flag") - __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; - -#endif /* __LP64__ */ - -struct fssearchblock; -struct searchstate; - -int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -int fsctl(const char *,unsigned long,void*,unsigned int); -int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); - -#define SYNC_VOLUME_FULLSYNC 0x01 /* Flush data and metadata to platter, not just to disk cache */ -#define SYNC_VOLUME_WAIT 0x02 /* Wait for sync to complete */ - -int fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); -int sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); - -extern int optreset; - -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -#endif /* _UNISTD_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/uuid/uuid.h b/lib/libc/include/x86_64-macos.10-none/uuid/uuid.h deleted file mode 100644 index ce75c9e0e1..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/uuid/uuid.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Public include file for the UUID library - * - * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. - * - * %Begin-Header% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, and the entire permission notice in its entirety, - * including the disclaimer of warranties. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF - * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * %End-Header% - */ - -#ifndef _UUID_UUID_H -#define _UUID_UUID_H - -#include -#include - -#ifndef _UUID_STRING_T -#define _UUID_STRING_T -typedef __darwin_uuid_string_t uuid_string_t; -#endif /* _UUID_STRING_T */ - -#define UUID_DEFINE(name, u0, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11, u12, u13, u14, u15) \ - static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} - -UUID_DEFINE(UUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - -#ifdef __cplusplus -extern "C" { -#endif - -void uuid_clear(uuid_t uu); - -int uuid_compare(const uuid_t uu1, const uuid_t uu2); - -void uuid_copy(uuid_t dst, const uuid_t src); - -void uuid_generate(uuid_t out); -void uuid_generate_random(uuid_t out); -void uuid_generate_time(uuid_t out); - -void uuid_generate_early_random(uuid_t out); - -int uuid_is_null(const uuid_t uu); - -int uuid_parse(const uuid_string_t in, uuid_t uu); - -void uuid_unparse(const uuid_t uu, uuid_string_t out); -void uuid_unparse_lower(const uuid_t uu, uuid_string_t out); -void uuid_unparse_upper(const uuid_t uu, uuid_string_t out); - -#ifdef __cplusplus -} -#endif - -#endif /* _UUID_UUID_H */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/xlocale/_inttypes.h b/lib/libc/include/x86_64-macos.10-none/xlocale/_inttypes.h deleted file mode 100644 index 4da8f90c6d..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/xlocale/_inttypes.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _XLOCALE__INTTYPES_H_ -#define _XLOCALE__INTTYPES_H_ - -#include -#include -#include <_xlocale.h> - -__BEGIN_DECLS -intmax_t strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, - int base, locale_t); -uintmax_t strtoumax_l(const char * __restrict nptr, char ** __restrict endptr, - int base, locale_t); -intmax_t wcstoimax_l(const wchar_t * __restrict nptr, - wchar_t ** __restrict endptr, int base, locale_t); -uintmax_t wcstoumax_l(const wchar_t * __restrict nptr, - wchar_t ** __restrict endptr, int base, locale_t); - -/* Poison the following routines if -fshort-wchar is set */ -#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU -#pragma GCC poison wcstoimax_l wcstoumax_l -#endif -__END_DECLS - -#endif /* _XLOCALE__INTTYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/xlocale/_wchar.h b/lib/libc/include/x86_64-macos.10-none/xlocale/_wchar.h deleted file mode 100644 index b4af0f816e..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/xlocale/_wchar.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ - -#ifndef _XLOCALE__WCHAR_H_ -#define _XLOCALE__WCHAR_H_ - -#include <_stdio.h> -#include <_xlocale.h> -#include - -/* Initially added in Issue 4 */ -__BEGIN_DECLS -wint_t btowc_l(int, locale_t); -wint_t fgetwc_l(FILE *, locale_t); -wchar_t *fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t); -wint_t fputwc_l(wchar_t, FILE *, locale_t); -int fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t); -int fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); -int fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); -wint_t getwc_l(FILE *, locale_t); -wint_t getwchar_l(locale_t); -size_t mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict, - locale_t); -size_t mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t, - mbstate_t * __restrict, locale_t); -int mbsinit_l(const mbstate_t *, locale_t); -size_t mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, - mbstate_t * __restrict, locale_t); -wint_t putwc_l(wchar_t, FILE *, locale_t); -wint_t putwchar_l(wchar_t, locale_t); -int swprintf_l(wchar_t * __restrict, size_t n, locale_t, - const wchar_t * __restrict, ...); -int swscanf_l(const wchar_t * __restrict, locale_t, - const wchar_t * __restrict, ...); -wint_t ungetwc_l(wint_t, FILE *, locale_t); -int vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, - __darwin_va_list); -int vswprintf_l(wchar_t * __restrict, size_t n, locale_t, - const wchar_t * __restrict, __darwin_va_list); -int vwprintf_l(locale_t, const wchar_t * __restrict, __darwin_va_list); -size_t wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, - locale_t); -int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); -size_t wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict, - const struct tm * __restrict, locale_t) - __DARWIN_ALIAS(wcsftime_l); -size_t wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, - mbstate_t * __restrict, locale_t); -double wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); -long wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int, - locale_t); -unsigned long - wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int, - locale_t); -int wcswidth_l(const wchar_t *, size_t, locale_t); -size_t wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t, - locale_t); -int wctob_l(wint_t, locale_t); -int wcwidth_l(wchar_t, locale_t); -int wprintf_l(locale_t, const wchar_t * __restrict, ...); -int wscanf_l(locale_t, const wchar_t * __restrict, ...); -__END_DECLS - - - -/* Additional functionality provided by: - * POSIX.1-2001 - */ - -#if __DARWIN_C_LEVEL >= 200112L -__BEGIN_DECLS -int vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, - __darwin_va_list); -int vswscanf_l(const wchar_t * __restrict, locale_t, - const wchar_t * __restrict, __darwin_va_list); -int vwscanf_l(locale_t, const wchar_t * __restrict, __darwin_va_list); -float wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); -long double - wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); -#if !__DARWIN_NO_LONG_LONG -long long - wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int, - locale_t); -unsigned long long - wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int, - locale_t); -#endif /* !__DARWIN_NO_LONG_LONG */ -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200112L */ - - - -/* Additional functionality provided by: - * POSIX.1-2008 - */ - -#if __DARWIN_C_LEVEL >= 200809L -__BEGIN_DECLS -size_t mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, - size_t, mbstate_t * __restrict, locale_t); -int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t n, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -size_t wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, - size_t, mbstate_t * __restrict, locale_t); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200809L */ - - - -/* Darwin extensions */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -__BEGIN_DECLS -wchar_t *fgetwln_l(FILE * __restrict, size_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - - - -/* Poison the following routines if -fshort-wchar is set */ -#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU -#pragma GCC poison fgetwln_l fgetws_l fputwc_l fputws_l fwprintf_l fwscanf_l mbrtowc_l mbsnrtowcs_l mbsrtowcs_l putwc_l putwchar_l swprintf_l swscanf_l vfwprintf_l vfwscanf_l vswprintf_l vswscanf_l vwprintf_l vwscanf_l wcrtomb_l wcscoll_l wcsftime_l wcsftime_l wcsnrtombs_l wcsrtombs_l wcstod_l wcstof_l wcstol_l wcstold_l wcstoll_l wcstoul_l wcstoull_l wcswidth_l wcsxfrm_l wcwidth_l wprintf_l wscanf_l -#endif - -#endif /* _XLOCALE__WCHAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/xpc/activity.h b/lib/libc/include/x86_64-macos.10-none/xpc/activity.h deleted file mode 100644 index c48051f145..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/xpc/activity.h +++ /dev/null @@ -1,446 +0,0 @@ -#ifndef __XPC_ACTIVITY_H__ -#define __XPC_ACTIVITY_H__ - -#ifndef __XPC_INDIRECT__ -#error "Please #include instead of this file directly." -// For HeaderDoc. -#include -#endif // __XPC_INDIRECT__ - -#ifdef __BLOCKS__ - -XPC_ASSUME_NONNULL_BEGIN -__BEGIN_DECLS - -/* - * The following are a collection of keys and values used to set an activity's - * execution criteria. - */ - -/*! - * @constant XPC_ACTIVITY_INTERVAL - * An integer property indicating the desired time interval (in seconds) of the - * activity. The activity will not be run more than once per time interval. - * Due to the nature of XPC Activity finding an opportune time to run - * the activity, any two occurrences may be more or less than 'interval' - * seconds apart, but on average will be 'interval' seconds apart. - * The presence of this key implies the following, unless overridden: - * - XPC_ACTIVITY_REPEATING with a value of true - * - XPC_ACTIVITY_DELAY with a value of half the 'interval' - * The delay enforces a minimum distance between any two occurrences. - * - XPC_ACTIVITY_GRACE_PERIOD with a value of half the 'interval'. - * The grace period is the amount of time allowed to pass after the end of - * the interval before more aggressive scheduling occurs. The grace period - * does not increase the size of the interval. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_INTERVAL; - -/*! - * @constant XPC_ACTIVITY_REPEATING - * A boolean property indicating whether this is a repeating activity. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_REPEATING; - -/*! - * @constant XPC_ACTIVITY_DELAY - * An integer property indicating the number of seconds to delay before - * beginning the activity. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_DELAY; - -/*! - * @constant XPC_ACTIVITY_GRACE_PERIOD - * An integer property indicating the number of seconds to allow as a grace - * period before the scheduling of the activity becomes more aggressive. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_GRACE_PERIOD; - - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_1_MIN; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_5_MIN; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_15_MIN; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_30_MIN; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_1_HOUR; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_4_HOURS; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_8_HOURS; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_1_DAY; - -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const int64_t XPC_ACTIVITY_INTERVAL_7_DAYS; - -/*! - * @constant XPC_ACTIVITY_PRIORITY - * A string property indicating the priority of the activity. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_PRIORITY; - -/*! - * @constant XPC_ACTIVITY_PRIORITY_MAINTENANCE - * A string indicating activity is maintenance priority. - * - * Maintenance priority is intended for user-invisible maintenance tasks - * such as garbage collection or optimization. - * - * Maintenance activities are not permitted to run if the device thermal - * condition exceeds a nominal level or if the battery level is lower than 20%. - * In Low Power Mode (on supported devices), maintenance activities are not - * permitted to run while the device is on battery, or plugged in and the - * battery level is lower than 30%. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_PRIORITY_MAINTENANCE; - -/*! - * @constant XPC_ACTIVITY_PRIORITY_UTILITY - * A string indicating activity is utility priority. - * - * Utility priority is intended for user-visible tasks such as fetching data - * from the network, copying files, or importing data. - * - * Utility activities are not permitted to run if the device thermal condition - * exceeds a moderate level or if the battery level is less than 10%. In Low - * Power Mode (on supported devices) when on battery power, utility activities - * are only permitted when they are close to their deadline (90% of their time - * window has elapsed). - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_PRIORITY_UTILITY; - -/*! - * @constant XPC_ACTIVITY_ALLOW_BATTERY - * A Boolean value indicating whether the activity should be allowed to run - * while the computer is on battery power. The default value is false for - * maintenance priority activity and true for utility priority activity. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_ALLOW_BATTERY; - -/*! - * @constant XPC_ACTIVITY_REQUIRE_SCREEN_SLEEP - * A Boolean value indicating whether the activity should only be performed - * while device appears to be asleep. Note that the definition of screen sleep - * may vary by platform and may include states where the device is known to be - * idle despite the fact that the display itself is still powered. Defaults to - * false. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const char * const XPC_ACTIVITY_REQUIRE_SCREEN_SLEEP; // bool - -/*! - * @constant XPC_ACTIVITY_REQUIRE_BATTERY_LEVEL - * An integer percentage of minimum battery charge required to allow the - * activity to run. A default minimum battery level is determined by the - * system. - */ -__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_9, __MAC_10_9, __IPHONE_7_0, __IPHONE_7_0, - "REQUIRE_BATTERY_LEVEL is not implemented") -XPC_EXPORT -const char * const XPC_ACTIVITY_REQUIRE_BATTERY_LEVEL; // int (%) - -/*! - * @constant XPC_ACTIVITY_REQUIRE_HDD_SPINNING - * A Boolean value indicating whether the activity should only be performed - * while the hard disk drive (HDD) is spinning. Computers with flash storage - * are considered to be equivalent to HDD spinning. Defaults to false. - */ -__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_9, __MAC_10_9, __IPHONE_7_0, __IPHONE_7_0, - "REQUIRE_HDD_SPINNING is not implemented") -XPC_EXPORT -const char * const XPC_ACTIVITY_REQUIRE_HDD_SPINNING; // bool - -/*! - * @define XPC_TYPE_ACTIVITY - * A type representing the XPC activity object. - */ -#define XPC_TYPE_ACTIVITY (&_xpc_type_activity) -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -XPC_TYPE(_xpc_type_activity); - -/*! - * @typedef xpc_activity_t - * - * @abstract - * An XPC activity object. - * - * @discussion - * This object represents a set of execution criteria and a current execution - * state for background activity on the system. Once an activity is registered, - * the system will evaluate its criteria to determine whether the activity is - * eligible to run under current system conditions. When an activity becomes - * eligible to run, its execution state will be updated and an invocation of - * its handler block will be made. - */ -XPC_DECL(xpc_activity); - -/*! - * @typedef xpc_activity_handler_t - * - * @abstract - * A block that is called when an XPC activity becomes eligible to run. - */ -XPC_NONNULL1 -typedef void (^xpc_activity_handler_t)(xpc_activity_t activity); - -/*! - * @constant XPC_ACTIVITY_CHECK_IN - * This constant may be passed to xpc_activity_register() as the criteria - * dictionary in order to check in with the system for previously registered - * activity using the same identifier (for example, an activity taken from a - * launchd property list). - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT -const xpc_object_t XPC_ACTIVITY_CHECK_IN; - -/*! - * @function xpc_activity_register - * - * @abstract - * Registers an activity with the system. - * - * @discussion - * Registers a new activity with the system. The criteria of the activity are - * described by the dictionary passed to this function. If an activity with the - * same identifier already exists, the criteria provided override the existing - * criteria unless the special dictionary XPC_ACTIVITY_CHECK_IN is used. The - * XPC_ACTIVITY_CHECK_IN dictionary instructs the system to first look up an - * existing activity without modifying its criteria. Once the existing activity - * is found (or a new one is created with an empty set of criteria) the handler - * will be called with an activity object in the XPC_ACTIVITY_STATE_CHECK_IN - * state. - * - * @param identifier - * A unique identifier for the activity. Each application has its own namespace. - * The identifier should remain constant across registrations, relaunches of - * the application, and reboots. It should identify the kind of work being done, - * not a particular invocation of the work. - * - * @param criteria - * A dictionary of criteria for the activity. - * - * @param handler - * The handler block to be called when the activity changes state to one of the - * following states: - * - XPC_ACTIVITY_STATE_CHECK_IN (optional) - * - XPC_ACTIVITY_STATE_RUN - * - * The handler block is never invoked reentrantly. It will be invoked on a - * dispatch queue with an appropriate priority to perform the activity. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 XPC_NONNULL3 -void -xpc_activity_register(const char *identifier, xpc_object_t criteria, - xpc_activity_handler_t handler); - -/*! - * @function xpc_activity_copy_criteria - * - * @abstract - * Returns an XPC dictionary describing the execution criteria of an activity. - * This will return NULL in cases where the activity has already completed, e.g. - * when checking in to an event that finished and was not rescheduled. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT XPC_WARN_RESULT XPC_RETURNS_RETAINED XPC_NONNULL1 -xpc_object_t _Nullable -xpc_activity_copy_criteria(xpc_activity_t activity); - -/*! - * @function xpc_activity_set_criteria - * - * @abstract - * Modifies the execution criteria of an activity. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 -void -xpc_activity_set_criteria(xpc_activity_t activity, xpc_object_t criteria); - -/*! - * @enum xpc_activity_state_t - * An activity is defined to be in one of the following states. Applications - * may check the current state of the activity using xpc_activity_get_state() - * in the handler block provided to xpc_activity_register(). - * - * The application can modify the state of the activity by calling - * xpc_activity_set_state() with one of the following: - * - XPC_ACTIVITY_STATE_DEFER - * - XPC_ACTIVITY_STATE_CONTINUE - * - XPC_ACTIVITY_STATE_DONE - * - * @constant XPC_ACTIVITY_STATE_CHECK_IN - * An activity in this state has just completed a checkin with the system after - * XPC_ACTIVITY_CHECK_IN was provided as the criteria dictionary to - * xpc_activity_register. The state gives the application an opportunity to - * inspect and modify the activity's criteria. - * - * @constant XPC_ACTIVITY_STATE_WAIT - * An activity in this state is waiting for an opportunity to run. This value - * is never returned within the activity's handler block, as the block is - * invoked in response to XPC_ACTIVITY_STATE_CHECK_IN or XPC_ACTIVITY_STATE_RUN. - * - * Note: - * A launchd job may idle exit while an activity is in the wait state and be - * relaunched in response to the activity becoming runnable. The launchd job - * simply needs to re-register for the activity on its next launch by passing - * XPC_ACTIVITY_STATE_CHECK_IN to xpc_activity_register(). - * - * @constant XPC_ACTIVITY_STATE_RUN - * An activity in this state is eligible to run based on its criteria. - * - * @constant XPC_ACTIVITY_STATE_DEFER - * An application may pass this value to xpc_activity_set_state() to indicate - * that the activity should be deferred (placed back into the WAIT state) until - * a time when its criteria are met again. Deferring an activity does not reset - * any of its time-based criteria (in other words, it will remain past due). - * - * IMPORTANT: - * This should be done in response to observing xpc_activity_should_defer(). - * It should not be done unilaterally. If you determine that conditions are bad - * to do your activity's work for reasons you can't express in a criteria - * dictionary, you should set the activity's state to XPC_ACTIVITY_STATE_DONE. - * - * - * @constant XPC_ACTIVITY_STATE_CONTINUE - * An application may pass this value to xpc_activity_set_state() to indicate - * that the activity will continue its operation beyond the return of its - * handler block. This can be used to extend an activity to include asynchronous - * operations. The activity's handler block will not be invoked again until the - * state has been updated to either XPC_ACTIVITY_STATE_DEFER or, in the case - * of repeating activity, XPC_ACTIVITY_STATE_DONE. - * - * @constant XPC_ACTIVITY_STATE_DONE - * An application may pass this value to xpc_activity_set_state() to indicate - * that the activity has completed. For non-repeating activity, the resources - * associated with the activity will be automatically released upon return from - * the handler block. For repeating activity, timers present in the activity's - * criteria will be reset. - */ -enum { - XPC_ACTIVITY_STATE_CHECK_IN, - XPC_ACTIVITY_STATE_WAIT, - XPC_ACTIVITY_STATE_RUN, - XPC_ACTIVITY_STATE_DEFER, - XPC_ACTIVITY_STATE_CONTINUE, - XPC_ACTIVITY_STATE_DONE, -}; -typedef long xpc_activity_state_t; - -/*! - * @function xpc_activity_get_state - * - * @abstract - * Returns the current state of an activity. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -xpc_activity_state_t -xpc_activity_get_state(xpc_activity_t activity); - -/*! - * @function xpc_activity_set_state - * - * @abstract - * Updates the current state of an activity. - * - * @return - * Returns true if the state was successfully updated; otherwise, returns - * false if the requested state transition is not valid. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -bool -xpc_activity_set_state(xpc_activity_t activity, xpc_activity_state_t state); - -/*! - * @function xpc_activity_should_defer - * - * @abstract - * Test whether an activity should be deferred. - * - * @discussion - * This function may be used to test whether the criteria of a long-running - * activity are still satisfied. If not, the system indicates that the - * application should defer the activity. The application may acknowledge the - * deferral by calling xpc_activity_set_state() with XPC_ACTIVITY_STATE_DEFER. - * Once deferred, the system will place the activity back into the WAIT state - * and re-invoke the handler block at the earliest opportunity when the criteria - * are once again satisfied. - * - * @return - * Returns true if the activity should be deferred. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -bool -xpc_activity_should_defer(xpc_activity_t activity); - -/*! - * @function xpc_activity_unregister - * - * @abstract - * Unregisters an activity found by its identifier. - * - * @discussion - * A dynamically registered activity will be deleted in response to this call. - * Statically registered activity (from a launchd property list) will be - * deleted until the job is next loaded (e.g. at next boot). - * - * Unregistering an activity has no effect on any outstanding xpc_activity_t - * objects or any currently executing xpc_activity_handler_t blocks; however, - * no new handler block invocations will be made after it is unregistered. - * - * @param identifier - * The identifier of the activity to unregister. - */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) -XPC_EXPORT XPC_NONNULL1 -void -xpc_activity_unregister(const char *identifier); - -__END_DECLS -XPC_ASSUME_NONNULL_END - -#endif // __BLOCKS__ - -#endif // __XPC_ACTIVITY_H__ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/xpc/availability.h b/lib/libc/include/x86_64-macos.10-none/xpc/availability.h deleted file mode 100644 index d4efcec685..0000000000 --- a/lib/libc/include/x86_64-macos.10-none/xpc/availability.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef __XPC_AVAILABILITY_H__ -#define __XPC_AVAILABILITY_H__ - -#include - -// Certain parts of the project use all the project's headers but have to build -// against newer OSX SDKs than ebuild uses -- liblaunch_host being the example. -// So we need to define these. -#ifndef __MAC_10_15 -#define __MAC_10_15 101500 -#define __AVAILABILITY_INTERNAL__MAC_10_15 \ -__attribute__((availability(macosx, introduced=10.15))) -#endif // __MAC_10_15 - -#ifndef __MAC_10_14 -#define __MAC_10_14 101400 -#define __AVAILABILITY_INTERNAL__MAC_10_14 \ -__attribute__((availability(macosx, introduced=10.14))) -#endif // __MAC_10_14 - -#ifndef __MAC_10_13 -#define __MAC_10_13 101300 -#define __AVAILABILITY_INTERNAL__MAC_10_13 \ - __attribute__((availability(macosx, introduced=10.13))) -#endif // __MAC_10_13 - -#ifndef __MAC_10_12 -#define __MAC_10_12 101200 -#define __AVAILABILITY_INTERNAL__MAC_10_12 \ - __attribute__((availability(macosx, introduced=10.12))) -#endif // __MAC_10_12 - -#ifndef __MAC_10_11 -#define __MAC_10_11 101100 -#define __AVAILABILITY_INTERNAL__MAC_10_11 \ - __attribute__((availability(macosx, introduced=10.11))) -#endif // __MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11 -#define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11 -#endif // __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11 - -#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13 -#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13 -#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13 - -#if __has_include() -#include -#else // __has_include() -#ifndef IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED -#define IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED 999999 -#endif // IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED -#endif // __has_include() - -#ifndef __WATCHOS_UNAVAILABLE -#define __WATCHOS_UNAVAILABLE -#endif - -#ifndef __TVOS_UNAVAILABLE -#define __TVOS_UNAVAILABLE -#endif - -// simulator host-side bits build against SDKs not having __*_AVAILABLE() yet -#ifndef __OSX_AVAILABLE -#define __OSX_AVAILABLE(...) -#endif - -#ifndef __IOS_AVAILABLE -#define __IOS_AVAILABLE(...) -#endif - -#ifndef __TVOS_AVAILABLE -#define __TVOS_AVAILABLE(...) -#endif - -#ifndef __WATCHOS_AVAILABLE -#define __WATCHOS_AVAILABLE(...) -#endif - -#ifndef __API_AVAILABLE -#define __API_AVAILABLE(...) -#endif - -#endif // __XPC_AVAILABILITY_H__ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/_limits.h b/lib/libc/include/x86_64-macos.13-none/i386/_limits.h similarity index 91% rename from lib/libc/include/x86_64-macos.10-none/i386/_limits.h rename to lib/libc/include/x86_64-macos.13-none/i386/_limits.h index f942e7abd8..5763f5a3a8 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/_limits.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/_limits.h @@ -22,6 +22,10 @@ #ifndef _I386__LIMITS_H_ #define _I386__LIMITS_H_ +#if defined (__i386__) || defined (__x86_64__) + #define __DARWIN_CLK_TCK 100 /* ticks per second */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _I386__LIMITS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/_mcontext.h b/lib/libc/include/x86_64-macos.13-none/i386/_mcontext.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/i386/_mcontext.h rename to lib/libc/include/x86_64-macos.13-none/i386/_mcontext.h index 424ca21359..b9f40e5e33 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/_mcontext.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/_mcontext.h @@ -29,6 +29,8 @@ #ifndef __I386_MCONTEXT_H_ #define __I386_MCONTEXT_H_ +#if defined (__i386__) || defined (__x86_64__) + #include /* __DARWIN_UNIX03 */ #include #include @@ -209,4 +211,6 @@ typedef _STRUCT_MCONTEXT32 *mcontext_t; #endif #endif /* _MCONTEXT_T */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* __I386_MCONTEXT_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/_param.h b/lib/libc/include/x86_64-macos.13-none/i386/_param.h similarity index 83% rename from lib/libc/include/x86_64-macos.10-none/i386/_param.h rename to lib/libc/include/x86_64-macos.13-none/i386/_param.h index d8f7b3d4bf..ac0ac439aa 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/_param.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/_param.h @@ -29,6 +29,8 @@ #ifndef _I386__PARAM_H_ #define _I386__PARAM_H_ +#if defined (__i386__) || defined (__x86_64__) + #include /* @@ -37,10 +39,11 @@ * cast to any desired pointer type. */ #define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1) -#define __DARWIN_ALIGN(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES) +#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES) #define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1) -#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32) +#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32) +#endif /* defined (__i386__) || defined (__x86_64__) */ #endif /* _I386__PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/_types.h b/lib/libc/include/x86_64-macos.13-none/i386/_types.h similarity index 97% rename from lib/libc/include/x86_64-macos.10-none/i386/_types.h rename to lib/libc/include/x86_64-macos.13-none/i386/_types.h index 9dcffa5241..b9e77d684c 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/_types.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/_types.h @@ -28,6 +28,8 @@ #ifndef _BSD_I386__TYPES_H_ #define _BSD_I386__TYPES_H_ +#if defined (__i386__) || defined (__x86_64__) + /* * This header file contains integer types. It's intended to also contain * flotaing point and other arithmetic types, as needed, later. @@ -119,4 +121,6 @@ typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */ typedef long __darwin_ssize_t; /* byte count or error */ typedef long __darwin_time_t; /* time() */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _BSD_I386__TYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/eflags.h b/lib/libc/include/x86_64-macos.13-none/i386/eflags.h similarity index 97% rename from lib/libc/include/x86_64-macos.10-none/i386/eflags.h rename to lib/libc/include/x86_64-macos.13-none/i386/eflags.h index dc73c43126..7faa7d0839 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/eflags.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/eflags.h @@ -59,6 +59,8 @@ #ifndef _I386_EFLAGS_H_ #define _I386_EFLAGS_H_ +#if defined (__i386__) || defined (__x86_64__) + /* * i386 flags register */ @@ -91,4 +93,6 @@ #define EFL_USER_SET (EFL_IF) #define EFL_USER_CLEAR (EFL_IOPL|EFL_NT|EFL_RF) +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _I386_EFLAGS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/endian.h b/lib/libc/include/x86_64-macos.13-none/i386/endian.h similarity index 97% rename from lib/libc/include/x86_64-macos.10-none/i386/endian.h rename to lib/libc/include/x86_64-macos.13-none/i386/endian.h index 95ca16e406..104d5babca 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/endian.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/endian.h @@ -66,6 +66,8 @@ #ifndef _I386__ENDIAN_H_ #define _I386__ENDIAN_H_ +#if defined (__i386__) || defined (__x86_64__) + #include /* * Define _NOQUAD if the compiler does NOT support 64-bit integers. @@ -99,4 +101,5 @@ #include #endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ +#endif /* defined (__i386__) || defined (__x86_64__) */ #endif /* !_I386__ENDIAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/limits.h b/lib/libc/include/x86_64-macos.13-none/i386/limits.h similarity index 97% rename from lib/libc/include/x86_64-macos.10-none/i386/limits.h rename to lib/libc/include/x86_64-macos.13-none/i386/limits.h index 651d770335..292e6bd654 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/limits.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/limits.h @@ -36,6 +36,8 @@ #ifndef _I386_LIMITS_H_ #define _I386_LIMITS_H_ +#if defined (__i386__) || defined (__x86_64__) + #include #include @@ -104,4 +106,6 @@ #endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */ #endif /* !_ANSI_SOURCE */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _I386_LIMITS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/param.h b/lib/libc/include/x86_64-macos.13-none/i386/param.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/i386/param.h rename to lib/libc/include/x86_64-macos.13-none/i386/param.h index e8eb8272e7..fe2bb9cc06 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/param.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/param.h @@ -72,6 +72,8 @@ #ifndef _I386_PARAM_H_ #define _I386_PARAM_H_ +#if defined (__i386__) || defined (__x86_64__) + #include /* @@ -168,4 +170,6 @@ #define DELAY(n) { int N = (n); while (--N > 0); } #endif /* defined(KERNEL) || defined(STANDALONE) */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _I386_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/signal.h b/lib/libc/include/x86_64-macos.13-none/i386/signal.h similarity index 93% rename from lib/libc/include/x86_64-macos.10-none/i386/signal.h rename to lib/libc/include/x86_64-macos.13-none/i386/signal.h index cd837bb7f6..e699c2b61b 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/signal.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/signal.h @@ -33,6 +33,8 @@ #ifndef _I386_SIGNAL_H_ #define _I386_SIGNAL_H_ 1 +#if defined (__i386__) || defined (__x86_64__) + #include #ifndef _ANSI_SOURCE @@ -40,4 +42,6 @@ typedef int sig_atomic_t; #endif /* ! _ANSI_SOURCE */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _I386_SIGNAL_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/i386/types.h b/lib/libc/include/x86_64-macos.13-none/i386/types.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/i386/types.h rename to lib/libc/include/x86_64-macos.13-none/i386/types.h index 00dee1a917..31ffa1f37c 100644 --- a/lib/libc/include/x86_64-macos.10-none/i386/types.h +++ b/lib/libc/include/x86_64-macos.13-none/i386/types.h @@ -63,9 +63,12 @@ * @(#)types.h 8.3 (Berkeley) 1/5/94 */ -#ifndef _MACHTYPES_H_ +#ifndef _I386_MACHTYPES_H_ +#define _I386_MACHTYPES_H_ #define _MACHTYPES_H_ +#if defined (__i386__) || defined (__x86_64__) + #ifndef __ASSEMBLER__ #include #include @@ -111,4 +114,5 @@ typedef int64_t user_off_t; typedef u_int64_t syscall_arg_t; #endif /* __ASSEMBLER__ */ -#endif /* _MACHTYPES_H_ */ \ No newline at end of file +#endif /* defined (__i386__) || defined (__x86_64__) */ +#endif /* _I386_MACHTYPES_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/pthread/sched.h b/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomic.h similarity index 56% rename from lib/libc/include/x86_64-macos.10-none/pthread/sched.h rename to lib/libc/include/x86_64-macos.13-none/libkern/OSAtomic.h index 3c49e7980d..37ef16ce44 100644 --- a/lib/libc/include/x86_64-macos.10-none/pthread/sched.h +++ b/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomic.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2016 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * + * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. - * + * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, @@ -17,27 +17,31 @@ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. - * + * * @APPLE_LICENSE_HEADER_END@ */ -#ifndef _SCHED_H_ -#define _SCHED_H_ +#ifndef _OSATOMIC_H_ +#define _OSATOMIC_H_ + +/*! @header + * These are deprecated legacy interfaces for atomic and synchronization + * operations. + * + * Define OSATOMIC_USE_INLINED=1 to get inline implementations of the + * OSAtomic interfaces in terms of the primitives. + * + * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of the + * OSSpinLock interfaces in terms of the primitives. + * + * These are intended as a transition convenience, direct use of those + * primitives should be preferred. + */ #include -#include -__BEGIN_DECLS -/* - * Scheduling paramters - */ -#ifndef __POSIX_LIB__ -struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; }; -#endif +#include "OSAtomicDeprecated.h" +#include "OSSpinLockDeprecated.h" +#include "OSAtomicQueue.h" -extern int sched_yield(void); -extern int sched_get_priority_min(int); -extern int sched_get_priority_max(int); -__END_DECLS - -#endif /* _SCHED_H_ */ \ No newline at end of file +#endif /* _OSATOMIC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomicDeprecated.h b/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomicDeprecated.h new file mode 100644 index 0000000000..6dc880b0d4 --- /dev/null +++ b/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomicDeprecated.h @@ -0,0 +1,1266 @@ +/* + * Copyright (c) 2004-2016 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _OSATOMIC_DEPRECATED_H_ +#define _OSATOMIC_DEPRECATED_H_ + +/*! @header + * These are deprecated legacy interfaces for atomic operations. + * The C11 interfaces in resp. C++11 interfaces in + * should be used instead. + * + * Define OSATOMIC_USE_INLINED=1 to get inline implementations of these + * interfaces in terms of the resp. primitives. + * This is intended as a transition convenience, direct use of those primitives + * is preferred. + */ + +#include + +#if !(defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED) + +#include +#include +#include +#include + +#ifndef OSATOMIC_DEPRECATED +#define OSATOMIC_DEPRECATED 1 +#ifndef __cplusplus +#define OSATOMIC_BARRIER_DEPRECATED_MSG(_r) \ + "Use " #_r "() from instead" +#define OSATOMIC_DEPRECATED_MSG(_r) \ + "Use " #_r "_explicit(memory_order_relaxed) from instead" +#else +#define OSATOMIC_BARRIER_DEPRECATED_MSG(_r) \ + "Use std::" #_r "() from instead" +#define OSATOMIC_DEPRECATED_MSG(_r) \ + "Use std::" #_r "_explicit(std::memory_order_relaxed) from instead" +#endif +#define OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(_r) \ + __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSATOMIC_BARRIER_DEPRECATED_MSG(_r)) +#define OSATOMIC_DEPRECATED_REPLACE_WITH(_r) \ + __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSATOMIC_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSATOMIC_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSATOMIC_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSATOMIC_DEPRECATED_MSG(_r)) +#else +#undef OSATOMIC_DEPRECATED +#define OSATOMIC_DEPRECATED 0 +#define OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(_r) +#define OSATOMIC_DEPRECATED_REPLACE_WITH(_r) +#endif + +/* + * WARNING: all addresses passed to these functions must be "naturally aligned", + * i.e. int32_t pointers must be 32-bit aligned (low 2 bits of + * address are zeroes), and int64_t pointers must be 64-bit + * aligned (low 3 bits of address are zeroes.). + * Note that this is not the default alignment of the int64_t type + * in the iOS ARMv7 ABI, see + * {@link //apple_ref/doc/uid/TP40009021-SW8 iPhoneOSABIReference} + * + * Note that some versions of the atomic functions incorporate memory barriers + * and some do not. Barriers strictly order memory access on weakly-ordered + * architectures such as ARM. All loads and stores that appear (in sequential + * program order) before the barrier are guaranteed to complete before any + * load or store that appears after the barrier. + * + * The barrier operation is typically a no-op on uniprocessor systems and + * fully enabled on multiprocessor systems. On some platforms, such as ARM, + * the barrier can be quite expensive. + * + * Most code should use the barrier functions to ensure that memory shared + * between threads is properly synchronized. For example, if you want to + * initialize a shared data structure and then atomically increment a variable + * to indicate that the initialization is complete, you must use + * {@link OSAtomicIncrement32Barrier} to ensure that the stores to your data + * structure complete before the atomic increment. + * + * Likewise, the consumer of that data structure must use + * {@link OSAtomicDecrement32Barrier}, + * in order to ensure that their loads of the structure are not executed before + * the atomic decrement. On the other hand, if you are simply incrementing a + * global counter, then it is safe and potentially faster to use + * {@link OSAtomicIncrement32}. + * + * If you are unsure which version to use, prefer the barrier variants as they + * are safer. + * + * For the kernel-space version of this header, see + * {@link //apple_ref/doc/header/OSAtomic.h OSAtomic.h (Kernel Framework)} + * + * @apiuid //apple_ref/doc/header/user_space_OSAtomic.h + */ + +__BEGIN_DECLS + +/*! @typedef OSAtomic_int64_aligned64_t + * 64-bit aligned int64_t type. + * Use for variables whose addresses are passed to OSAtomic*64() functions to + * get the compiler to generate the required alignment. + */ + +#if __has_attribute(aligned) +typedef int64_t __attribute__((__aligned__((sizeof(int64_t))))) + OSAtomic_int64_aligned64_t; +#else +typedef int64_t OSAtomic_int64_aligned64_t; +#endif + +/*! @group Arithmetic functions + All functions in this group return the new value. + */ + +/*! @abstract Atomically adds two 32-bit values. + @discussion + This function adds the value given by __theAmount to the + value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicAdd32( int32_t __theAmount, volatile int32_t *__theValue ); + + +/*! @abstract Atomically adds two 32-bit values. + @discussion + This function adds the value given by __theAmount to the + value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicAdd32} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicAdd32Barrier( int32_t __theAmount, volatile int32_t *__theValue ); + + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT + +/*! @abstract Atomically increments a 32-bit value. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int32_t OSAtomicIncrement32( volatile int32_t *__theValue ); + + +/*! @abstract Atomically increments a 32-bit value with a barrier. + @discussion + This function is equivalent to {@link OSAtomicIncrement32} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int32_t OSAtomicIncrement32Barrier( volatile int32_t *__theValue ); + + +/*! @abstract Atomically decrements a 32-bit value. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int32_t OSAtomicDecrement32( volatile int32_t *__theValue ); + + +/*! @abstract Atomically decrements a 32-bit value with a barrier. + @discussion + This function is equivalent to {@link OSAtomicDecrement32} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int32_t OSAtomicDecrement32Barrier( volatile int32_t *__theValue ); + +#else +__inline static +int32_t OSAtomicIncrement32( volatile int32_t *__theValue ) + { return OSAtomicAdd32( 1, __theValue); } + +__inline static +int32_t OSAtomicIncrement32Barrier( volatile int32_t *__theValue ) + { return OSAtomicAdd32Barrier( 1, __theValue); } + +__inline static +int32_t OSAtomicDecrement32( volatile int32_t *__theValue ) + { return OSAtomicAdd32( -1, __theValue); } + +__inline static +int32_t OSAtomicDecrement32Barrier( volatile int32_t *__theValue ) + { return OSAtomicAdd32Barrier( -1, __theValue); } +#endif + + +/*! @abstract Atomically adds two 64-bit values. + @discussion + This function adds the value given by __theAmount to the + value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int64_t OSAtomicAdd64( int64_t __theAmount, + volatile OSAtomic_int64_aligned64_t *__theValue ); + + +/*! @abstract Atomically adds two 64-bit values with a barrier. + @discussion + This function adds the value given by __theAmount to the + value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicAdd64} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_3_2) +int64_t OSAtomicAdd64Barrier( int64_t __theAmount, + volatile OSAtomic_int64_aligned64_t *__theValue ); + + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT + +/*! @abstract Atomically increments a 64-bit value. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int64_t OSAtomicIncrement64( volatile OSAtomic_int64_aligned64_t *__theValue ); + + +/*! @abstract Atomically increments a 64-bit value with a barrier. + @discussion + This function is equivalent to {@link OSAtomicIncrement64} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_add) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int64_t OSAtomicIncrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ); + + +/*! @abstract Atomically decrements a 64-bit value. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int64_t OSAtomicDecrement64( volatile OSAtomic_int64_aligned64_t *__theValue ); + + +/*! @abstract Atomically decrements a 64-bit value with a barrier. + @discussion + This function is equivalent to {@link OSAtomicDecrement64} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_sub) +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_1) +int64_t OSAtomicDecrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ); + +#else +__inline static +int64_t OSAtomicIncrement64( volatile OSAtomic_int64_aligned64_t *__theValue ) + { return OSAtomicAdd64( 1, __theValue); } + +__inline static +int64_t OSAtomicIncrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ) + { return OSAtomicAdd64Barrier( 1, __theValue); } + +__inline static +int64_t OSAtomicDecrement64( volatile OSAtomic_int64_aligned64_t *__theValue ) + { return OSAtomicAdd64( -1, __theValue); } + +__inline static +int64_t OSAtomicDecrement64Barrier( volatile OSAtomic_int64_aligned64_t *__theValue ) + { return OSAtomicAdd64Barrier( -1, __theValue); } +#endif + + +/*! @group Boolean functions (AND, OR, XOR) + * + * @discussion Functions in this group come in four variants for each operation: + * with and without barriers, and functions that return the original value or + * the result value of the operation. + * + * The "Orig" versions return the original value, (before the operation); the non-Orig + * versions return the value after the operation. All are layered on top of + * {@link OSAtomicCompareAndSwap32} and similar. + */ + +/*! @abstract Atomic bitwise OR of two 32-bit values. + @discussion + This function performs the bitwise OR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_or) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicOr32( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise OR of two 32-bit values with barrier. + @discussion + This function performs the bitwise OR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicOr32} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_or) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicOr32Barrier( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise OR of two 32-bit values returning original. + @discussion + This function performs the bitwise OR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the original value referenced by __theValue. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_or) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) +int32_t OSAtomicOr32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise OR of two 32-bit values returning original with barrier. + @discussion + This function performs the bitwise OR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicOr32Orig} + except that it also introduces a barrier. + @result Returns the original value referenced by __theValue. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_or) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) +int32_t OSAtomicOr32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue ); + + + + +/*! @abstract Atomic bitwise AND of two 32-bit values. + @discussion + This function performs the bitwise AND of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_and) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicAnd32( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise AND of two 32-bit values with barrier. + @discussion + This function performs the bitwise AND of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicAnd32} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicAnd32Barrier( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise AND of two 32-bit values returning original. + @discussion + This function performs the bitwise AND of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the original value referenced by __theValue. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_and) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) +int32_t OSAtomicAnd32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise AND of two 32-bit values returning original with barrier. + @discussion + This function performs the bitwise AND of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicAnd32Orig} + except that it also introduces a barrier. + @result Returns the original value referenced by __theValue. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) +int32_t OSAtomicAnd32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue ); + + + + +/*! @abstract Atomic bitwise XOR of two 32-bit values. + @discussion + This function performs the bitwise XOR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the new value. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicXor32( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise XOR of two 32-bit values with barrier. + @discussion + This function performs the bitwise XOR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicXor32} + except that it also introduces a barrier. + @result Returns the new value. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +int32_t OSAtomicXor32Barrier( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise XOR of two 32-bit values returning original. + @discussion + This function performs the bitwise XOR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + @result Returns the original value referenced by __theValue. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) +int32_t OSAtomicXor32Orig( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @abstract Atomic bitwise XOR of two 32-bit values returning original with barrier. + @discussion + This function performs the bitwise XOR of the value given by __theMask + with the value in the memory location referenced by __theValue, + storing the result back to that memory location atomically. + + This function is equivalent to {@link OSAtomicXor32Orig} + except that it also introduces a barrier. + @result Returns the original value referenced by __theValue. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_xor) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2) +int32_t OSAtomicXor32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue ); + + +/*! @group Compare and swap + * Functions in this group return true if the swap occured. There are several versions, + * depending on data type and on whether or not a barrier is used. + */ + + +/*! @abstract Compare and swap for 32-bit values. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSAtomicCompareAndSwap32( int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue ); + + +/*! @abstract Compare and swap for 32-bit values with barrier. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + + This function is equivalent to {@link OSAtomicCompareAndSwap32} + except that it also introduces a barrier. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSAtomicCompareAndSwap32Barrier( int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue ); + + +/*! @abstract Compare and swap pointers. + @discussion + This function compares the pointer stored in __oldValue to the pointer + in the memory location referenced by __theValue. If the pointers + match, this function stores the pointer from __newValue into + that memory location atomically. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) +bool OSAtomicCompareAndSwapPtr( void *__oldValue, void *__newValue, void * volatile *__theValue ); + + +/*! @abstract Compare and swap pointers with barrier. + @discussion + This function compares the pointer stored in __oldValue to the pointer + in the memory location referenced by __theValue. If the pointers + match, this function stores the pointer from __newValue into + that memory location atomically. + + This function is equivalent to {@link OSAtomicCompareAndSwapPtr} + except that it also introduces a barrier. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) +bool OSAtomicCompareAndSwapPtrBarrier( void *__oldValue, void *__newValue, void * volatile *__theValue ); + + +/*! @abstract Compare and swap for int values. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + + This function is equivalent to {@link OSAtomicCompareAndSwap32}. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) +bool OSAtomicCompareAndSwapInt( int __oldValue, int __newValue, volatile int *__theValue ); + + +/*! @abstract Compare and swap for int values. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + + This function is equivalent to {@link OSAtomicCompareAndSwapInt} + except that it also introduces a barrier. + + This function is equivalent to {@link OSAtomicCompareAndSwap32Barrier}. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) +bool OSAtomicCompareAndSwapIntBarrier( int __oldValue, int __newValue, volatile int *__theValue ); + + +/*! @abstract Compare and swap for long values. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + + This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, + or {@link OSAtomicCompareAndSwap64} on 64-bit architectures. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) +bool OSAtomicCompareAndSwapLong( long __oldValue, long __newValue, volatile long *__theValue ); + + +/*! @abstract Compare and swap for long values. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + + This function is equivalent to {@link OSAtomicCompareAndSwapLong} + except that it also introduces a barrier. + + This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures, + or {@link OSAtomicCompareAndSwap64} on 64-bit architectures. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) +bool OSAtomicCompareAndSwapLongBarrier( long __oldValue, long __newValue, volatile long *__theValue ); + + +/*! @abstract Compare and swap for uint64_t values. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, + volatile OSAtomic_int64_aligned64_t *__theValue ); + + +/*! @abstract Compare and swap for uint64_t values. + @discussion + This function compares the value in __oldValue to the value + in the memory location referenced by __theValue. If the values + match, this function stores the value from __newValue into + that memory location atomically. + + This function is equivalent to {@link OSAtomicCompareAndSwap64} + except that it also introduces a barrier. + @result Returns TRUE on a match, FALSE otherwise. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_compare_exchange_strong) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_3_2) +bool OSAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, + volatile OSAtomic_int64_aligned64_t *__theValue ); + + +/* Test and set. + * They return the original value of the bit, and operate on bit (0x80>>(n&7)) + * in byte ((char*)theAddress + (n>>3)). + */ +/*! @abstract Atomic test and set + @discussion + This function tests a bit in the value referenced by + __theAddress and if it is not set, sets it. + + The bit is chosen by the value of __n such that the + operation will be performed on bit (0x80 >> (__n & 7)) + of byte ((char *)__theAddress + (n >> 3)). + + For example, if __theAddress points to a 64-bit value, + to compare the value of the most significant bit, you would specify + 56 for __n. + @result + Returns the original value of the bit being tested. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_or) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSAtomicTestAndSet( uint32_t __n, volatile void *__theAddress ); + + +/*! @abstract Atomic test and set with barrier + @discussion + This function tests a bit in the value referenced by __theAddress + and if it is not set, sets it. + + The bit is chosen by the value of __n such that the + operation will be performed on bit (0x80 >> (__n & 7)) + of byte ((char *)__theAddress + (n >> 3)). + + For example, if __theAddress points to a 64-bit value, + to compare the value of the most significant bit, you would specify + 56 for __n. + + This function is equivalent to {@link OSAtomicTestAndSet} + except that it also introduces a barrier. + @result + Returns the original value of the bit being tested. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_or) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSAtomicTestAndSetBarrier( uint32_t __n, volatile void *__theAddress ); + + + +/*! @abstract Atomic test and clear + @discussion + This function tests a bit in the value referenced by __theAddress + and if it is not cleared, clears it. + + The bit is chosen by the value of __n such that the + operation will be performed on bit (0x80 >> (__n & 7)) + of byte ((char *)__theAddress + (n >> 3)). + + For example, if __theAddress points to a 64-bit value, + to compare the value of the most significant bit, you would specify + 56 for __n. + + @result + Returns the original value of the bit being tested. + */ +OSATOMIC_DEPRECATED_REPLACE_WITH(atomic_fetch_and) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress ); + + +/*! @abstract Atomic test and clear + @discussion + This function tests a bit in the value referenced by __theAddress + and if it is not cleared, clears it. + + The bit is chosen by the value of __n such that the + operation will be performed on bit (0x80 >> (__n & 7)) + of byte ((char *)__theAddress + (n >> 3)). + + For example, if __theAddress points to a 64-bit value, + to compare the value of the most significant bit, you would specify + 56 for __n. + + This function is equivalent to {@link OSAtomicTestAndSet} + except that it also introduces a barrier. + @result + Returns the original value of the bit being tested. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSAtomicTestAndClearBarrier( uint32_t __n, volatile void *__theAddress ); + + +/*! @group Memory barriers */ + +/*! @abstract Memory barrier. + @discussion + This function serves as both a read and write barrier. + */ +OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_thread_fence) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +void OSMemoryBarrier( void ); + +__END_DECLS + +#else // defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED + +/* + * Inline implementations of the legacy OSAtomic interfaces in terms of + * C11 resp. C++11 primitives. + * Direct use of those primitives is preferred. + */ + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C++" { +#if !(__has_include() && __has_extension(cxx_atomic)) +#error Cannot use inlined OSAtomic without and C++11 atomics +#endif +#include +typedef std::atomic _OSAtomic_uint8_t; +typedef std::atomic _OSAtomic_int32_t; +typedef std::atomic _OSAtomic_uint32_t; +typedef std::atomic _OSAtomic_int64_t; +typedef std::atomic _OSAtomic_void_ptr_t; +#define OSATOMIC_STD(_a) std::_a +__BEGIN_DECLS +#else +#if !(__has_include() && __has_extension(c_atomic)) +#error Cannot use inlined OSAtomic without and C11 atomics +#endif +#include +typedef _Atomic(uint8_t) _OSAtomic_uint8_t; +typedef _Atomic(int32_t) _OSAtomic_int32_t; +typedef _Atomic(uint32_t) _OSAtomic_uint32_t; +typedef _Atomic(int64_t) _OSAtomic_int64_t; +typedef _Atomic(void*) _OSAtomic_void_ptr_t; +#define OSATOMIC_STD(_a) _a +#endif + +#if __has_extension(c_alignof) && __has_attribute(aligned) +typedef int64_t __attribute__((__aligned__(_Alignof(_OSAtomic_int64_t)))) + OSAtomic_int64_aligned64_t; +#elif __has_attribute(aligned) +typedef int64_t __attribute__((__aligned__((sizeof(_OSAtomic_int64_t))))) + OSAtomic_int64_aligned64_t; +#else +typedef int64_t OSAtomic_int64_aligned64_t; +#endif + +#if __has_attribute(always_inline) +#define OSATOMIC_INLINE static __inline __attribute__((__always_inline__)) +#else +#define OSATOMIC_INLINE static __inline +#endif + +OSATOMIC_INLINE +int32_t +OSAtomicAdd32(int32_t __theAmount, volatile int32_t *__theValue) +{ + return (OSATOMIC_STD(atomic_fetch_add_explicit)( + (volatile _OSAtomic_int32_t*) __theValue, __theAmount, + OSATOMIC_STD(memory_order_relaxed)) + __theAmount); +} + +OSATOMIC_INLINE +int32_t +OSAtomicAdd32Barrier(int32_t __theAmount, volatile int32_t *__theValue) +{ + return (OSATOMIC_STD(atomic_fetch_add_explicit)( + (volatile _OSAtomic_int32_t*) __theValue, __theAmount, + OSATOMIC_STD(memory_order_seq_cst)) + __theAmount); +} + +OSATOMIC_INLINE +int32_t +OSAtomicIncrement32(volatile int32_t *__theValue) +{ + return OSAtomicAdd32(1, __theValue); +} + +OSATOMIC_INLINE +int32_t +OSAtomicIncrement32Barrier(volatile int32_t *__theValue) +{ + return OSAtomicAdd32Barrier(1, __theValue); +} + +OSATOMIC_INLINE +int32_t +OSAtomicDecrement32(volatile int32_t *__theValue) +{ + return OSAtomicAdd32(-1, __theValue); +} + +OSATOMIC_INLINE +int32_t +OSAtomicDecrement32Barrier(volatile int32_t *__theValue) +{ + return OSAtomicAdd32Barrier(-1, __theValue); +} + +OSATOMIC_INLINE +int64_t +OSAtomicAdd64(int64_t __theAmount, + volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return (OSATOMIC_STD(atomic_fetch_add_explicit)( + (volatile _OSAtomic_int64_t*) __theValue, __theAmount, + OSATOMIC_STD(memory_order_relaxed)) + __theAmount); +} + +OSATOMIC_INLINE +int64_t +OSAtomicAdd64Barrier(int64_t __theAmount, + volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return (OSATOMIC_STD(atomic_fetch_add_explicit)( + (volatile _OSAtomic_int64_t*) __theValue, __theAmount, + OSATOMIC_STD(memory_order_seq_cst)) + __theAmount); +} + +OSATOMIC_INLINE +int64_t +OSAtomicIncrement64(volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return OSAtomicAdd64(1, __theValue); +} + +OSATOMIC_INLINE +int64_t +OSAtomicIncrement64Barrier(volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return OSAtomicAdd64Barrier(1, __theValue); +} + +OSATOMIC_INLINE +int64_t +OSAtomicDecrement64(volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return OSAtomicAdd64(-1, __theValue); +} + +OSATOMIC_INLINE +int64_t +OSAtomicDecrement64Barrier(volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return OSAtomicAdd64Barrier(-1, __theValue); +} + +OSATOMIC_INLINE +int32_t +OSAtomicOr32(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_relaxed)) | __theMask); +} + +OSATOMIC_INLINE +int32_t +OSAtomicOr32Barrier(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_seq_cst)) | __theMask); +} + +OSATOMIC_INLINE +int32_t +OSAtomicOr32Orig(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +int32_t +OSAtomicOr32OrigBarrier(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_or_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_seq_cst))); +} + +OSATOMIC_INLINE +int32_t +OSAtomicAnd32(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_relaxed)) & __theMask); +} + +OSATOMIC_INLINE +int32_t +OSAtomicAnd32Barrier(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_seq_cst)) & __theMask); +} + +OSATOMIC_INLINE +int32_t +OSAtomicAnd32Orig(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +int32_t +OSAtomicAnd32OrigBarrier(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_and_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_seq_cst))); +} + +OSATOMIC_INLINE +int32_t +OSAtomicXor32(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_relaxed)) ^ __theMask); +} + +OSATOMIC_INLINE +int32_t +OSAtomicXor32Barrier(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_seq_cst)) ^ __theMask); +} + +OSATOMIC_INLINE +int32_t +OSAtomicXor32Orig(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +int32_t +OSAtomicXor32OrigBarrier(uint32_t __theMask, volatile uint32_t *__theValue) +{ + return (int32_t)(OSATOMIC_STD(atomic_fetch_xor_explicit)( + (volatile _OSAtomic_uint32_t*)__theValue, __theMask, + OSATOMIC_STD(memory_order_seq_cst))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwap32(int32_t __oldValue, int32_t __newValue, + volatile int32_t *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile _OSAtomic_int32_t*)__theValue, &__oldValue, __newValue, + OSATOMIC_STD(memory_order_relaxed), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwap32Barrier(int32_t __oldValue, int32_t __newValue, + volatile int32_t *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile _OSAtomic_int32_t*)__theValue, &__oldValue, __newValue, + OSATOMIC_STD(memory_order_seq_cst), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwapPtr(void *__oldValue, void *__newValue, + void * volatile *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile _OSAtomic_void_ptr_t*)__theValue, &__oldValue, __newValue, + OSATOMIC_STD(memory_order_relaxed), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwapPtrBarrier(void *__oldValue, void *__newValue, + void * volatile *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile _OSAtomic_void_ptr_t*)__theValue, &__oldValue, __newValue, + OSATOMIC_STD(memory_order_seq_cst), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwapInt(int __oldValue, int __newValue, + volatile int *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile OSATOMIC_STD(atomic_int)*)__theValue, &__oldValue, + __newValue, OSATOMIC_STD(memory_order_relaxed), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwapIntBarrier(int __oldValue, int __newValue, + volatile int *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile OSATOMIC_STD(atomic_int)*)__theValue, &__oldValue, + __newValue, OSATOMIC_STD(memory_order_seq_cst), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwapLong(long __oldValue, long __newValue, + volatile long *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile OSATOMIC_STD(atomic_long)*)__theValue, &__oldValue, + __newValue, OSATOMIC_STD(memory_order_relaxed), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwapLongBarrier(long __oldValue, long __newValue, + volatile long *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile OSATOMIC_STD(atomic_long)*)__theValue, &__oldValue, + __newValue, OSATOMIC_STD(memory_order_seq_cst), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwap64(int64_t __oldValue, int64_t __newValue, + volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile _OSAtomic_int64_t*)__theValue, &__oldValue, __newValue, + OSATOMIC_STD(memory_order_relaxed), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicCompareAndSwap64Barrier(int64_t __oldValue, int64_t __newValue, + volatile OSAtomic_int64_aligned64_t *__theValue) +{ + return (OSATOMIC_STD(atomic_compare_exchange_strong_explicit)( + (volatile _OSAtomic_int64_t*)__theValue, &__oldValue, __newValue, + OSATOMIC_STD(memory_order_seq_cst), + OSATOMIC_STD(memory_order_relaxed))); +} + +OSATOMIC_INLINE +bool +OSAtomicTestAndSet(uint32_t __n, volatile void *__theAddress) +{ + uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); + uint8_t v = (0x80u >> (__n & 7)); + return (OSATOMIC_STD(atomic_fetch_or_explicit)((_OSAtomic_uint8_t*)a, v, + OSATOMIC_STD(memory_order_relaxed)) & v); +} + +OSATOMIC_INLINE +bool +OSAtomicTestAndSetBarrier(uint32_t __n, volatile void *__theAddress) +{ + uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); + uint8_t v = (0x80u >> (__n & 7)); + return (OSATOMIC_STD(atomic_fetch_or_explicit)((_OSAtomic_uint8_t*)a, v, + OSATOMIC_STD(memory_order_seq_cst)) & v); +} + +OSATOMIC_INLINE +bool +OSAtomicTestAndClear(uint32_t __n, volatile void *__theAddress) +{ + uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); + uint8_t v = (0x80u >> (__n & 7)); + return (OSATOMIC_STD(atomic_fetch_and_explicit)((_OSAtomic_uint8_t*)a, + (uint8_t)~v, OSATOMIC_STD(memory_order_relaxed)) & v); +} + +OSATOMIC_INLINE +bool +OSAtomicTestAndClearBarrier(uint32_t __n, volatile void *__theAddress) +{ + uintptr_t a = (uintptr_t)__theAddress + (__n >> 3); + uint8_t v = (0x80u >> (__n & 7)); + return (OSATOMIC_STD(atomic_fetch_and_explicit)((_OSAtomic_uint8_t*)a, + (uint8_t)~v, OSATOMIC_STD(memory_order_seq_cst)) & v); +} + +OSATOMIC_INLINE +void +OSMemoryBarrier(void) +{ + OSATOMIC_STD(atomic_thread_fence)(OSATOMIC_STD(memory_order_seq_cst)); +} + +#undef OSATOMIC_INLINE +#undef OSATOMIC_STD +#ifdef __cplusplus +__END_DECLS +} // extern "C++" +#endif + +#endif // defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED + +#if TARGET_OS_OSX || TARGET_OS_DRIVERKIT + +__BEGIN_DECLS + +/*! @group Lockless atomic fifo enqueue and dequeue + * These routines manipulate singly-linked FIFO lists. + * + * This API is deprecated and no longer recommended + */ + +/*! @abstract The data structure for a fifo queue head. + @discussion + You should always initialize a fifo queue head structure with the + initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use. + */ +#if defined(__LP64__) + +typedef volatile struct { + void *opaque1; + void *opaque2; + int opaque3; +} __attribute__ ((aligned (16))) OSFifoQueueHead; + +#else + +typedef volatile struct { + void *opaque1; + void *opaque2; + int opaque3; +} OSFifoQueueHead; + +#endif +/*! @abstract The initialization vector for a fifo queue head. */ +#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, NULL, 0 } + +/*! @abstract Enqueue an element onto a list. + @discussion + Memory barriers are incorporated as needed to permit thread-safe access + to the queue element. + @param __list + The list on which you want to enqueue the element. + @param __new + The element to add. + @param __offset + The "offset" parameter is the offset (in bytes) of the link field + from the beginning of the data structure being queued (__new). + The link field should be a pointer type. + The __offset value needs to be same for all enqueuing and + dequeuing operations on the same list, even if different structure types + are enqueued on that list. The use of offsetset(), defined in + stddef.h is the common way to specify the __offset + value. + + @note + This API is deprecated and no longer recommended + */ +__API_DEPRECATED("No longer supported", macos(10.7, 11.0)) +void OSAtomicFifoEnqueue( OSFifoQueueHead *__list, void *__new, size_t __offset); + +/*! @abstract Dequeue an element from a list. + @discussion + Memory barriers are incorporated as needed to permit thread-safe access + to the queue element. + @param __list + The list from which you want to dequeue an element. + @param __offset + The "offset" parameter is the offset (in bytes) of the link field + from the beginning of the data structure being dequeued (__new). + The link field should be a pointer type. + The __offset value needs to be same for all enqueuing and + dequeuing operations on the same list, even if different structure types + are enqueued on that list. The use of offsetset(), defined in + stddef.h is the common way to specify the __offset + value. + @result + Returns the oldest enqueued element, or NULL if the + list is empty. + + @note + This API is deprecated and no longer recommended + */ +__API_DEPRECATED("No longer supported", macos(10.7, 11.0)) +void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset); + +__END_DECLS + +#endif /* TARGET_OS_OSX || TARGET_OS_DRIVERKIT */ + +#endif /* _OSATOMIC_DEPRECATED_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomicQueue.h b/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomicQueue.h new file mode 100644 index 0000000000..66033fc834 --- /dev/null +++ b/lib/libc/include/x86_64-macos.13-none/libkern/OSAtomicQueue.h @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2004-2016 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _OSATOMICQUEUE_H_ +#define _OSATOMICQUEUE_H_ + +#include +#include +#include +#include +#include "OSAtomicDeprecated.h" + +#include + +/*! @header Lockless atomic enqueue and dequeue + * These routines manipulate singly-linked LIFO lists. + */ + +__BEGIN_DECLS + +/*! @abstract The data structure for a queue head. + @discussion + You should always initialize a queue head structure with the + initialization vector {@link OS_ATOMIC_QUEUE_INIT} before use. + */ +#if defined(__LP64__) + +typedef volatile struct { + void *opaque1; + long opaque2; +} __attribute__ ((aligned (16))) OSQueueHead; + +#else + +typedef volatile struct { + void *opaque1; + long opaque2; +} OSQueueHead; + +#endif + +/*! @abstract The initialization vector for a queue head. */ +#define OS_ATOMIC_QUEUE_INIT { NULL, 0 } + +/*! @abstract Enqueue an element onto a list. + @discussion + Memory barriers are incorporated as needed to permit thread-safe access + to the queue element. + @param __list + The list on which you want to enqueue the element. + @param __new + The element to add. + @param __offset + The "offset" parameter is the offset (in bytes) of the link field + from the beginning of the data structure being queued (__new). + The link field should be a pointer type. + The __offset value needs to be same for all enqueuing and + dequeuing operations on the same list, even if different structure types + are enqueued on that list. The use of offsetset(), defined in + stddef.h is the common way to specify the __offset + value. + */ +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0) +void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset); + + +/*! @abstract Dequeue an element from a list. + @discussion + Memory barriers are incorporated as needed to permit thread-safe access + to the queue element. + @param __list + The list from which you want to dequeue an element. + @param __offset + The "offset" parameter is the offset (in bytes) of the link field + from the beginning of the data structure being dequeued (__new). + The link field should be a pointer type. + The __offset value needs to be same for all enqueuing and + dequeuing operations on the same list, even if different structure types + are enqueued on that list. The use of offsetset(), defined in + stddef.h is the common way to specify the __offset + value. + IMPORTANT: the memory backing the link field of a queue element must not be + unmapped after OSAtomicDequeue() returns until all concurrent calls to + OSAtomicDequeue() for the same list on other threads have also returned, + as they may still be accessing that memory location. + @result + Returns the most recently enqueued element, or NULL if the + list is empty. + */ +__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0) +void* OSAtomicDequeue( OSQueueHead *__list, size_t __offset); + +__END_DECLS + +#endif /* _OSATOMICQUEUE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.13-none/libkern/OSSpinLockDeprecated.h b/lib/libc/include/x86_64-macos.13-none/libkern/OSSpinLockDeprecated.h new file mode 100644 index 0000000000..a654a7bbc2 --- /dev/null +++ b/lib/libc/include/x86_64-macos.13-none/libkern/OSSpinLockDeprecated.h @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2004-2016 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _OSSPINLOCK_DEPRECATED_H_ +#define _OSSPINLOCK_DEPRECATED_H_ + +/*! @header + * These are deprecated legacy interfaces for userspace spinlocks. + * + * These interfaces should no longer be used, particularily in situations where + * threads of differing priorities may contend on the same spinlock. + * + * The interfaces in should be used instead in cases where a very + * low-level lock primitive is required. In general however, using higher level + * synchronization primitives such as those provided by the pthread or dispatch + * subsystems should be preferred. + * + * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of these + * interfaces in terms of the primitives. This is intended as a + * transition convenience, direct use of those primitives is preferred. + */ + +#ifndef OSSPINLOCK_DEPRECATED +#define OSSPINLOCK_DEPRECATED 1 +#define OSSPINLOCK_DEPRECATED_MSG(_r) "Use " #_r "() from instead" +#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) \ + __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSSPINLOCK_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \ + __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSSPINLOCK_DEPRECATED_MSG(_r)) +#else +#undef OSSPINLOCK_DEPRECATED +#define OSSPINLOCK_DEPRECATED 0 +#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) +#endif + +#if !(defined(OSSPINLOCK_USE_INLINED) && OSSPINLOCK_USE_INLINED) + +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +/*! @abstract The default value for an OSSpinLock. + @discussion + The convention is that unlocked is zero, locked is nonzero. + */ +#define OS_SPINLOCK_INIT 0 + + +/*! @abstract Data type for a spinlock. + @discussion + You should always initialize a spinlock to {@link OS_SPINLOCK_INIT} before + using it. + */ +typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock); + + +/*! @abstract Locks a spinlock if it would not block + @result + Returns false if the lock was already held by another thread, + true if it took the lock successfully. + */ +OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +bool OSSpinLockTry( volatile OSSpinLock *__lock ); + + +/*! @abstract Locks a spinlock + @discussion + Although the lock operation spins, it employs various strategies to back + off if the lock is held. + */ +OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +void OSSpinLockLock( volatile OSSpinLock *__lock ); + + +/*! @abstract Unlocks a spinlock */ +OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock) +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +void OSSpinLockUnlock( volatile OSSpinLock *__lock ); + +__END_DECLS + +#else /* OSSPINLOCK_USE_INLINED */ + +/* + * Inline implementations of the legacy OSSpinLock interfaces in terms of the + * of the primitives. Direct use of those primitives is preferred. + * + * NOTE: the locked value of os_unfair_lock is implementation defined and + * subject to change, code that relies on the specific locked value used by the + * legacy OSSpinLock interface WILL break when using these inline + * implementations in terms of os_unfair_lock. + */ + +#if !OSSPINLOCK_USE_INLINED_TRANSPARENT + +#include + +__BEGIN_DECLS + +#if __has_attribute(always_inline) +#define OSSPINLOCK_INLINE static __inline +#else +#define OSSPINLOCK_INLINE static __inline __attribute__((__always_inline__)) +#endif + +#define OS_SPINLOCK_INIT 0 +typedef int32_t OSSpinLock; + +#if __has_extension(c_static_assert) +_Static_assert(sizeof(OSSpinLock) == sizeof(os_unfair_lock), + "Incompatible os_unfair_lock type"); +#endif + +OSSPINLOCK_INLINE +void +OSSpinLockLock(volatile OSSpinLock *__lock) +{ + os_unfair_lock_t lock = (os_unfair_lock_t)__lock; + return os_unfair_lock_lock(lock); +} + +OSSPINLOCK_INLINE +bool +OSSpinLockTry(volatile OSSpinLock *__lock) +{ + os_unfair_lock_t lock = (os_unfair_lock_t)__lock; + return os_unfair_lock_trylock(lock); +} + +OSSPINLOCK_INLINE +void +OSSpinLockUnlock(volatile OSSpinLock *__lock) +{ + os_unfair_lock_t lock = (os_unfair_lock_t)__lock; + return os_unfair_lock_unlock(lock); +} + +#undef OSSPINLOCK_INLINE + +__END_DECLS + +#else /* OSSPINLOCK_USE_INLINED_TRANSPARENT */ + +#include +#include +#include +#include +#include + +#define OS_NOSPIN_LOCK_AVAILABILITY \ + __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) \ + __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) + +__BEGIN_DECLS + +#define OS_SPINLOCK_INIT 0 +typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock); +typedef volatile OSSpinLock *_os_nospin_lock_t + OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_t); + +OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock) +OS_NOSPIN_LOCK_AVAILABILITY +void _os_nospin_lock_lock(_os_nospin_lock_t lock); +#undef OSSpinLockLock +#define OSSpinLockLock(lock) _os_nospin_lock_lock(lock) + +OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock) +OS_NOSPIN_LOCK_AVAILABILITY +bool _os_nospin_lock_trylock(_os_nospin_lock_t lock); +#undef OSSpinLockTry +#define OSSpinLockTry(lock) _os_nospin_lock_trylock(lock) + +OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock) +OS_NOSPIN_LOCK_AVAILABILITY +void _os_nospin_lock_unlock(_os_nospin_lock_t lock); +#undef OSSpinLockUnlock +#define OSSpinLockUnlock(lock) _os_nospin_lock_unlock(lock) + +__END_DECLS + +#endif /* OSSPINLOCK_USE_INLINED_TRANSPARENT */ + +#endif /* OSSPINLOCK_USE_INLINED */ + +#endif /* _OSSPINLOCK_DEPRECATED_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/i386/OSByteOrder.h b/lib/libc/include/x86_64-macos.13-none/libkern/i386/OSByteOrder.h similarity index 100% rename from lib/libc/include/x86_64-macos.10-none/libkern/i386/OSByteOrder.h rename to lib/libc/include/x86_64-macos.13-none/libkern/i386/OSByteOrder.h diff --git a/lib/libc/include/x86_64-macos.10-none/libkern/i386/_OSByteOrder.h b/lib/libc/include/x86_64-macos.13-none/libkern/i386/_OSByteOrder.h similarity index 100% rename from lib/libc/include/x86_64-macos.10-none/libkern/i386/_OSByteOrder.h rename to lib/libc/include/x86_64-macos.13-none/libkern/i386/_OSByteOrder.h diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/_structs.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/_structs.h similarity index 94% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/_structs.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/_structs.h index f041af9f3f..02c135184f 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/_structs.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/_structs.h @@ -32,6 +32,8 @@ #ifndef _MACH_I386__STRUCTS_H_ #define _MACH_I386__STRUCTS_H_ +#if defined (__i386__) || defined (__x86_64__) + #include /* __DARWIN_UNIX03 */ #include /* __uint8_t */ @@ -603,7 +605,48 @@ _STRUCT_X86_DEBUG_STATE32 unsigned int __dr6; unsigned int __dr7; }; + +#define _STRUCT_X86_INSTRUCTION_STATE struct __x86_instruction_state +_STRUCT_X86_INSTRUCTION_STATE +{ + int __insn_stream_valid_bytes; + int __insn_offset; + int __out_of_synch; /* + * non-zero when the cacheline that includes the insn_offset + * is replaced in the insn_bytes array due to a mismatch + * detected when comparing it with the same cacheline in memory + */ +#define _X86_INSTRUCTION_STATE_MAX_INSN_BYTES (2448 - 64 - 4) + __uint8_t __insn_bytes[_X86_INSTRUCTION_STATE_MAX_INSN_BYTES]; +#define _X86_INSTRUCTION_STATE_CACHELINE_SIZE 64 + __uint8_t __insn_cacheline[_X86_INSTRUCTION_STATE_CACHELINE_SIZE]; +}; + +#define _STRUCT_LAST_BRANCH_RECORD struct __last_branch_record +_STRUCT_LAST_BRANCH_RECORD +{ + __uint64_t __from_ip; + __uint64_t __to_ip; + __uint32_t __mispredict : 1, + __tsx_abort : 1, + __in_tsx : 1, + __cycle_count: 16, + __reserved : 13; +}; + +#define _STRUCT_LAST_BRANCH_STATE struct __last_branch_state +_STRUCT_LAST_BRANCH_STATE +{ + int __lbr_count; + __uint32_t __lbr_supported_tsx : 1, + __lbr_supported_cycle_count : 1, + __reserved : 30; +#define __LASTBRANCH_MAX 32 + _STRUCT_LAST_BRANCH_RECORD __lbrs[__LASTBRANCH_MAX]; +}; + #else /* !__DARWIN_UNIX03 */ + #define _STRUCT_X86_DEBUG_STATE32 struct x86_debug_state32 _STRUCT_X86_DEBUG_STATE32 { @@ -616,6 +659,45 @@ _STRUCT_X86_DEBUG_STATE32 unsigned int dr6; unsigned int dr7; }; + +#define _STRUCT_X86_INSTRUCTION_STATE struct __x86_instruction_state +_STRUCT_X86_INSTRUCTION_STATE +{ + int insn_stream_valid_bytes; + int insn_offset; + int out_of_synch; /* + * non-zero when the cacheline that includes the insn_offset + * is replaced in the insn_bytes array due to a mismatch + * detected when comparing it with the same cacheline in memory + */ +#define x86_INSTRUCTION_STATE_MAX_INSN_BYTES (2448 - 64 - 4) + __uint8_t insn_bytes[x86_INSTRUCTION_STATE_MAX_INSN_BYTES]; +#define x86_INSTRUCTION_STATE_CACHELINE_SIZE 64 + __uint8_t insn_cacheline[x86_INSTRUCTION_STATE_CACHELINE_SIZE]; +}; + +#define _STRUCT_LAST_BRANCH_RECORD struct __last_branch_record +_STRUCT_LAST_BRANCH_RECORD +{ + __uint64_t from_ip; + __uint64_t to_ip; + __uint32_t mispredict : 1, + tsx_abort : 1, + in_tsx : 1, + cycle_count: 16, + reserved : 13; +}; + +#define _STRUCT_LAST_BRANCH_STATE struct __last_branch_state +_STRUCT_LAST_BRANCH_STATE +{ + int lbr_count; + __uint32_t lbr_supported_tsx : 1, + lbr_supported_cycle_count : 1, + reserved : 30; +#define __LASTBRANCH_MAX 32 + _STRUCT_LAST_BRANCH_RECORD lbrs[__LASTBRANCH_MAX]; +}; #endif /* !__DARWIN_UNIX03 */ #define _STRUCT_X86_PAGEIN_STATE struct __x86_pagein_state @@ -1229,4 +1311,6 @@ _STRUCT_X86_CPMU_STATE64 }; #endif /* !__DARWIN_UNIX03 */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386__STRUCTS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/boolean.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/boolean.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/boolean.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/boolean.h index d604dfcea2..b1d69a193b 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/boolean.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/boolean.h @@ -65,10 +65,14 @@ #ifndef _MACH_I386_BOOLEAN_H_ #define _MACH_I386_BOOLEAN_H_ +#if defined (__i386__) || defined (__x86_64__) + #if defined(__x86_64__) && !defined(KERNEL) typedef unsigned int boolean_t; #else typedef int boolean_t; #endif +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_BOOLEAN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/exception.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/exception.h similarity index 97% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/exception.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/exception.h index 3f21c3d4e6..1a8b2c0d1d 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/exception.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/exception.h @@ -59,6 +59,8 @@ #ifndef _MACH_I386_EXCEPTION_H_ #define _MACH_I386_EXCEPTION_H_ +#if defined (__i386__) || defined (__x86_64__) + /* * No machine dependent types for the 80386 */ @@ -132,4 +134,6 @@ */ #define EXC_MASK_MACHINE 0 +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_EXCEPTION_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/fp_reg.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/fp_reg.h similarity index 98% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/fp_reg.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/fp_reg.h index eb010ad950..e968978842 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/fp_reg.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/fp_reg.h @@ -59,6 +59,8 @@ #ifndef _I386_FP_SAVE_H_ #define _I386_FP_SAVE_H_ +#if defined (__i386__) || defined (__x86_64__) + /* * Control register */ @@ -115,4 +117,6 @@ #define FP_387 3 /* 80387 or 80486 */ #define FP_FXSR 4 /* Fast save/restore SIMD Extension */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _I386_FP_SAVE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/kern_return.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/kern_return.h similarity index 96% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/kern_return.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/kern_return.h index 47aa4b8753..3a12665ead 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/kern_return.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/kern_return.h @@ -67,8 +67,12 @@ #ifndef _MACH_I386_KERN_RETURN_H_ #define _MACH_I386_KERN_RETURN_H_ +#if defined (__i386__) || defined (__x86_64__) + #ifndef ASSEMBLER typedef int kern_return_t; #endif /* ASSEMBLER */ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_KERN_RETURN_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/processor_info.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/processor_info.h similarity index 93% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/processor_info.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/processor_info.h index 4426e0041c..5a9aeac9cb 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/processor_info.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/processor_info.h @@ -34,4 +34,8 @@ #ifndef _MACH_I386_PROCESSOR_INFO_H_ #define _MACH_I386_PROCESSOR_INFO_H_ +#if defined (__i386__) || defined (__x86_64__) + +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_PROCESSOR_INFO_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/rpc.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/rpc.h similarity index 93% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/rpc.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/rpc.h index 0298ebb804..fcd2829f6b 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/rpc.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/rpc.h @@ -32,4 +32,8 @@ #ifndef _MACH_I386_RPC_H_ #define _MACH_I386_RPC_H_ +#if defined (__i386__) || defined (__x86_64__) + +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_RPC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/thread_state.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/thread_state.h similarity index 90% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/thread_state.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/thread_state.h index 78595255a3..421917aeb3 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/thread_state.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/thread_state.h @@ -32,11 +32,11 @@ #ifndef _MACH_I386_THREAD_STATE_H_ #define _MACH_I386_THREAD_STATE_H_ -/* Size of maximum exported thread state in words */ +#if defined (__i386__) || defined (__x86_64__) + +/* Size of maximum exported thread state in 32-bit words */ #define I386_THREAD_STATE_MAX (614) /* Size of biggest state possible */ -#if defined (__i386__) || defined(__x86_64__) -#define THREAD_STATE_MAX I386_THREAD_STATE_MAX -#endif +#endif /* defined (__i386__) || defined (__x86_64__) */ #endif /* _MACH_I386_THREAD_STATE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/thread_status.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/thread_status.h similarity index 93% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/thread_status.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/thread_status.h index 233e0f22a6..d401a11fd0 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/thread_status.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/thread_status.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2020 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -67,10 +67,12 @@ #ifndef _MACH_I386_THREAD_STATUS_H_ #define _MACH_I386_THREAD_STATUS_H_ +#if defined (__i386__) || defined (__x86_64__) + #include +#include #include #include -#include #include @@ -121,6 +123,8 @@ #define x86_AVX512_STATE (x86_AVX512_STATE32 + 2) #define x86_PAGEIN_STATE 22 #define x86_THREAD_FULL_STATE64 23 +#define x86_INSTRUCTION_STATE 24 +#define x86_LAST_BRANCH_STATE 25 /* * Largest state on this machine: @@ -155,6 +159,8 @@ (x == x86_AVX512_STATE64) || \ (x == x86_AVX512_STATE) || \ (x == x86_PAGEIN_STATE) || \ + (x == x86_INSTRUCTION_STATE) || \ + (x == x86_LAST_BRANCH_STATE) || \ (x == THREAD_STATE_NONE)) struct x86_state_hdr { @@ -259,6 +265,19 @@ typedef _STRUCT_X86_PAGEIN_STATE x86_pagein_state_t; #define X86_PAGEIN_STATE_COUNT x86_PAGEIN_STATE_COUNT +typedef _STRUCT_X86_INSTRUCTION_STATE x86_instruction_state_t; +#define x86_INSTRUCTION_STATE_COUNT \ + ((mach_msg_type_number_t)(sizeof(x86_instruction_state_t) / sizeof(int))) + +#define X86_INSTRUCTION_STATE_COUNT x86_INSTRUCTION_STATE_COUNT + +typedef _STRUCT_LAST_BRANCH_STATE last_branch_state_t; +#define x86_LAST_BRANCH_STATE_COUNT \ + ((mach_msg_type_number_t)(sizeof(last_branch_state_t) / sizeof(int))) + +#define X86_LAST_BRANCH_STATE_COUNT x86_LAST_BRANCH_STATE_COUNT + + /* * Combined thread, float and exception states */ @@ -342,4 +361,6 @@ typedef struct x86_avx512_state x86_avx512_state_t; #define MACHINE_THREAD_STATE_COUNT x86_THREAD_STATE_COUNT +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_THREAD_STATUS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/vm_param.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/vm_param.h similarity index 80% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/vm_param.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/vm_param.h index a85ee924b7..953f4a1605 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/vm_param.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/vm_param.h @@ -90,54 +90,45 @@ #ifndef _MACH_I386_VM_PARAM_H_ #define _MACH_I386_VM_PARAM_H_ +#if defined (__i386__) || defined (__x86_64__) + +#if !defined(KERNEL) && !defined(__ASSEMBLER__) + +#include +#endif + #define BYTE_SIZE 8 /* byte size in bits */ #define I386_PGBYTES 4096 /* bytes per 80386 page */ #define I386_PGSHIFT 12 /* bitshift for pages */ -#define PAGE_SIZE I386_PGBYTES + +#if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600) #define PAGE_SHIFT I386_PGSHIFT -#define PAGE_MASK (PAGE_SIZE - 1) +#define PAGE_SIZE I386_PGBYTES +#define PAGE_MASK (PAGE_SIZE-1) +#else /* !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600) */ +#define PAGE_SHIFT vm_page_shift +#define PAGE_SIZE vm_page_size +#define PAGE_MASK vm_page_mask +#endif /* !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600) */ -#define PAGE_MAX_SHIFT PAGE_SHIFT -#define PAGE_MAX_SIZE PAGE_SIZE -#define PAGE_MAX_MASK PAGE_MASK - -#define PAGE_MIN_SHIFT PAGE_SHIFT -#define PAGE_MIN_SIZE PAGE_SIZE -#define PAGE_MIN_MASK PAGE_MASK - -#define I386_LPGBYTES 2*1024*1024 /* bytes per large page */ -#define I386_LPGSHIFT 21 /* bitshift for large pages */ -#define I386_LPGMASK (I386_LPGBYTES-1) - -/* - * Convert bytes to pages and convert pages to bytes. - * No rounding is used. - */ - -#define i386_btop(x) ((ppnum_t)((x) >> I386_PGSHIFT)) -#define machine_btop(x) i386_btop(x) -#define i386_ptob(x) (((pmap_paddr_t)(x)) << I386_PGSHIFT) -#define machine_ptob(x) i386_ptob(x) - -/* - * Round off or truncate to the nearest page. These will work - * for either addresses or counts. (i.e. 1 byte rounds to 1 page - * bytes. - */ - -#define i386_round_page(x) ((((pmap_paddr_t)(x)) + I386_PGBYTES - 1) & \ - ~(I386_PGBYTES-1)) -#define i386_trunc_page(x) (((pmap_paddr_t)(x)) & ~(I386_PGBYTES-1)) +#define PAGE_MAX_SHIFT 14 +#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT) +#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1) +#define PAGE_MIN_SHIFT 12 +#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT) +#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1) #define VM_MIN_ADDRESS64 ((user_addr_t) 0x0000000000000000ULL) /* - * default top of user stack... it grows down from here + * Default top of user stack, grows down from here. + * Address chosen to be 1G (3rd level page table entry) below SHARED_REGION_BASE_X86_64 + * minus additional 1Meg (1/2 1st level page table coverage) to allow a redzone after it. */ -#define VM_USRSTACK64 ((user_addr_t) 0x00007FFEEFC00000ULL) +#define VM_USRSTACK64 ((user_addr_t) (0x00007FF7C0000000ull - (1024 * 1024))) /* * XXX TODO: Obsolete? @@ -167,4 +158,6 @@ +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_VM_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-macos.10-none/mach/i386/vm_types.h b/lib/libc/include/x86_64-macos.13-none/mach/i386/vm_types.h similarity index 89% rename from lib/libc/include/x86_64-macos.10-none/mach/i386/vm_types.h rename to lib/libc/include/x86_64-macos.13-none/mach/i386/vm_types.h index 8a95db53ee..f3e956d3e2 100644 --- a/lib/libc/include/x86_64-macos.10-none/mach/i386/vm_types.h +++ b/lib/libc/include/x86_64-macos.13-none/mach/i386/vm_types.h @@ -67,11 +67,13 @@ #ifndef _MACH_I386_VM_TYPES_H_ #define _MACH_I386_VM_TYPES_H_ +#if defined (__i386__) || defined (__x86_64__) + #ifndef ASSEMBLER #include -#include #include +#include /* * natural_t and integer_t are Mach's legacy types for machine- @@ -98,9 +100,9 @@ typedef int integer_t; * e.g. an offset into a virtual memory space. */ #ifdef __LP64__ -typedef uintptr_t vm_offset_t; +typedef uintptr_t vm_offset_t __kernel_ptr_semantics; #else /* __LP64__ */ -typedef natural_t vm_offset_t; +typedef natural_t vm_offset_t __kernel_ptr_semantics; #endif /* __LP64__ */ /* @@ -121,12 +123,12 @@ typedef natural_t vm_size_t; * where the size of the map is not known - or we don't * want to have to distinguish. */ -typedef uint64_t mach_vm_address_t; -typedef uint64_t mach_vm_offset_t; +typedef uint64_t mach_vm_address_t __kernel_ptr_semantics; +typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics; typedef uint64_t mach_vm_size_t; -typedef uint64_t vm_map_offset_t; -typedef uint64_t vm_map_address_t; +typedef uint64_t vm_map_offset_t __kernel_ptr_semantics; +typedef uint64_t vm_map_address_t __kernel_ptr_semantics; typedef uint64_t vm_map_size_t; typedef mach_vm_address_t mach_port_context_t; @@ -139,4 +141,6 @@ typedef mach_vm_address_t mach_port_context_t; */ #define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32 +#endif /* defined (__i386__) || defined (__x86_64__) */ + #endif /* _MACH_I386_VM_TYPES_H_ */ \ No newline at end of file