diff --git a/lib/libc/darwin/SDKSettings.json b/lib/libc/darwin/SDKSettings.json index 79599d4fe715..4227f987e3a9 100644 --- a/lib/libc/darwin/SDKSettings.json +++ b/lib/libc/darwin/SDKSettings.json @@ -1 +1 @@ -{"MinimalDisplayName":"14.0"} +{"MinimalDisplayName":"15.1"} diff --git a/lib/libc/darwin/libSystem.tbd b/lib/libc/darwin/libSystem.tbd index 09df08185b81..b4bf452f224f 100644 --- a/lib/libc/darwin/libSystem.tbd +++ b/lib/libc/darwin/libSystem.tbd @@ -1,14 +1,10 @@ --- !tapi-tbd tbd-version: 4 -targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] +targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/libSystem.B.dylib' -current-version: 1336 +current-version: 1351 reexported-libraries: - - targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] - libraries: [ '/usr/lib/system/libsystem_kernel.dylib', '/usr/lib/system/libsystem_platform.dylib', - '/usr/lib/system/libsystem_pthread.dylib' ] - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] libraries: [ '/usr/lib/system/libcache.dylib', '/usr/lib/system/libcommonCrypto.dylib', @@ -21,13 +17,15 @@ reexported-libraries: '/usr/lib/system/libsystem_collections.dylib', '/usr/lib/system/libsystem_configuration.dylib', '/usr/lib/system/libsystem_containermanager.dylib', '/usr/lib/system/libsystem_coreservices.dylib', '/usr/lib/system/libsystem_darwin.dylib', '/usr/lib/system/libsystem_darwindirectory.dylib', - '/usr/lib/system/libsystem_dnssd.dylib', '/usr/lib/system/libsystem_featureflags.dylib', - '/usr/lib/system/libsystem_info.dylib', '/usr/lib/system/libsystem_m.dylib', + '/usr/lib/system/libsystem_dnssd.dylib', '/usr/lib/system/libsystem_eligibility.dylib', + '/usr/lib/system/libsystem_featureflags.dylib', '/usr/lib/system/libsystem_info.dylib', + '/usr/lib/system/libsystem_kernel.dylib', '/usr/lib/system/libsystem_m.dylib', '/usr/lib/system/libsystem_malloc.dylib', '/usr/lib/system/libsystem_networkextension.dylib', - '/usr/lib/system/libsystem_notify.dylib', '/usr/lib/system/libsystem_sandbox.dylib', - '/usr/lib/system/libsystem_secinit.dylib', '/usr/lib/system/libsystem_symptoms.dylib', - '/usr/lib/system/libsystem_trace.dylib', '/usr/lib/system/libunwind.dylib', - '/usr/lib/system/libxpc.dylib' ] + '/usr/lib/system/libsystem_notify.dylib', '/usr/lib/system/libsystem_platform.dylib', + '/usr/lib/system/libsystem_pthread.dylib', '/usr/lib/system/libsystem_sandbox.dylib', + '/usr/lib/system/libsystem_sanitizers.dylib', '/usr/lib/system/libsystem_secinit.dylib', + '/usr/lib/system/libsystem_symptoms.dylib', '/usr/lib/system/libsystem_trace.dylib', + '/usr/lib/system/libunwind.dylib', '/usr/lib/system/libxpc.dylib' ] exports: - targets: [ x86_64-macos, x86_64-maccatalyst ] symbols: [ 'R8289209$_close', 'R8289209$_fork', 'R8289209$_fsync', 'R8289209$_getattrlist', @@ -48,7 +46,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libcache.dylib' -current-version: 92 +current-version: 95 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -91,14 +89,18 @@ exports: _CCBigNumModExp, _CCBigNumModI, _CCBigNumMul, _CCBigNumMulI, _CCBigNumMulMod, _CCBigNumRightShift, _CCBigNumSetI, _CCBigNumSetNegative, _CCBigNumSub, _CCBigNumSubI, _CCBigNumToData, _CCBigNumToDecimalString, - _CCBigNumToHexString, _CCBigNumZeroLSBCount, _CCCKGContributorCommit, - _CCCKGContributorCreate, _CCCKGContributorDestroy, _CCCKGContributorFinish, - _CCCKGGetCommitmentSize, _CCCKGGetOpeningSize, _CCCKGGetShareSize, - _CCCKGOwnerCreate, _CCCKGOwnerDestroy, _CCCKGOwnerFinish, - _CCCKGOwnerGenerateShare, _CCCalibratePBKDF, _CCCreateBigNum, - _CCCrypt, _CCCryptorAddParameter, _CCCryptorChaCha20, _CCCryptorChaCha20Poly1305OneshotDecrypt, - _CCCryptorChaCha20Poly1305OneshotEncrypt, _CCCryptorCreate, - _CCCryptorCreateFromData, _CCCryptorCreateFromDataWithMode, + _CCBigNumToHexString, _CCBigNumZeroLSBCount, _CCCKG2ContributorCommit, + _CCCKG2ContributorCreate, _CCCKG2ContributorDestroy, _CCCKG2ContributorFinish, + _CCCKG2GetCommitmentSize, _CCCKG2GetOpeningSize, _CCCKG2GetShareSize, + _CCCKG2OwnerCreate, _CCCKG2OwnerDestroy, _CCCKG2OwnerFinish, + _CCCKG2OwnerGenerateShare, _CCCKG2ParamsP224Sha256Version2, + _CCCKGContributorCommit, _CCCKGContributorCreate, _CCCKGContributorDestroy, + _CCCKGContributorFinish, _CCCKGGetCommitmentSize, _CCCKGGetOpeningSize, + _CCCKGGetShareSize, _CCCKGOwnerCreate, _CCCKGOwnerDestroy, + _CCCKGOwnerFinish, _CCCKGOwnerGenerateShare, _CCCalibratePBKDF, + _CCCreateBigNum, _CCCrypt, _CCCryptorAddParameter, _CCCryptorChaCha20, + _CCCryptorChaCha20Poly1305OneshotDecrypt, _CCCryptorChaCha20Poly1305OneshotEncrypt, + _CCCryptorCreate, _CCCryptorCreateFromData, _CCCryptorCreateFromDataWithMode, _CCCryptorCreateWithMode, _CCCryptorDecryptDataBlock, _CCCryptorEncryptDataBlock, _CCCryptorFinal, _CCCryptorGCM, _CCCryptorGCMAddAAD, _CCCryptorGCMAddADD, _CCCryptorGCMAddIV, _CCCryptorGCMDecrypt, _CCCryptorGCMEncrypt, @@ -154,7 +156,7 @@ exports: tbd-version: 4 targets: [ x86_64-macos, arm64-macos, arm64e-macos ] install-name: '/usr/lib/system/libcompiler_rt.dylib' -current-version: 103.1 +current-version: 103.3 parent-umbrella: - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] umbrella: System @@ -397,7 +399,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libcorecrypto.dylib' -current-version: 1608.0.18 +current-version: 1736.40.7 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -432,36 +434,10 @@ exports: _ccapsic_client_generate_match_response, _ccapsic_client_init, _ccapsic_client_state_sizeof, _ccapsic_server_determine_intersection, _ccapsic_server_encode_element, _ccapsic_server_init, _ccapsic_server_state_sizeof, - _ccbfv_bytes_to_coeffs, _ccbfv_ciphertext_apply_galois, _ccbfv_ciphertext_coeff_compose, - _ccbfv_ciphertext_coeff_dcrt_plaintext_mul, _ccbfv_ciphertext_coeff_decompose, - _ccbfv_ciphertext_coeff_decompose_nptexts, _ccbfv_ciphertext_coeff_plaintext_mul, - _ccbfv_ciphertext_eval_dcrt_plaintext_mul, _ccbfv_ciphertext_eval_plaintext_mul, - _ccbfv_ciphertext_fresh_npolys, _ccbfv_ciphertext_fwd_ntt, - _ccbfv_ciphertext_galois_elt_rotate_rows_left, _ccbfv_ciphertext_galois_elt_rotate_rows_right, - _ccbfv_ciphertext_galois_elt_swap_columns, _ccbfv_ciphertext_inv_ntt, - _ccbfv_ciphertext_plaintext_add, _ccbfv_ciphertext_sizeof, - _ccbfv_coeffs_to_bytes, _ccbfv_dcrt_plaintext_encode, _ccbfv_dcrt_plaintext_sizeof, - _ccbfv_decode_poly_uint64, _ccbfv_decode_simd_int64, _ccbfv_decode_simd_uint64, - _ccbfv_decrypt, _ccbfv_deserialize_ciphertext_coeff, _ccbfv_deserialize_ciphertext_eval, - _ccbfv_deserialize_seeded_ciphertext_coeff, _ccbfv_deserialize_seeded_ciphertext_eval, - _ccbfv_encode_poly_uint64, _ccbfv_encode_simd_int64, _ccbfv_encode_simd_uint64, - _ccbfv_encrypt_symmetric, _ccbfv_encryption_params_coefficient_moduli, - _ccbfv_encryption_params_coefficient_nmoduli, _ccbfv_encryption_params_plaintext_modulus, - _ccbfv_encryption_params_polynomial_degree, _ccbfv_galois_key_generate, - _ccbfv_galois_key_load, _ccbfv_galois_key_save, _ccbfv_galois_key_sizeof, - _ccbfv_param_ctx_ciphertext_ctx_nmoduli, _ccbfv_param_ctx_init, - _ccbfv_param_ctx_key_ctx_nmoduli, _ccbfv_param_ctx_key_ctx_poly_nbytes, - _ccbfv_param_ctx_plaintext_modulus, _ccbfv_param_ctx_plaintext_modulus_inverse, - _ccbfv_param_ctx_polynomial_degree, _ccbfv_param_ctx_sizeof, - _ccbfv_param_ctx_supports_simd_encoding, _ccbfv_plaintext_sizeof, - _ccbfv_relin_key_generate, _ccbfv_relin_key_load, _ccbfv_relin_key_save, - _ccbfv_relin_key_sizeof, _ccbfv_rng_seed_sizeof, _ccbfv_secret_key_generate, - _ccbfv_secret_key_generate_from_seed, _ccbfv_secret_key_sizeof, - _ccbfv_serialize_ciphertext_coeff, _ccbfv_serialize_ciphertext_coeff_nbytes, - _ccbfv_serialize_ciphertext_eval, _ccbfv_serialize_ciphertext_eval_nbytes, - _ccbfv_serialize_seeded_ciphertext_coeff, _ccbfv_serialize_seeded_ciphertext_coeff_nbytes, - _ccbfv_serialize_seeded_ciphertext_eval, _ccbfv_serialize_seeded_ciphertext_eval_nbytes, - _ccblowfish_cbc_decrypt_mode, _ccblowfish_cbc_encrypt_mode, + _ccascon_ascon128a, _ccascon_ascon128a_cmac, _ccascon_ascon128a_cmac_ref, + _ccascon_ascon128a_decrypt, _ccascon_ascon128a_encrypt, _ccascon_ascon128a_ref, + _ccascon_cmac_init, _ccascon_cmac_process, _ccascon_cmac_tag, + _ccascon_cmac_verify, _ccblowfish_cbc_decrypt_mode, _ccblowfish_cbc_encrypt_mode, _ccblowfish_cfb8_decrypt_mode, _ccblowfish_cfb8_encrypt_mode, _ccblowfish_cfb_decrypt_mode, _ccblowfish_cfb_encrypt_mode, _ccblowfish_ctr_crypt_mode, _ccblowfish_ecb_decrypt_mode, @@ -486,13 +462,17 @@ exports: _ccchacha20poly1305_finalize, _ccchacha20poly1305_incnonce, _ccchacha20poly1305_info, _ccchacha20poly1305_init, _ccchacha20poly1305_reset, _ccchacha20poly1305_setnonce, _ccchacha20poly1305_verify, - _ccckg_contributor_commit, _ccckg_contributor_finish, _ccckg_init, - _ccckg_owner_finish, _ccckg_owner_generate_share, _ccckg_sizeof_commitment, - _ccckg_sizeof_ctx, _ccckg_sizeof_opening, _ccckg_sizeof_share, - _cccmac_final_generate, _cccmac_final_verify, _cccmac_init, - _cccmac_one_shot_generate, _cccmac_one_shot_verify, _cccmac_update, - _ccctr_block_size, _ccctr_context_size, _ccctr_init, _ccctr_one_shot, - _ccctr_update, _cccurve25519, _cccurve25519_make_key_pair, + _ccckg2_contributor_commit, _ccckg2_contributor_finish, _ccckg2_ctx_cp, + _ccckg2_ctx_di, _ccckg2_init, _ccckg2_owner_finish, _ccckg2_owner_generate_share, + _ccckg2_params_p224_sha256_v2, _ccckg2_sizeof_commitment, + _ccckg2_sizeof_ctx, _ccckg2_sizeof_opening, _ccckg2_sizeof_share, + _ccckg_contributor_commit, _ccckg_contributor_finish, _ccckg_ctx_cp, + _ccckg_ctx_di, _ccckg_init, _ccckg_owner_finish, _ccckg_owner_generate_share, + _ccckg_sizeof_commitment, _ccckg_sizeof_ctx, _ccckg_sizeof_opening, + _ccckg_sizeof_share, _cccmac_final_generate, _cccmac_final_verify, + _cccmac_init, _cccmac_one_shot_generate, _cccmac_one_shot_verify, + _cccmac_update, _ccctr_block_size, _ccctr_context_size, _ccctr_init, + _ccctr_one_shot, _ccctr_update, _cccurve25519, _cccurve25519_make_key_pair, _cccurve25519_make_priv, _cccurve25519_make_pub, _cccurve25519_make_pub_with_rng, _cccurve25519_with_rng, _cccurve448, _cccurve448_make_key_pair, _cccurve448_make_priv, _cccurve448_make_pub, _ccder_blob_decode_bitstring, @@ -566,9 +546,9 @@ exports: _ccec_der_import_priv, _ccec_der_import_priv_keytype, _ccec_diversify_min_entropy_len, _ccec_diversify_priv_twin, _ccec_diversify_pub, _ccec_diversify_pub_twin, _ccec_export_affine_point, _ccec_export_affine_point_size, - _ccec_export_pub, _ccec_extract_rs, _ccec_full_add, _ccec_generate_blinding_keys, - _ccec_generate_key, _ccec_generate_key_deterministic, _ccec_generate_key_fips, - _ccec_generate_key_legacy, _ccec_generate_scalar_fips_retry, + _ccec_export_pub, _ccec_extract_rs, _ccec_full_add, _ccec_full_sub, + _ccec_generate_blinding_keys, _ccec_generate_key, _ccec_generate_key_deterministic, + _ccec_generate_key_fips, _ccec_generate_key_legacy, _ccec_generate_scalar_fips_retry, _ccec_get_cp, _ccec_get_fullkey_components, _ccec_get_pubkey_components, _ccec_import_affine_point, _ccec_import_pub, _ccec_is_compactable_pub, _ccec_keysize_is_supported, _ccec_make_priv, _ccec_make_pub, @@ -596,39 +576,70 @@ exports: _cced25519_make_pub_with_rng, _cced25519_sign, _cced25519_sign_with_rng, _cced25519_verify, _cced448_make_key_pair, _cced448_make_pub, _cced448_sign, _cced448_verify, _ccentropy_add_entropy, _ccentropy_digest_init, - _ccentropy_get_seed, _ccentropy_rng_init, _ccgcm_aad, _ccgcm_block_size, + _ccentropy_get_seed, _ccentropy_list_init, _ccentropy_lock_init, + _ccentropy_reset, _ccentropy_rng_init, _ccgcm_aad, _ccgcm_block_size, _ccgcm_context_size, _ccgcm_finalize, _ccgcm_gmac, _ccgcm_inc_iv, _ccgcm_init, _ccgcm_init_with_iv, _ccgcm_one_shot, _ccgcm_one_shot_legacy, _ccgcm_reset, _ccgcm_set_iv, _ccgcm_set_iv_legacy, _ccgcm_update, _cch2c, _cch2c_name, _cch2c_p256_sha256_sae_compat_info, _cch2c_p256_sha256_sswu_ro_info, _cch2c_p384_sha384_sae_compat_info, _cch2c_p384_sha512_sswu_ro_info, - _cch2c_p521_sha512_sswu_ro_info, _cchkdf, _cchkdf_expand, - _cchkdf_extract, _cchmac, _cchmac_final, _cchmac_init, _cchmac_update, - _cchpke_initiator_encrypt, _cchpke_initiator_export, _cchpke_initiator_seal, - _cchpke_initiator_setup, _cchpke_kem_generate_key_pair, _cchpke_params_sizeof_aead_key, - _cchpke_params_sizeof_aead_nonce, _cchpke_params_sizeof_aead_tag, - _cchpke_params_sizeof_kdf_hash, _cchpke_params_sizeof_kem_enc, - _cchpke_params_sizeof_kem_pk, _cchpke_params_sizeof_kem_pk_marshalled, - _cchpke_params_sizeof_kem_shared_secret, _cchpke_params_sizeof_kem_sk, - _cchpke_params_x25519_AESGCM128_HKDF_SHA256, _cchpke_responder_decrypt, - _cchpke_responder_export, _cchpke_responder_open, _cchpke_responder_setup, - _cckem_decapsulate, _cckem_encapsulate, _cckem_encapsulated_key_nbytes_ctx, - _cckem_encapsulated_key_nbytes_info, _cckem_export_privkey, - _cckem_export_pubkey, _cckem_full_ctx_init, _cckem_generate_key, - _cckem_import_privkey, _cckem_import_pubkey, _cckem_kyber768, - _cckem_privkey_nbytes_ctx, _cckem_privkey_nbytes_info, _cckem_pub_ctx_init, - _cckem_pubkey_nbytes_ctx, _cckem_pubkey_nbytes_info, _cckem_public_ctx, - _cckem_shared_key_nbytes_ctx, _cckem_shared_key_nbytes_info, - _cckem_sizeof_full_ctx, _cckem_sizeof_pub_ctx, _cclr_aes_init, - _cclr_block_nbytes, _cclr_decrypt_block, _cclr_encrypt_block, + _cch2c_p521_sha512_sswu_ro_info, _cche_bytes_to_coeffs, _cche_ciphertext_apply_galois, + _cche_ciphertext_coeff_compose, _cche_ciphertext_coeff_dcrt_plaintext_mul, + _cche_ciphertext_coeff_decompose, _cche_ciphertext_coeff_decompose_nptexts, + _cche_ciphertext_coeff_plaintext_mul, _cche_ciphertext_correction_factor, + _cche_ciphertext_eval_dcrt_plaintext_mul, _cche_ciphertext_eval_plaintext_mul, + _cche_ciphertext_fresh_correction_factor, _cche_ciphertext_fresh_npolys, + _cche_ciphertext_fwd_ntt, _cche_ciphertext_galois_elt_rotate_rows_left, + _cche_ciphertext_galois_elt_rotate_rows_right, _cche_ciphertext_galois_elt_swap_columns, + _cche_ciphertext_inv_ntt, _cche_ciphertext_plaintext_add, + _cche_ciphertext_sizeof, _cche_coeffs_to_bytes, _cche_crt_compose, + _cche_dcrt_plaintext_encode, _cche_dcrt_plaintext_sizeof, + _cche_decode_poly_uint64, _cche_decode_simd_int64, _cche_decode_simd_uint64, + _cche_decrypt, _cche_deserialize_ciphertext_coeff, _cche_deserialize_ciphertext_eval, + _cche_deserialize_seeded_ciphertext_coeff, _cche_deserialize_seeded_ciphertext_eval, + _cche_encode_poly_uint64, _cche_encode_simd_int64, _cche_encode_simd_reduced_int64, + _cche_encode_simd_uint64, _cche_encrypt_symmetric, _cche_encryption_params_coefficient_moduli, + _cche_encryption_params_coefficient_nmoduli, _cche_encryption_params_plaintext_modulus, + _cche_encryption_params_polynomial_degree, _cche_galois_key_generate, + _cche_galois_key_load, _cche_galois_key_save, _cche_galois_key_sizeof, + _cche_param_ctx_ciphertext_ctx_nmoduli, _cche_param_ctx_coefficient_moduli, + _cche_param_ctx_he_scheme, _cche_param_ctx_init, _cche_param_ctx_key_ctx_nmoduli, + _cche_param_ctx_key_ctx_poly_nbytes, _cche_param_ctx_plaintext_modulus, + _cche_param_ctx_plaintext_modulus_inverse, _cche_param_ctx_polynomial_degree, + _cche_param_ctx_sizeof, _cche_param_ctx_supports_simd_encoding, + _cche_plaintext_sizeof, _cche_relin_key_generate, _cche_relin_key_load, + _cche_relin_key_save, _cche_relin_key_sizeof, _cche_rng_seed_sizeof, + _cche_secret_key_generate, _cche_secret_key_generate_from_seed, + _cche_secret_key_sizeof, _cche_serialize_ciphertext_coeff, + _cche_serialize_ciphertext_coeff_max_nskip_lsbs, _cche_serialize_ciphertext_coeff_nbytes, + _cche_serialize_ciphertext_eval, _cche_serialize_ciphertext_eval_nbytes, + _cche_serialize_seeded_ciphertext_coeff, _cche_serialize_seeded_ciphertext_coeff_nbytes, + _cche_serialize_seeded_ciphertext_eval, _cche_serialize_seeded_ciphertext_eval_nbytes, + _cchkdf, _cchkdf_expand, _cchkdf_extract, _cchmac, _cchmac_final, + _cchmac_init, _cchmac_update, _cchpke_initiator_encrypt, _cchpke_initiator_export, + _cchpke_initiator_seal, _cchpke_initiator_setup, _cchpke_kem_generate_key_pair, + _cchpke_params_sizeof_aead_key, _cchpke_params_sizeof_aead_nonce, + _cchpke_params_sizeof_aead_tag, _cchpke_params_sizeof_kdf_hash, + _cchpke_params_sizeof_kem_enc, _cchpke_params_sizeof_kem_pk, + _cchpke_params_sizeof_kem_pk_marshalled, _cchpke_params_sizeof_kem_shared_secret, + _cchpke_params_sizeof_kem_sk, _cchpke_params_x25519_AESGCM128_HKDF_SHA256, + _cchpke_responder_decrypt, _cchpke_responder_export, _cchpke_responder_open, + _cchpke_responder_setup, _cckem_decapsulate, _cckem_derive_key_from_seed, + _cckem_encapsulate, _cckem_encapsulated_key_nbytes_ctx, _cckem_encapsulated_key_nbytes_info, + _cckem_export_privkey, _cckem_export_pubkey, _cckem_full_ctx_init, + _cckem_generate_key, _cckem_import_privkey, _cckem_import_pubkey, + _cckem_kyber1024, _cckem_kyber768, _cckem_privkey_nbytes_ctx, + _cckem_privkey_nbytes_info, _cckem_pub_ctx_init, _cckem_pubkey_nbytes_ctx, + _cckem_pubkey_nbytes_info, _cckem_public_ctx, _cckem_shared_key_nbytes_ctx, + _cckem_shared_key_nbytes_info, _cckem_sizeof_full_ctx, _cckem_sizeof_pub_ctx, + _cclr_aes_init, _cclr_block_nbytes, _cclr_decrypt_block, _cclr_encrypt_block, _ccmd2_ltc_di, _ccmd4_ltc_di, _ccmd5_di, _ccmd5_ltc_di, _ccmgf, _ccmode_factory_cbc_decrypt, _ccmode_factory_cbc_encrypt, _ccmode_factory_ccm_decrypt, _ccmode_factory_ccm_encrypt, _ccmode_factory_cfb8_decrypt, _ccmode_factory_cfb8_encrypt, _ccmode_factory_cfb_decrypt, _ccmode_factory_cfb_encrypt, _ccmode_factory_ctr_crypt, _ccmode_factory_gcm_decrypt, _ccmode_factory_gcm_encrypt, - _ccmode_factory_ofb_crypt, _ccmode_factory_omac_decrypt, _ccmode_factory_omac_encrypt, - _ccmode_factory_siv_decrypt, _ccmode_factory_siv_encrypt, + _ccmode_factory_ofb_crypt, _ccmode_factory_siv_decrypt, _ccmode_factory_siv_encrypt, _ccmode_factory_xts_decrypt, _ccmode_factory_xts_encrypt, _ccn_add, _ccn_add1, _ccn_bitlen, _ccn_cmp, _ccn_cmpn, _ccn_lprint, _ccn_print, _ccn_read_uint, _ccn_set_bit, _ccn_seti, _ccn_sub, @@ -637,26 +648,25 @@ exports: _ccn_xor, _ccn_zero, _ccnistkdf_ctr_cmac, _ccnistkdf_ctr_cmac_fixed, _ccnistkdf_ctr_hmac, _ccnistkdf_ctr_hmac_fixed, _ccofb_block_size, _ccofb_context_size, _ccofb_init, _ccofb_one_shot, _ccofb_update, - _ccoid_equal, _ccoid_payload, _ccoid_size, _ccomac_block_size, - _ccomac_context_size, _ccomac_init, _ccomac_one_shot, _ccomac_update, - _ccpad_cts1_decrypt, _ccpad_cts1_encrypt, _ccpad_cts2_decrypt, - _ccpad_cts2_encrypt, _ccpad_cts3_decrypt, _ccpad_cts3_encrypt, - _ccpad_pkcs7_decode, _ccpad_pkcs7_decrypt, _ccpad_pkcs7_ecb_decrypt, - _ccpad_pkcs7_ecb_encrypt, _ccpad_pkcs7_encrypt, _ccpad_xts_decrypt, - _ccpad_xts_encrypt, _ccpbkdf2_hmac, _ccpoly1305, _ccpoly1305_final, - _ccpoly1305_init, _ccpoly1305_update, _ccrc2_cbc_decrypt_mode, - _ccrc2_cbc_encrypt_mode, _ccrc2_cfb8_decrypt_mode, _ccrc2_cfb8_encrypt_mode, - _ccrc2_cfb_decrypt_mode, _ccrc2_cfb_encrypt_mode, _ccrc2_ctr_crypt_mode, - _ccrc2_ecb_decrypt_mode, _ccrc2_ecb_encrypt_mode, _ccrc2_ofb_crypt_mode, - _ccrc4, _ccrc4_eay, _ccrmd160_ltc_di, _ccrng, _ccrng_drbg_done, - _ccrng_drbg_init, _ccrng_drbg_init_withdrbg, _ccrng_drbg_reseed, - _ccrng_ecfips_test_init, _ccrng_pbkdf2_prng_init, _ccrng_prng, - _ccrng_rsafips_test_init, _ccrng_rsafips_test_set_next, _ccrng_sequence_init, - _ccrng_system_done, _ccrng_system_init, _ccrng_test_done, - _ccrng_test_init, _ccrng_trng, _ccrng_uniform, _ccrsa_block_size, - _ccrsa_block_start, _ccrsa_ctx_private_zp, _ccrsa_ctx_public, - _ccrsa_decrypt_eme_pkcs1v15, _ccrsa_decrypt_oaep, _ccrsa_dump_full_key, - _ccrsa_dump_public_key, _ccrsa_eme_pkcs1v15_decode, _ccrsa_eme_pkcs1v15_encode, + _ccoid_equal, _ccoid_payload, _ccoid_size, _ccpad_cts1_decrypt, + _ccpad_cts1_encrypt, _ccpad_cts2_decrypt, _ccpad_cts2_encrypt, + _ccpad_cts3_decrypt, _ccpad_cts3_encrypt, _ccpad_pkcs7_decode, + _ccpad_pkcs7_decrypt, _ccpad_pkcs7_ecb_decrypt, _ccpad_pkcs7_ecb_encrypt, + _ccpad_pkcs7_encrypt, _ccpad_xts_decrypt, _ccpad_xts_encrypt, + _ccpbkdf2_hmac, _ccpoly1305, _ccpoly1305_final, _ccpoly1305_init, + _ccpoly1305_update, _ccpost, _ccrc2_cbc_decrypt_mode, _ccrc2_cbc_encrypt_mode, + _ccrc2_cfb8_decrypt_mode, _ccrc2_cfb8_encrypt_mode, _ccrc2_cfb_decrypt_mode, + _ccrc2_cfb_encrypt_mode, _ccrc2_ctr_crypt_mode, _ccrc2_ecb_decrypt_mode, + _ccrc2_ecb_encrypt_mode, _ccrc2_ofb_crypt_mode, _ccrc4, _ccrc4_eay, + _ccrmd160_ltc_di, _ccrng, _ccrng_drbg_done, _ccrng_drbg_init, + _ccrng_drbg_init_withdrbg, _ccrng_drbg_reseed, _ccrng_ecfips_test_init, + _ccrng_pbkdf2_prng_init, _ccrng_prng, _ccrng_rsafips_test_init, + _ccrng_rsafips_test_set_next, _ccrng_sequence_init, _ccrng_system_done, + _ccrng_system_init, _ccrng_test_done, _ccrng_test_init, _ccrng_trng, + _ccrng_uniform, _ccrsa_block_size, _ccrsa_block_start, _ccrsa_ctx_private_zp, + _ccrsa_ctx_public, _ccrsa_decrypt_eme_pkcs1v15, _ccrsa_decrypt_oaep, + _ccrsa_dump_full_key, _ccrsa_dump_public_key, _ccrsa_eme_pkcs1v15_decode, + _ccrsa_eme_pkcs1v15_decode_safe, _ccrsa_eme_pkcs1v15_encode, _ccrsa_emsa_pkcs1v15_encode, _ccrsa_emsa_pkcs1v15_verify, _ccrsa_emsa_pss_decode, _ccrsa_emsa_pss_encode, _ccrsa_encrypt_eme_pkcs1v15, _ccrsa_encrypt_oaep, _ccrsa_export_priv, _ccrsa_export_priv_size, @@ -751,14 +761,15 @@ exports: _ccaes_arm_ecb_decrypt_mode, _ccaes_arm_ecb_encrypt_mode, _ccaes_arm_ofb_crypt_mode, _ccaes_arm_xts_decrypt_mode, _ccaes_arm_xts_encrypt_mode, _ccsha1_vng_arm_di, _ccsha224_vng_arm_di, _ccsha256_vng_arm64neon_di, - _ccsha256_vng_arm_di, _ccsha384_vng_arm_di, _ccsha512_256_vng_arm_di, - _ccsha512_vng_arm_di ] + _ccsha256_vng_arm_di, _ccsha384_vng_arm_di, _ccsha384_vng_arm_hw_di, + _ccsha512_256_vng_arm_di, _ccsha512_256_vng_arm_hw_di, _ccsha512_vng_arm_di, + _ccsha512_vng_arm_hw_di ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libdispatch.dylib' -current-version: 1462.0.4 +current-version: 1502.0.1 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -785,38 +796,40 @@ exports: __dispatch_runloop_root_queue_perform_4CF, __dispatch_runloop_root_queue_wakeup_4CF, __dispatch_source_set_runloop_timer_4CF, __dispatch_source_type_data_add, __dispatch_source_type_data_or, __dispatch_source_type_data_replace, - __dispatch_source_type_interval, __dispatch_source_type_mach_recv, - __dispatch_source_type_mach_send, __dispatch_source_type_memorypressure, - __dispatch_source_type_memorystatus, __dispatch_source_type_nw_channel, - __dispatch_source_type_proc, __dispatch_source_type_read, - __dispatch_source_type_signal, __dispatch_source_type_sock, - __dispatch_source_type_timer, __dispatch_source_type_vfs, - __dispatch_source_type_vm, __dispatch_source_type_vnode, __dispatch_source_type_write, - __dispatch_source_will_reenable_kevent_4NW, __dispatch_wait_for_enqueuer, - __dispatch_workloop_set_observer_hooks_4IOHID, __dispatch_workloop_should_yield_4NW, - __firehose_spi_version, __os_object_alloc, __os_object_alloc_realized, + __dispatch_source_type_exclaves_notification, __dispatch_source_type_interval, + __dispatch_source_type_mach_recv, __dispatch_source_type_mach_send, + __dispatch_source_type_memorypressure, __dispatch_source_type_memorystatus, + __dispatch_source_type_nw_channel, __dispatch_source_type_proc, + __dispatch_source_type_read, __dispatch_source_type_signal, + __dispatch_source_type_sock, __dispatch_source_type_timer, + __dispatch_source_type_vfs, __dispatch_source_type_vm, __dispatch_source_type_vnode, + __dispatch_source_type_write, __dispatch_source_will_reenable_kevent_4NW, + __dispatch_wait_for_enqueuer, __dispatch_workloop_set_observer_hooks_4IOHID, + __dispatch_workloop_should_yield_4NW, __firehose_spi_version, + __os_object_alloc, __os_object_alloc_bridged, __os_object_alloc_realized, __os_object_dealloc, __os_object_release, __os_object_release_internal, __os_object_release_internal_n, __os_object_release_without_xref_dispose, __os_object_retain, __os_object_retain_internal, __os_object_retain_internal_n, __os_object_retain_with_resurrect, _dispatch_activate, _dispatch_after, - _dispatch_after_f, _dispatch_allocator_layout, _dispatch_apply, - _dispatch_apply_attr_destroy, _dispatch_apply_attr_init, _dispatch_apply_attr_query, - _dispatch_apply_attr_set_parallelism, _dispatch_apply_f, _dispatch_apply_with_attr, - _dispatch_apply_with_attr_f, _dispatch_assert_queue, '_dispatch_assert_queue$V2', - _dispatch_assert_queue_barrier, _dispatch_assert_queue_not, - '_dispatch_assert_queue_not$V2', _dispatch_async, _dispatch_async_and_wait, - _dispatch_async_and_wait_f, _dispatch_async_enforce_qos_class_f, - _dispatch_async_f, _dispatch_async_swift_job, _dispatch_atfork_child, - _dispatch_atfork_parent, _dispatch_atfork_prepare, _dispatch_barrier_async, - _dispatch_barrier_async_and_wait, _dispatch_barrier_async_and_wait_f, - _dispatch_barrier_async_f, _dispatch_barrier_sync, _dispatch_barrier_sync_f, - _dispatch_benchmark, _dispatch_benchmark_f, _dispatch_block_cancel, - _dispatch_block_create, _dispatch_block_create_with_qos_class, - _dispatch_block_create_with_voucher, _dispatch_block_create_with_voucher_and_qos_class, - _dispatch_block_notify, _dispatch_block_perform, _dispatch_block_testcancel, - _dispatch_block_wait, _dispatch_channel_async, _dispatch_channel_async_f, - _dispatch_channel_cancel, _dispatch_channel_create, _dispatch_channel_drain, - _dispatch_channel_drain_f, _dispatch_channel_enqueue, _dispatch_channel_foreach_work_item_peek, + _dispatch_after_f, _dispatch_allocator_layout, _dispatch_allow_send_signals, + _dispatch_apply, _dispatch_apply_attr_destroy, _dispatch_apply_attr_init, + _dispatch_apply_attr_query, _dispatch_apply_attr_set_parallelism, + _dispatch_apply_f, _dispatch_apply_with_attr, _dispatch_apply_with_attr_f, + _dispatch_assert_queue, '_dispatch_assert_queue$V2', _dispatch_assert_queue_barrier, + _dispatch_assert_queue_not, '_dispatch_assert_queue_not$V2', + _dispatch_async, _dispatch_async_and_wait, _dispatch_async_and_wait_f, + _dispatch_async_enforce_qos_class_f, _dispatch_async_f, _dispatch_async_swift_job, + _dispatch_atfork_child, _dispatch_atfork_parent, _dispatch_atfork_prepare, + _dispatch_barrier_async, _dispatch_barrier_async_and_wait, + _dispatch_barrier_async_and_wait_f, _dispatch_barrier_async_f, + _dispatch_barrier_sync, _dispatch_barrier_sync_f, _dispatch_benchmark, + _dispatch_benchmark_f, _dispatch_block_cancel, _dispatch_block_create, + _dispatch_block_create_with_qos_class, _dispatch_block_create_with_voucher, + _dispatch_block_create_with_voucher_and_qos_class, _dispatch_block_notify, + _dispatch_block_perform, _dispatch_block_testcancel, _dispatch_block_wait, + _dispatch_channel_async, _dispatch_channel_async_f, _dispatch_channel_cancel, + _dispatch_channel_create, _dispatch_channel_drain, _dispatch_channel_drain_f, + _dispatch_channel_enqueue, _dispatch_channel_foreach_work_item_peek, _dispatch_channel_foreach_work_item_peek_f, _dispatch_channel_testcancel, _dispatch_channel_wakeup, _dispatch_data_apply, _dispatch_data_apply_f, _dispatch_data_copy_region, _dispatch_data_create, _dispatch_data_create_alloc, @@ -879,7 +892,8 @@ exports: _dispatch_workloop_set_autorelease_frequency, _dispatch_workloop_set_cpupercent, _dispatch_workloop_set_os_workgroup, _dispatch_workloop_set_qos_class, _dispatch_workloop_set_qos_class_floor, _dispatch_workloop_set_scheduler_priority, - _dispatch_write, _dispatch_write_f, _libdispatch_init, _mach_voucher_persona_for_originator, + _dispatch_workloop_set_uses_bound_thread, _dispatch_write, + _dispatch_write_f, _libdispatch_init, _mach_voucher_persona_for_originator, _mach_voucher_persona_self, _os_eventlink_activate, _os_eventlink_associate, _os_eventlink_cancel, _os_eventlink_create, _os_eventlink_create_remote_with_eventlink, _os_eventlink_create_with_port, _os_eventlink_disassociate, @@ -898,18 +912,18 @@ exports: _os_workgroup_leave, _os_workgroup_leave_self, _os_workgroup_max_parallel_threads, _os_workgroup_parallel_create, _os_workgroup_set_working_arena, _os_workgroup_testcancel, _voucher_activity_create_with_data, - _voucher_activity_create_with_location, _voucher_activity_flush, - _voucher_activity_get_logging_preferences, _voucher_activity_get_metadata_buffer, - _voucher_activity_id_allocate, _voucher_activity_initialize_4libtrace, - _voucher_activity_should_send_strings, _voucher_activity_trace, - _voucher_activity_trace_v, _voucher_activity_trace_v_2, _voucher_adopt, - _voucher_copy, _voucher_copy_with_persona_mach_voucher, _voucher_copy_without_importance, - _voucher_create_with_mach_msg, _voucher_decrement_importance_count4CF, - _voucher_get_activity_id, _voucher_get_activity_id_and_creator, - _voucher_get_current_persona, _voucher_get_current_persona_originator_info, - _voucher_get_current_persona_proximate_info, _voucher_kvoucher_debug, - _voucher_process_can_use_arbitrary_personas, _voucher_release, - _voucher_replace_default_voucher, _voucher_retain ] + _voucher_activity_create_with_data_2, _voucher_activity_create_with_location, + _voucher_activity_flush, _voucher_activity_get_logging_preferences, + _voucher_activity_get_metadata_buffer, _voucher_activity_id_allocate, + _voucher_activity_initialize_4libtrace, _voucher_activity_should_send_strings, + _voucher_activity_trace, _voucher_activity_trace_v, _voucher_activity_trace_v_2, + _voucher_adopt, _voucher_copy, _voucher_copy_with_persona_mach_voucher, + _voucher_copy_without_importance, _voucher_create_with_mach_msg, + _voucher_decrement_importance_count4CF, _voucher_get_activity_id, + _voucher_get_activity_id_and_creator, _voucher_get_current_persona, + _voucher_get_current_persona_originator_info, _voucher_get_current_persona_proximate_info, + _voucher_kvoucher_debug, _voucher_process_can_use_arbitrary_personas, + _voucher_release, _voucher_replace_default_voucher, _voucher_retain ] objc-classes: [ OS_dispatch_channel, OS_dispatch_data, OS_dispatch_disk, OS_dispatch_group, OS_dispatch_io, OS_dispatch_mach, OS_dispatch_mach_msg, OS_dispatch_object, OS_dispatch_operation, OS_dispatch_queue, OS_dispatch_queue_attr, @@ -933,41 +947,45 @@ exports: symbols: [ _NSVersionOfLinkTimeLibrary, _NSVersionOfRunTimeLibrary, _NXArgc, _NXArgv, __NSGetExecutablePath, ___progname, __dyld_atfork_parent, __dyld_atfork_prepare, __dyld_dlopen_atfork_child, __dyld_dlopen_atfork_parent, - __dyld_dlopen_atfork_prepare, __dyld_find_foreign_type_protocol_conformance, - __dyld_find_foreign_type_protocol_conformance_on_disk, __dyld_find_protocol_conformance, - __dyld_find_protocol_conformance_on_disk, __dyld_find_unwind_sections, - __dyld_for_each_objc_class, __dyld_for_each_objc_protocol, + __dyld_dlopen_atfork_prepare, __dyld_dlsym_blocked, __dyld_find_foreign_type_protocol_conformance, + __dyld_find_foreign_type_protocol_conformance_on_disk, __dyld_find_pointer_hash_table_entry, + __dyld_find_protocol_conformance, __dyld_find_protocol_conformance_on_disk, + __dyld_find_unwind_sections, __dyld_for_each_objc_class, __dyld_for_each_objc_protocol, __dyld_for_objc_header_opt_ro, __dyld_for_objc_header_opt_rw, __dyld_fork_child, __dyld_get_dlopen_image_header, __dyld_get_image_header, __dyld_get_image_name, __dyld_get_image_slide, __dyld_get_image_uuid, __dyld_get_image_vmaddr_slide, __dyld_get_objc_selector, __dyld_get_prog_image_header, __dyld_get_shared_cache_range, __dyld_get_shared_cache_uuid, - __dyld_has_fix_for_radar, __dyld_has_preoptimized_swift_protocol_conformances, - __dyld_image_count, __dyld_images_for_addresses, __dyld_initializer, - __dyld_is_memory_immutable, __dyld_is_objc_constant, __dyld_is_preoptimized_objc_image_loaded, - __dyld_launch_mode, __dyld_lookup_section_info, __dyld_missing_symbol_abort, - __dyld_objc_class_count, __dyld_objc_notify_register, __dyld_objc_register_callbacks, - __dyld_objc_uses_large_shared_cache, __dyld_process_info_create, - __dyld_process_info_for_each_image, __dyld_process_info_for_each_segment, - __dyld_process_info_get_aot_cache, __dyld_process_info_get_cache, - __dyld_process_info_get_platform, __dyld_process_info_get_state, - __dyld_process_info_notify, __dyld_process_info_notify_main, - __dyld_process_info_notify_release, __dyld_process_info_notify_retain, - __dyld_process_info_release, __dyld_process_info_retain, __dyld_pseudodylib_deregister, + __dyld_get_swift_prespecialized_data, __dyld_has_fix_for_radar, + __dyld_has_preoptimized_swift_protocol_conformances, __dyld_image_count, + __dyld_images_for_addresses, __dyld_initializer, __dyld_is_memory_immutable, + __dyld_is_objc_constant, __dyld_is_preoptimized_objc_image_loaded, + __dyld_is_pseudodylib, __dyld_launch_mode, __dyld_lookup_section_info, + __dyld_missing_symbol_abort, __dyld_objc_class_count, __dyld_objc_notify_register, + __dyld_objc_register_callbacks, __dyld_objc_uses_large_shared_cache, + __dyld_process_info_create, __dyld_process_info_for_each_image, + __dyld_process_info_for_each_segment, __dyld_process_info_get_aot_cache, + __dyld_process_info_get_cache, __dyld_process_info_get_platform, + __dyld_process_info_get_state, __dyld_process_info_notify, + __dyld_process_info_notify_main, __dyld_process_info_notify_release, + __dyld_process_info_notify_retain, __dyld_process_info_release, + __dyld_process_info_retain, __dyld_pseudodylib_deregister, __dyld_pseudodylib_deregister_callbacks, __dyld_pseudodylib_register, - __dyld_pseudodylib_register_callbacks, __dyld_register_driverkit_main, - __dyld_register_for_bulk_image_loads, __dyld_register_for_image_loads, - __dyld_register_func_for_add_image, __dyld_register_func_for_remove_image, - __dyld_shared_cache_contains_path, __dyld_shared_cache_is_locally_built, - __dyld_shared_cache_optimized, __dyld_shared_cache_real_path, - __dyld_swift_optimizations_version, __dyld_visit_objc_classes, - __tlv_atexit, __tlv_bootstrap, __tlv_exit, _dladdr, _dlclose, - _dlerror, _dlopen, _dlopen_audited, _dlopen_from, _dlopen_preflight, - _dlsym, _dyldVersionNumber, _dyldVersionString, _dyld_dynamic_interpose, - _dyld_for_each_installed_shared_cache, _dyld_for_each_installed_shared_cache_with_system_path, - _dyld_get_active_platform, _dyld_get_base_platform, _dyld_get_image_versions, - _dyld_get_min_os_version, _dyld_get_program_min_os_version, - _dyld_get_program_sdk_version, _dyld_get_sdk_version, _dyld_has_inserted_or_interposing_libraries, + __dyld_pseudodylib_register_callbacks, __dyld_register_dlsym_notifier, + __dyld_register_driverkit_main, __dyld_register_for_bulk_image_loads, + __dyld_register_for_image_loads, __dyld_register_func_for_add_image, + __dyld_register_func_for_remove_image, __dyld_shared_cache_contains_path, + __dyld_shared_cache_is_locally_built, __dyld_shared_cache_optimized, + __dyld_shared_cache_real_path, __dyld_swift_optimizations_version, + __dyld_visit_objc_classes, __tlv_atexit, __tlv_bootstrap, + __tlv_exit, _dladdr, _dlclose, _dlerror, _dlopen, _dlopen_audited, + _dlopen_from, _dlopen_preflight, _dlsym, _dyldVersionNumber, + _dyldVersionString, _dyld_dynamic_interpose, _dyld_for_each_installed_shared_cache, + _dyld_for_each_installed_shared_cache_with_system_path, _dyld_get_active_platform, + _dyld_get_base_platform, _dyld_get_image_versions, _dyld_get_min_os_version, + _dyld_get_program_min_os_version, _dyld_get_program_minos_version_token, + _dyld_get_program_sdk_version, _dyld_get_program_sdk_version_token, + _dyld_get_sdk_version, _dyld_has_inserted_or_interposing_libraries, _dyld_image_content_for_section, _dyld_image_content_for_segment, _dyld_image_copy_uuid, _dyld_image_for_each_section_info, _dyld_image_for_each_segment_info, _dyld_image_get_file_path, @@ -987,9 +1005,12 @@ exports: _dyld_shared_cache_get_base_address, _dyld_shared_cache_get_mapped_size, _dyld_shared_cache_is_mapped_private, _dyld_shared_cache_iterate_text, _dyld_shared_cache_pin_mapping, _dyld_shared_cache_some_image_overridden, - _dyld_shared_cache_unpin_mapping, _environ, _macho_arch_name_for_cpu_type, + _dyld_shared_cache_unpin_mapping, _dyld_version_token_at_least, + _dyld_version_token_get_platform, _environ, _macho_arch_name_for_cpu_type, _macho_arch_name_for_mach_header, _macho_best_slice, _macho_best_slice_in_fd, _macho_cpu_type_for_arch_name, _macho_dylib_install_name, + _macho_for_each_defined_rpath, _macho_for_each_dependent_dylib, + _macho_for_each_exported_symbol, _macho_for_each_imported_symbol, _macho_for_each_slice, _macho_for_each_slice_in_fd, dyld_stub_binder ] - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] symbols: [ _NSAddImage, _NSAddLibrary, _NSAddLibraryWithSearching, _NSAddressOfSymbol, @@ -1030,7 +1051,7 @@ exports: tbd-version: 4 targets: [ x86_64-macos, arm64-macos, arm64e-macos ] install-name: '/usr/lib/system/libmacho.dylib' -current-version: 1009 +current-version: 1021.4 parent-umbrella: - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] umbrella: System @@ -1077,7 +1098,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libquarantine.dylib' -current-version: 169 +current-version: 181.0.7 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1105,24 +1126,25 @@ exports: _responsibility_get_uniqueid_responsible_for_pid, _responsibility_init, _responsibility_set_pid_responsible_for_pid ] - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] - symbols: [ _responsibility_get_attribution_for_audittoken, _responsibility_get_responsible_audit_token_for_audit_token, + symbols: [ _qtn_spawnattrs_get_tracking_data, _qtn_spawnattrs_set_tracking_data, + _responsibility_get_attribution_for_audittoken, _responsibility_get_responsible_audit_token_for_audit_token, _responsibility_identity_get_binary_entitlement_data, _responsibility_identity_get_binary_is_platform, _responsibility_identity_get_binary_offset, _responsibility_identity_get_binary_path, _responsibility_identity_get_binary_signing_id, _responsibility_identity_get_binary_team_id, _responsibility_identity_get_csflags, _responsibility_identity_get_hosted_path, _responsibility_identity_get_hosted_team_id, _responsibility_identity_get_persistent_identifier, _responsibility_identity_get_platform, _responsibility_identity_get_sdk, - _responsibility_identity_get_user_uuid, _responsibility_identity_release, - _responsibility_set_audittoken_responsible_for_caller, _responsibility_set_audittoken_responsible_for_self, - _responsibility_set_caller_responsible_for_self, _responsibility_set_hosted_path, - _responsibility_set_hosted_team_id, _responsibility_spawnattrs_getdisclaim, - _responsibility_spawnattrs_setdisclaim ] + _responsibility_identity_get_user_uuid, _responsibility_identity_open_binary_fd, + _responsibility_identity_release, _responsibility_set_audittoken_responsible_for_caller, + _responsibility_set_audittoken_responsible_for_self, _responsibility_set_caller_responsible_for_self, + _responsibility_set_hosted_path, _responsibility_set_hosted_team_id, + _responsibility_spawnattrs_getdisclaim, _responsibility_spawnattrs_setdisclaim ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libremovefile.dylib' -current-version: 70 +current-version: 75 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1140,7 +1162,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_asl.dylib' -current-version: 398 +current-version: 402 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1221,7 +1243,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_blocks.dylib' -current-version: 90 +current-version: 94 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1240,7 +1262,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_c.dylib' -current-version: 1583.0.14 +current-version: 1669.40.2 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1308,48 +1330,49 @@ exports: ___tens_D2A, ___tinytens_D2A, ___tolower, ___tolower_l, ___toupper, ___toupper_l, ___trailz_D2A, ___ulp_D2A, ___ungetc, ___ungetwc, ___vsnprintf_chk, ___vsprintf_chk, ___wcwidth, ___wcwidth_l, - __allocenvstate, __atexit_receipt, __c_locale, __cleanup, - __closeutx, __copyenv, __cthread_init_routine, __deallocenvstate, - __endutxent, __flockfile_debug_stub, __fseeko, __ftello, __fwalk, - __getenvp, __getutxent, __getutxid, __getutxline, __inet_aton_check, - __init_clock_port, __int_to_time, __libc_fork_child, __libc_fork_parent, - __libc_fork_prepare, __libc_initializer, __long_to_time, __mkpath_np, - __mktemp, __openutx, __os_assert_log, __os_assert_log_ctx, - __os_assumes_log, __os_assumes_log_ctx, __os_avoid_tail_call, - __os_crash, __os_crash_callback, __os_crash_fmt, __os_crash_msg, - __os_debug_log, __os_debug_log_error_offset, __os_debug_log_error_str, - __putenvp, __pututxline, __rand48_add, __rand48_mult, __rand48_seed, - __readdir_unlocked, __reclaim_telldir, __seekdir, __setenvp, - __setutxent, __sigaction_nobind, __sigintr, __signal_nobind, - __sigvec_nobind, __sread, __sseek, __subsystem_init, __swrite, - __time32_to_time, __time64_to_time, __time_to_int, __time_to_long, - __time_to_time32, __time_to_time64, __unsetenvp, __utmpxname, - _a64l, _abort, _abort_report_np, _abs, _acl_add_flag_np, _acl_add_perm, - _acl_calc_mask, _acl_clear_flags_np, _acl_clear_perms, _acl_copy_entry, - _acl_copy_ext, _acl_copy_ext_native, _acl_copy_int, _acl_copy_int_native, - _acl_create_entry, _acl_create_entry_np, _acl_delete_def_file, - _acl_delete_entry, _acl_delete_fd_np, _acl_delete_file_np, - _acl_delete_flag_np, _acl_delete_link_np, _acl_delete_perm, - _acl_dup, _acl_free, _acl_from_text, _acl_get_entry, _acl_get_fd, - _acl_get_fd_np, _acl_get_file, _acl_get_flag_np, _acl_get_flagset_np, - _acl_get_link_np, _acl_get_perm_np, _acl_get_permset, _acl_get_permset_mask_np, - _acl_get_qualifier, _acl_get_tag_type, _acl_init, _acl_maximal_permset_mask_np, - _acl_set_fd, _acl_set_fd_np, _acl_set_file, _acl_set_flagset_np, - _acl_set_link_np, _acl_set_permset, _acl_set_permset_mask_np, - _acl_set_qualifier, _acl_set_tag_type, _acl_size, _acl_to_text, - _acl_valid, _acl_valid_fd_np, _acl_valid_file_np, _acl_valid_link, - _addr2ascii, _alarm, _alphasort, _arc4random, _arc4random_addrandom, - _arc4random_buf, _arc4random_stir, _arc4random_uniform, _ascii2addr, - _asctime, _asctime_r, _asprintf, _asprintf_l, _asxprintf, - _asxprintf_exec, _atexit, _atexit_b, _atof, _atof_l, _atoi, - _atoi_l, _atol, _atol_l, _atoll, _atoll_l, _backtrace, _backtrace_async, - _backtrace_from_fp, _backtrace_image_offsets, _backtrace_set_pcs_func, - _backtrace_symbols, _backtrace_symbols_fd, _basename, _basename_r, - _bcopy, _brk, _bsd_signal, _bsearch, _bsearch_b, _btowc, _btowc_l, - _catclose, _catgets, _catopen, _cfgetispeed, _cfgetospeed, - _cfmakeraw, _cfsetispeed, _cfsetospeed, _cfsetspeed, _cgetcap, - _cgetclose, _cgetent, _cgetfirst, _cgetmatch, _cgetnext, _cgetnum, - _cgetset, _cgetstr, _cgetustr, _chmodx_np, _clearerr, _clearerr_unlocked, + ___xlocale_C_collate, __allocenvstate, __atexit_receipt, __c_locale, + __cleanup, __closeutx, __copyenv, __cthread_init_routine, + __deallocenvstate, __endutxent, __flockfile_debug_stub, __fseeko, + __ftello, __fwalk, __getenvp, __getutxent, __getutxid, __getutxline, + __inet_aton_check, __init_clock_port, __int_to_time, __libc_fork_child, + __libc_fork_parent, __libc_fork_prepare, __libc_initializer, + __long_to_time, __mkpath_np, __mktemp, __openutx, __os_assert_log, + __os_assert_log_ctx, __os_assumes_log, __os_assumes_log_ctx, + __os_avoid_tail_call, __os_crash, __os_crash_callback, __os_crash_fmt, + __os_crash_msg, __os_debug_log, __os_debug_log_error_offset, + __os_debug_log_error_str, __putenvp, __pututxline, __rand48_add, + __rand48_mult, __rand48_seed, __readdir_unlocked, __reclaim_telldir, + __seekdir, __setenvp, __setutxent, __sigaction_nobind, __sigintr, + __signal_nobind, __sigvec_nobind, __sread, __sseek, __subsystem_init, + __swrite, __time32_to_time, __time64_to_time, __time_to_int, + __time_to_long, __time_to_time32, __time_to_time64, __unsetenvp, + __utmpxname, _a64l, _abort, _abort_report_np, _abs, _acl_add_flag_np, + _acl_add_perm, _acl_calc_mask, _acl_clear_flags_np, _acl_clear_perms, + _acl_copy_entry, _acl_copy_ext, _acl_copy_ext_native, _acl_copy_int, + _acl_copy_int_native, _acl_create_entry, _acl_create_entry_np, + _acl_delete_def_file, _acl_delete_entry, _acl_delete_fd_np, + _acl_delete_file_np, _acl_delete_flag_np, _acl_delete_link_np, + _acl_delete_perm, _acl_dup, _acl_free, _acl_from_text, _acl_get_entry, + _acl_get_fd, _acl_get_fd_np, _acl_get_file, _acl_get_flag_np, + _acl_get_flagset_np, _acl_get_link_np, _acl_get_perm_np, _acl_get_permset, + _acl_get_permset_mask_np, _acl_get_qualifier, _acl_get_tag_type, + _acl_init, _acl_maximal_permset_mask_np, _acl_set_fd, _acl_set_fd_np, + _acl_set_file, _acl_set_flagset_np, _acl_set_link_np, _acl_set_permset, + _acl_set_permset_mask_np, _acl_set_qualifier, _acl_set_tag_type, + _acl_size, _acl_to_text, _acl_valid, _acl_valid_fd_np, _acl_valid_file_np, + _acl_valid_link, _addr2ascii, _alarm, _alphasort, _arc4random, + _arc4random_addrandom, _arc4random_buf, _arc4random_stir, + _arc4random_uniform, _ascii2addr, _asctime, _asctime_r, _asprintf, + _asprintf_l, _asxprintf, _asxprintf_exec, _at_quick_exit, + _atexit, _atexit_b, _atof, _atof_l, _atoi, _atoi_l, _atol, + _atol_l, _atoll, _atoll_l, _backtrace, _backtrace_async, _backtrace_from_fp, + _backtrace_image_offsets, _backtrace_set_pcs_func, _backtrace_symbols, + _backtrace_symbols_fd, _basename, _basename_r, _bcopy, _brk, + _bsd_signal, _bsearch, _bsearch_b, _btowc, _btowc_l, _catclose, + _catgets, _catopen, _cfgetispeed, _cfgetospeed, _cfmakeraw, + _cfsetispeed, _cfsetospeed, _cfsetspeed, _cgetcap, _cgetclose, + _cgetent, _cgetfirst, _cgetmatch, _cgetnext, _cgetnum, _cgetset, + _cgetstr, _cgetustr, _chmodx_np, _clearerr, _clearerr_unlocked, _clock, _clock_getres, _clock_gettime, _clock_gettime_nsec_np, _clock_port, _clock_sem, _clock_settime, _closedir, _compat_mode, _confstr, _copy_printf_domain, _creat, '_creat$NOCANCEL', @@ -1412,23 +1435,23 @@ exports: _iswspecial, _iswspecial_l, _iswupper, _iswupper_l, _iswxdigit, _iswxdigit_l, _isxdigit, _isxdigit_l, _jrand48, _kOSThermalNotificationPressureLevelName, _killpg, _l64a, _labs, _lchflags, _lchmod, _lcong48, _ldiv, - _lfind, _link_addr, _link_ntoa, _llabs, _lldiv, _localeconv, - _localeconv_l, _localtime, _localtime_r, _lockf, '_lockf$NOCANCEL', - _login, _login_tty, _logout, _logwtmp, _lrand48, _lsearch, - _lstatx_np, _lutimes, _mblen, _mblen_l, _mbmb, _mbrlen, _mbrlen_l, - _mbrrune, _mbrtowc, _mbrtowc_l, _mbrune, _mbsinit, _mbsinit_l, - _mbsnrtowcs, _mbsnrtowcs_l, _mbsrtowcs, _mbsrtowcs_l, _mbstowcs, - _mbstowcs_l, _mbtowc, _mbtowc_l, _memmem, _memset_s, _mergesort, - _mergesort_b, _mkdirx_np, _mkdtemp, _mkdtempat_np, _mkfifox_np, - _mkostemp, _mkostemps, _mkostempsat_np, _mkpath_np, _mkpathat_np, - _mkstemp, _mkstemp_dprotected_np, _mkstemps, _mkstempsat_np, - _mktemp, _mktime, _monaddition, _moncontrol, _moncount, _moninit, - _monitor, _monoutput, _monreset, _monstartup, _mpool_close, - _mpool_filter, _mpool_get, _mpool_new, _mpool_open, _mpool_put, - _mpool_sync, _mrand48, _nanosleep, '_nanosleep$NOCANCEL', - _new_printf_comp, _new_printf_domain, _newlocale, _nextwctype, - _nextwctype_l, _nftw, _nice, _nl_langinfo, _nl_langinfo_l, - _nrand48, _nvis, _off32, _off64, _offtime, _open_memstream, + _lfind, _libc_set_introspection_hooks, _link_addr, _link_ntoa, + _llabs, _lldiv, _localeconv, _localeconv_l, _localtime, _localtime_r, + _lockf, '_lockf$NOCANCEL', _login, _login_tty, _logout, _logwtmp, + _lrand48, _lsearch, _lstatx_np, _lutimes, _mblen, _mblen_l, + _mbmb, _mbrlen, _mbrlen_l, _mbrrune, _mbrtowc, _mbrtowc_l, + _mbrune, _mbsinit, _mbsinit_l, _mbsnrtowcs, _mbsnrtowcs_l, + _mbsrtowcs, _mbsrtowcs_l, _mbstowcs, _mbstowcs_l, _mbtowc, + _mbtowc_l, _memmem, _memset_s, _mergesort, _mergesort_b, _mkdirx_np, + _mkdtemp, _mkdtempat_np, _mkfifox_np, _mkostemp, _mkostemps, + _mkostempsat_np, _mkpath_np, _mkpathat_np, _mkstemp, _mkstemp_dprotected_np, + _mkstemps, _mkstempsat_np, _mktemp, _mktime, _monaddition, + _moncontrol, _moncount, _moninit, _monitor, _monoutput, _monreset, + _monstartup, _mpool_close, _mpool_filter, _mpool_get, _mpool_new, + _mpool_open, _mpool_put, _mpool_sync, _mrand48, _nanosleep, + '_nanosleep$NOCANCEL', _new_printf_comp, _new_printf_domain, + _newlocale, _nextwctype, _nextwctype_l, _nftw, _nice, _nl_langinfo, + _nl_langinfo_l, _nrand48, _nvis, _offtime, _open_memstream, _open_with_subsystem, _open_wmemstream, _opendev, _opendir, _openpty, _openx_np, _optarg, _opterr, _optind, _optopt, _optreset, _pause, '_pause$NOCANCEL', _pclose, _perror, _popen, '_popen$DARWIN_EXTSN', @@ -1436,27 +1459,26 @@ exports: _psignal, _psort, _psort_b, _psort_r, _ptsname, _ptsname_r, _putc, _putc_unlocked, _putchar, _putchar_unlocked, _putenv, _puts, _pututxline, _putw, _putwc, _putwc_l, _putwchar, _putwchar_l, - _qsort, _qsort_b, _qsort_r, _querylocale, _radixsort, _raise, - _rand, _rand_r, _random, _rb_tree_count, _rb_tree_find_node, + _qsort, _qsort_b, _qsort_r, _querylocale, _quick_exit, _radixsort, + _raise, _rand, _rand_r, _random, _rb_tree_count, _rb_tree_find_node, _rb_tree_find_node_geq, _rb_tree_find_node_leq, _rb_tree_init, _rb_tree_insert_node, _rb_tree_iterate, _rb_tree_remove_node, - _readdir, _readdir_r, _readpassphrase, _reallocf, _realpath, - '_realpath$DARWIN_EXTSN', _recv, '_recv$NOCANCEL', _regcomp, - _regcomp_l, _regerror, _regexec, _regfree, _register_printf_domain_function, - _register_printf_domain_render_std, _regncomp, _regncomp_l, - _regnexec, _regwcomp, _regwcomp_l, _regwexec, _regwncomp, - _regwncomp_l, _regwnexec, _remove, _remque, _rewind, _rewinddir, - _rindex, _rpmatch, _sbrk, _scandir, _scandir_b, _scanf, _scanf_l, - _seed48, _seekdir, _send, '_send$NOCANCEL', _setbuf, _setbuffer, - _setenv, _sethostid, _sethostname, _setinvalidrune, _setipv4sourcefilter, - _setkey, _setlinebuf, _setlocale, _setlogin, _setmode, _setpgrp, - _setprogname, _setrgid, _setruid, _setrunelocale, _setsourcefilter, - _setstate, _settimeofday, _setttyent, _setusershell, _setutxent, - _setutxent_wtmp, _setvbuf, _sigaction, _sigaddset, _sigaltstack, - _sigblock, _sigdelset, _sigemptyset, _sigfillset, _sighold, - _sigignore, _siginterrupt, _sigismember, _signal, _sigpause, - '_sigpause$NOCANCEL', _sigrelse, _sigset, _sigsetmask, _sigvec, - _skip, _sl_add, _sl_find, _sl_free, _sl_init, _sleep, '_sleep$NOCANCEL', + _readdir, _readdir_r, _readpassphrase, _realpath, '_realpath$DARWIN_EXTSN', + _recv, '_recv$NOCANCEL', _regcomp, _regcomp_l, _regerror, + _regexec, _regfree, _register_printf_domain_function, _register_printf_domain_render_std, + _regncomp, _regncomp_l, _regnexec, _regwcomp, _regwcomp_l, + _regwexec, _regwncomp, _regwncomp_l, _regwnexec, _remove, + _remque, _rewind, _rewinddir, _rindex, _rpmatch, _sbrk, _scandir, + _scandir_b, _scanf, _scanf_l, _seed48, _seekdir, _send, '_send$NOCANCEL', + _setbuf, _setbuffer, _setenv, _sethostid, _sethostname, _setinvalidrune, + _setipv4sourcefilter, _setkey, _setlinebuf, _setlocale, _setlogin, + _setmode, _setpgrp, _setprogname, _setrgid, _setruid, _setrunelocale, + _setsourcefilter, _setstate, _settimeofday, _setttyent, _setusershell, + _setutxent, _setutxent_wtmp, _setvbuf, _sigaction, _sigaddset, + _sigaltstack, _sigblock, _sigdelset, _sigemptyset, _sigfillset, + _sighold, _sigignore, _siginterrupt, _sigismember, _signal, + _sigpause, '_sigpause$NOCANCEL', _sigrelse, _sigset, _sigsetmask, + _sigvec, _sl_add, _sl_find, _sl_free, _sl_init, _sleep, '_sleep$NOCANCEL', _snprintf, _snprintf_l, _snvis, _sockatmark, _sprintf, _sprintf_l, _sradixsort, _srand, _srand48, _sranddev, _srandom, _srandomdev, _sscanf, _sscanf_l, _stat_with_subsystem, _statvfs, _statx_np, @@ -1522,6 +1544,7 @@ exports: _wmemcmp, _wmemcpy, _wmemmove, _wmemset, _wordexp, _wordfree, _wprintf, _wprintf_l, _wscanf, _wscanf_l, _wtmpxname, _xprintf, _xprintf_exec ] + weak-symbols: [ __os_debug_log_redirect_func ] reexports: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1534,7 +1557,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_collections.dylib' -current-version: 1583.0.14 +current-version: 1669.40.2 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1564,7 +1587,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_configuration.dylib' -current-version: 1296.0.1 +current-version: 1347.40.1 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1600,8 +1623,13 @@ exports: arm64e-macos, arm64e-maccatalyst ] symbols: [ _CMFSSEAM_DEFAULT, _CONTAINER_NOTIFY_USER_INVALIDATED, _CONTAINER_PERSONA_CURRENT, _CONTAINER_PERSONA_PRIMARY, __container_init, __container_query_get_servicing_pid, - __container_references_get_servicing_pid, _container_acquire_sandbox_extension, - _container_audit_token_copy_codesign_hash, _container_audit_token_copy_codesign_identifier, + __container_references_get_servicing_pid, __container_traverse_continuation_create, + __container_traverse_continuation_free, __container_traverse_continuation_pop, + __container_traverse_continuation_push, __container_traverse_get_last_path_component, + __container_traverse_path_pop, __container_traverse_path_push, + __container_traverse_state_deinit, __container_traverse_state_init, + _container_acquire_sandbox_extension, _container_audit_token_copy_codesign_hash, + _container_audit_token_copy_codesign_identifier, _container_audit_token_copy_codesign_team_identifier, _container_audit_token_copy_entitlement, _container_audit_token_copy_executable_name, _container_audit_token_for_pid, _container_audit_token_get_codesign_status, _container_audit_token_get_egid, _container_audit_token_get_euid, @@ -1615,15 +1643,16 @@ exports: _container_client_copy_decoded_from_xpc_object, _container_client_copy_encoded_xpc_object, _container_client_copy_entitlement, _container_client_create_from_audit_token, _container_client_get_audit_token, _container_client_get_codesign_identifier, - _container_client_get_egid, _container_client_get_euid, _container_client_get_persona_unique_string, + _container_client_get_codesign_team_identifier, _container_client_get_egid, + _container_client_get_euid, _container_client_get_persona_unique_string, _container_client_get_pid, _container_client_get_platform, _container_client_initializer, _container_client_is_alive, _container_client_is_platform_binary, _container_client_is_sandboxed, _container_client_is_signature_valid, _container_client_is_signed, _container_client_is_test_client, _container_codesign_copy_cdhash, - _container_codesign_copy_cs_identity, _container_codesign_copy_current_identifier, - _container_codesign_get_self_audit_token, _container_codesign_get_status, - _container_copy_client, _container_copy_code_signing_info_for_identifier, + _container_codesign_copy_cs_identity, _container_codesign_copy_cs_team_identifier, + _container_codesign_copy_current_identifier, _container_codesign_get_self_audit_token, + _container_codesign_get_status, _container_copy_client, _container_copy_code_signing_info_for_identifier, _container_copy_from_path, _container_copy_info, _container_copy_info_value_for_key, _container_copy_object, _container_copy_path, _container_copy_persona_unique_strings, _container_copy_sandbox_token, _container_copy_unlocalized_description, @@ -1652,8 +1681,8 @@ exports: _container_frozenset_create, _container_frozenset_create_from_external_bytes, _container_frozenset_destroy, _container_frozenset_enumerate_matches, _container_frozenset_get_container_class_of_container_at_index, - _container_frozenset_get_count, _container_frozenset_get_generation, - _container_frozenset_get_identifier_of_container_at_index, + _container_frozenset_get_count, _container_frozenset_get_creator_of_container_at_index, + _container_frozenset_get_generation, _container_frozenset_get_identifier_of_container_at_index, _container_frozenset_get_is_new_of_container_at_index, _container_frozenset_get_is_transient_of_container_at_index, _container_frozenset_get_path_of_container_at_index, _container_frozenset_get_persona_unique_string_of_container_at_index, _container_frozenset_get_stored_string, _container_frozenset_get_uid_of_container_at_index, @@ -1664,46 +1693,50 @@ exports: _container_fs_item_exists_at, _container_fs_load_plist_at, _container_fs_path_at, _container_fs_resolve_dirent_type_at, _container_get_all_with_class_for_current_user, _container_get_class, - _container_get_error_description, _container_get_identifier, - _container_get_info, _container_get_info_value_for_key, _container_get_path, - _container_get_persona_unique_string, _container_get_uid, - _container_get_unique_path_component, _container_get_user_managed_assets_relative_path, - _container_group_container_identifiers_for_current_user, _container_internal_get_first_boot_uuid, - _container_invalidate_code_signing_cache, _container_is_equal, - _container_is_new, _container_is_transient, _container_log_client_fault_logging_is_enabled, - _container_log_error, _container_log_error_with_faults, _container_log_ext_error, + _container_get_creator_codesign_identifier, _container_get_error_description, + _container_get_identifier, _container_get_info, _container_get_info_value_for_key, + _container_get_path, _container_get_persona_unique_string, + _container_get_uid, _container_get_unique_path_component, + _container_get_user_managed_assets_relative_path, _container_group_container_identifiers_for_current_user, + _container_internal_get_first_boot_uuid, _container_invalidate_code_signing_cache, + _container_is_equal, _container_is_new, _container_is_transient, + _container_log_client_fault_logging_is_enabled, _container_log_error, + _container_log_error_with_faults, _container_log_ext_error, _container_log_ext_error_with_faults, _container_log_handle_for_category, _container_log_replication_disable, _container_log_replication_enable_to_uid_relative_path, _container_log_replication_prune_for_uid, _container_log_set_client_fault_logging, _container_object_copy, _container_object_create, _container_object_create_blank, - _container_object_free, _container_object_get_class, _container_object_get_identifier, - _container_object_get_info, _container_object_get_path, _container_object_get_persona_unique_string, + _container_object_free, _container_object_get_class, _container_object_get_creator_codesign_identifier, + _container_object_get_identifier, _container_object_get_info, + _container_object_get_path, _container_object_get_persona_unique_string, _container_object_get_query, _container_object_get_sandbox_token, _container_object_get_uid, _container_object_get_unique_path_component, _container_object_get_user_managed_assets_relative_path, _container_object_get_uuid, _container_object_is_new, _container_object_is_transient, _container_object_sandbox_extension_activate, _container_object_set_backing_store_from_query, - _container_object_set_class, _container_object_set_info, _container_object_set_path, - _container_object_set_sandbox_token, _container_object_set_transient, - _container_object_set_unique_path_component, _container_object_set_user_managed_assets_relative_path, - _container_object_set_uuid, _container_object_update_metadata, - _container_operation_complete_background_tasks, _container_operation_delete, - _container_operation_delete_array, _container_operation_delete_reclaim_disk_space, - _container_paths_context_create, _container_paths_context_free, - _container_paths_context_set_class, _container_paths_context_set_flags, - _container_paths_context_set_persona_unique_string, _container_paths_context_set_transient, - _container_paths_context_set_uid, _container_paths_copy_container_at, - _container_paths_copy_container_from_path, _container_paths_copy_container_root_path_for_context, - _container_paths_copy_uid_home_relative, _container_paths_create_uid_home_relative, - _container_paths_enumerate_containers_at, _container_perfect_hash_copyout_external_bytes, - _container_perfect_hash_count, _container_perfect_hash_create, - _container_perfect_hash_create_from_external_bytes, _container_perfect_hash_destroy, - _container_perfect_hash_index_of, _container_perfect_hash_num_indexes, - _container_perform_with_client_context, _container_persona_collect_all_ids, - _container_persona_convert_unique_string_to_persona_uid, _container_persona_foreach, - _container_process_restored_container, _container_pwd_copy_user_home_path, - _container_pwd_for_name, _container_pwd_for_uid, _container_query_copy, - _container_query_count_results, _container_query_create, _container_query_create_from_container, + _container_object_set_class, _container_object_set_creator_codesign_identifier, + _container_object_set_info, _container_object_set_is_new, + _container_object_set_path, _container_object_set_sandbox_token, + _container_object_set_transient, _container_object_set_unique_path_component, + _container_object_set_user_managed_assets_relative_path, _container_object_set_uuid, + _container_object_update_metadata, _container_operation_complete_background_tasks, + _container_operation_delete, _container_operation_delete_array, + _container_operation_delete_reclaim_disk_space, _container_paths_context_create, + _container_paths_context_free, _container_paths_context_set_class, + _container_paths_context_set_flags, _container_paths_context_set_persona_unique_string, + _container_paths_context_set_transient, _container_paths_context_set_uid, + _container_paths_copy_container_at, _container_paths_copy_container_from_path, + _container_paths_copy_container_root_path_for_context, _container_paths_copy_uid_home_relative, + _container_paths_create_uid_home_relative, _container_paths_enumerate_containers_at, + _container_perfect_hash_copyout_external_bytes, _container_perfect_hash_count, + _container_perfect_hash_create, _container_perfect_hash_create_from_external_bytes, + _container_perfect_hash_destroy, _container_perfect_hash_index_of, + _container_perfect_hash_num_indexes, _container_perform_with_client_context, + _container_persona_collect_all_ids, _container_persona_convert_unique_string_to_persona_uid, + _container_persona_foreach, _container_process_restored_container, + _container_pwd_copy_user_home_path, _container_pwd_for_name, + _container_pwd_for_uid, _container_query_copy, _container_query_count_results, + _container_query_create, _container_query_create_from_container, _container_query_free, _container_query_get_last_error, _container_query_get_single_result, _container_query_iterate_results_sync, _container_query_iterate_results_with_identifier_sync, _container_query_iterate_results_with_subquery_sync, _container_query_operation_set_client, @@ -1711,13 +1744,13 @@ exports: _container_query_set_class, _container_query_set_group_identifiers, _container_query_set_identifiers, _container_query_set_include_other_owners, _container_query_set_persona_unique_string, _container_query_set_transient, - _container_query_set_uid, _container_realpath, _container_recreate_structure, - _container_references_get_last_error, _container_regenerate_uuid, - _container_repair_user_data, _container_replace, _container_retry_test, - _container_sandbox_extension_consume, _container_sandbox_extension_revoke, - _container_sandbox_issue_custom_extension, _container_sandbox_issue_extension, - _container_seam_fs_ensure_lazy_loaded, _container_seam_fs_reset, - _container_seam_fs_set_common, _container_serialize_copy_deserialized_reference, + _container_query_set_uid, _container_realpath, _container_realpathat, + _container_recreate_structure, _container_references_get_last_error, + _container_regenerate_uuid, _container_repair_user_data, _container_replace, + _container_retry_test, _container_sandbox_extension_consume, + _container_sandbox_extension_revoke, _container_sandbox_issue_custom_extension, + _container_sandbox_issue_extension, _container_seam_fs_ensure_lazy_loaded, + _container_seam_fs_reset, _container_seam_fs_set_common, _container_serialize_copy_deserialized_reference, _container_serialize_copy_serialized_reference, _container_set_code_signing_info_for_identifier, _container_set_data_protection_for_current_user, _container_set_info_value, _container_set_test_lock, _container_stage_shared_system_content, @@ -1726,6 +1759,17 @@ exports: _container_string_rom_destroy, _container_string_rom_index_of, _container_string_rom_string_at_index, _container_subdirectories_for_class, _container_system_group_path_for_identifier, _container_system_path_for_identifier, + _container_test_set_locks_and_restart, _container_traverse_directory, + _container_traverse_node_copy, _container_traverse_node_copy_unlocalized_description, + _container_traverse_node_free, _container_traverse_node_get_depth_from_origin, + _container_traverse_node_get_name, _container_traverse_node_get_optional_alloc_size, + _container_traverse_node_get_optional_dp_class, _container_traverse_node_get_optional_file_id, + _container_traverse_node_get_optional_flags, _container_traverse_node_get_optional_gid, + _container_traverse_node_get_optional_link_count, _container_traverse_node_get_optional_mode, + _container_traverse_node_get_optional_parent_fd, _container_traverse_node_get_optional_uid, + _container_traverse_node_get_path, _container_traverse_node_get_subordinate_count, + _container_traverse_node_is_directory, _container_traverse_node_is_regular_file, + _container_traverse_node_is_symlink, _container_traverse_node_optional_has_acl, _container_update_with_container, _container_user_managed_assets_path, _container_user_managed_assets_relative_path, _container_xpc_connection_is_shared, _container_xpc_create_connection, _container_xpc_decode_container_object, @@ -1773,7 +1817,8 @@ exports: __libcoreservices_fork_child, __set_user_dir_suffix, _sysdir_get_next_search_path_enumeration, _sysdir_start_search_path_enumeration, _sysdir_start_search_path_enumeration_private ] - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] - symbols: [ __idle_exit ] + symbols: [ ___user_relative_dirname_with_hints, __dirhelper_relative_with_hints, + __idle_exit ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, @@ -1826,13 +1871,14 @@ parent-umbrella: exports: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] - symbols: [ _DarwinDirectoryRecordStoreApply, _DarwinDirectoryRecordStoreApplyWithFilter ] + symbols: [ _DarwinDirectoryGetGeneration, _DarwinDirectoryRecordStoreApply, + _DarwinDirectoryRecordStoreApplyWithFilter ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_dnssd.dylib' -current-version: 2200.0.8 +current-version: 2559.40.32 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -1844,6 +1890,7 @@ exports: _DNSServiceAttrSetFailoverPolicy, _DNSServiceAttrSetValidationData, _DNSServiceAttrSetValidationPolicy, _DNSServiceAttributeCreate, _DNSServiceAttributeDeallocate, _DNSServiceAttributeSetAAAAPolicy, + _DNSServiceAttributeSetHostKeyHash, _DNSServiceAttributeSetResolverOverride, _DNSServiceAttributeSetTimestamp, _DNSServiceBrowse, _DNSServiceBrowseEx, _DNSServiceConstructFullName, _DNSServiceCreateConnection, _DNSServiceCreateDelegateConnection, _DNSServiceEnumerateDomains, @@ -1866,10 +1913,27 @@ exports: _kDNSServiceAttributeAAAAFallback ] --- !tapi-tbd tbd-version: 4 +targets: [ x86_64-macos, arm64-macos, arm64e-macos ] +install-name: '/usr/lib/system/libsystem_eligibility.dylib' +current-version: 129.40.7 +parent-umbrella: + - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] + umbrella: System +exports: + - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] + symbols: [ _load_eligibility_plist, _os_eligibility_domain_for_name, + _os_eligibility_dump_sysdiagnose_data_to_dir, _os_eligibility_force_domain_answer, + _os_eligibility_force_domain_set_answers, _os_eligibility_get_all_domain_answers, + _os_eligibility_get_domain_answer, _os_eligibility_get_domain_notification_name, + _os_eligibility_get_internal_state, _os_eligibility_get_state_dump, + _os_eligibility_reset_all_domains, _os_eligibility_reset_domain, + _os_eligibility_set_input, _os_eligibility_set_test_mode ] +--- !tapi-tbd +tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_featureflags.dylib' -current-version: 85 +current-version: 94 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -2004,54 +2068,21 @@ exports: _yp_next, _yp_order, _yp_unbind, _yperr_string, _ypprot_err ] --- !tapi-tbd tbd-version: 4 -targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] +targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_kernel.dylib' -current-version: 10002.1.11 +current-version: 11215.41.2 parent-umbrella: - - targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] + - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] umbrella: System exports: - - targets: [ i386-macos, i386-maccatalyst ] - symbols: [ ___aio_suspend, ___close, ___fsync, ___msgrcv, ___msgsnd, - ___poll, ___pread, ___preadv, ___pwrite, ___pwritev, ___read, - ___readv, ___sem_wait, ___waitid, ___write, ___writev, __mach_make_memory_entry, - __sysenter_trap, '_accept$NOCANCEL$UNIX2003', '_accept$UNIX2003', - '_aio_suspend$NOCANCEL$UNIX2003', '_aio_suspend$UNIX2003', - '_bind$UNIX2003', '_chmod$UNIX2003', '_close$NOCANCEL$UNIX2003', - '_close$UNIX2003', '_connect$NOCANCEL$UNIX2003', '_connect$UNIX2003', - '_fchmod$UNIX2003', '_fcntl$NOCANCEL$UNIX2003', '_fcntl$UNIX2003', - '_fsync$NOCANCEL$UNIX2003', '_fsync$UNIX2003', '_getattrlist$UNIX2003', - '_getpeername$UNIX2003', '_getrlimit$UNIX2003', '_getsockname$UNIX2003', - '_kill$UNIX2003', '_lchown$UNIX2003', '_listen$UNIX2003', - _mach_host_self_, _mach_vm_region_info, _mach_vm_region_info_64, - '_mmap$UNIX2003', '_mprotect$UNIX2003', '_msgctl$UNIX2003', - '_msgrcv$NOCANCEL$UNIX2003', '_msgrcv$UNIX2003', '_msgsnd$NOCANCEL$UNIX2003', - '_msgsnd$UNIX2003', '_msync$NOCANCEL$UNIX2003', '_msync$UNIX2003', - '_munmap$UNIX2003', '_open$NOCANCEL$UNIX2003', '_open$UNIX2003', - '_poll$NOCANCEL$UNIX2003', '_poll$UNIX2003', '_pread$NOCANCEL$UNIX2003', - '_pread$UNIX2003', '_pselect$NOCANCEL$UNIX2003', '_pselect$UNIX2003', - '_pwrite$NOCANCEL$UNIX2003', '_pwrite$UNIX2003', '_read$NOCANCEL$UNIX2003', - '_read$UNIX2003', '_readv$NOCANCEL$UNIX2003', '_readv$UNIX2003', - '_recvfrom$NOCANCEL$UNIX2003', '_recvfrom$UNIX2003', '_recvmsg$NOCANCEL$UNIX2003', - '_recvmsg$UNIX2003', '_select$NOCANCEL$UNIX2003', '_select$UNIX2003', - '_sem_wait$NOCANCEL$UNIX2003', '_sem_wait$UNIX2003', '_semctl$UNIX2003', - '_sendmsg$NOCANCEL$UNIX2003', '_sendmsg$UNIX2003', '_sendto$NOCANCEL$UNIX2003', - '_sendto$UNIX2003', '_setattrlist$UNIX2003', _setpgrp, '_setregid$UNIX2003', - '_setreuid$UNIX2003', '_setrlimit$UNIX2003', '_shmctl$UNIX2003', - _sigaltstack, '_sigsuspend$NOCANCEL$UNIX2003', '_sigsuspend$UNIX2003', - '_socketpair$UNIX2003', _task_wire, _vm_map_64, _vm_map_exec_lockdown, - _vm_mapped_pages_info, _vm_region, _vm_region_recurse, '_waitid$NOCANCEL$UNIX2003', - '_waitid$UNIX2003', '_write$NOCANCEL$UNIX2003', '_write$UNIX2003', - '_writev$NOCANCEL$UNIX2003', '_writev$UNIX2003', tramp_cerror, - tramp_cerror_nocancel ] - - targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst ] + - targets: [ x86_64-macos, x86_64-maccatalyst ] symbols: [ '_fstat$INODE64', '_fstatat$INODE64', '_fstatfs$INODE64', '_getfsstat$INODE64', _i386_get_ldt, _i386_set_ldt, '_lstat$INODE64', - '_stat$INODE64', '_statfs$INODE64' ] - - targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] + '_pselect$1050', '_select$1050', '_stat$INODE64', '_statfs$INODE64' ] + - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] symbols: [ _NDR_record, _____sigwait_nocancel, ____kernelVersionNumber, ____kernelVersionString, ___abort_with_payload, ___accept, ___accept_nocancel, ___access_extended, ___aio_suspend_nocancel, @@ -2150,6 +2181,7 @@ exports: __kernelrpc_mach_port_special_reply_port_reset_link, __kernelrpc_mach_port_swap_guard, __kernelrpc_mach_port_type, __kernelrpc_mach_port_type_trap, __kernelrpc_mach_port_unguard, __kernelrpc_mach_port_unguard_trap, + __kernelrpc_mach_ports_lookup3, __kernelrpc_mach_ports_register3, __kernelrpc_mach_task_is_self, __kernelrpc_mach_vm_allocate, __kernelrpc_mach_vm_allocate_trap, __kernelrpc_mach_vm_deallocate, __kernelrpc_mach_vm_deallocate_trap, __kernelrpc_mach_vm_map, @@ -2164,43 +2196,52 @@ exports: __mach_errors, __mach_fork_child, __mach_snprintf, __mach_vsnprintf, __os_alloc_once_table, __os_xbs_chrooted, __register_gethostuuid_callback, __thread_set_tsd_base, _abort_with_payload, _abort_with_reason, - _accept, _access, _accessx_np, _acct, _act_get_state, _act_set_state, - _adjtime, _aio_cancel, _aio_error, _aio_fsync, _aio_read, - _aio_return, _aio_suspend, _aio_write, _audit, _audit_session_join, - _audit_session_port, _audit_session_self, _auditctl, _auditon, - _bind, _bootstrap_port, _cerror, _cerror_nocancel, _change_fdguard_np, - _chdir, _chflags, _chmod, _chown, _chroot, _clock_alarm, _clock_alarm_reply, + _accept, '_accept$NOCANCEL', _access, _accessx_np, _acct, + _act_get_state, _act_set_state, _adjtime, _aio_cancel, _aio_error, + _aio_fsync, _aio_read, _aio_return, _aio_suspend, '_aio_suspend$NOCANCEL', + _aio_write, _audit, _audit_session_join, _audit_session_port, + _audit_session_self, _auditctl, _auditon, _bind, _bootstrap_port, + _cerror, _cerror_nocancel, _change_fdguard_np, _chdir, _chflags, + _chmod, _chown, _chroot, _clock_alarm, _clock_alarm_reply, _clock_get_attributes, _clock_get_time, _clock_set_attributes, _clock_set_time, _clock_sleep, _clock_sleep_trap, _clonefile, - _clonefileat, _close, _coalition_create, _coalition_info_debug_info, - _coalition_info_resource_usage, _coalition_info_set_efficiency, - _coalition_info_set_name, _coalition_ledger_set_logical_writes_limit, - _coalition_reap, _coalition_terminate, _connect, _connectx, - _csops, _csops_audittoken, _csr_check, _csr_get_active_config, - _debug_control_port_for_pid, _debug_syscall_reject, _debug_syscall_reject_config, - _denap_boost_assertion_token, _disconnectx, _dup, _dup2, _errno, - _etap_trace_thread, _exc_server, _exc_server_routine, _exception_raise, - _exception_raise_state, _exception_raise_state_identity, _exchangedata, - _exclaves_boot, _exclaves_endpoint_call, _exclaves_named_buffer_copyin, + _clonefileat, _close, '_close$NOCANCEL', _coalition_create, + _coalition_info_debug_info, _coalition_info_resource_usage, + _coalition_info_set_efficiency, _coalition_info_set_name, + _coalition_ledger_set_logical_writes_limit, _coalition_policy_get, + _coalition_policy_set, _coalition_reap, _coalition_terminate, + _connect, '_connect$NOCANCEL', _connectx, _csops, _csops_audittoken, + _csr_check, _csr_get_active_config, _debug_control_port_for_pid, + _debug_syscall_reject, _debug_syscall_reject_config, _denap_boost_assertion_token, + _disconnectx, _dup, _dup2, _errno, _etap_trace_thread, _exc_server, + _exc_server_routine, _exception_raise, _exception_raise_state, + _exception_raise_state_identity, _exchangedata, _exclaves_audio_buffer_copyout, + _exclaves_audio_buffer_create, _exclaves_boot, _exclaves_endpoint_call, + _exclaves_inbound_buffer_copyin, _exclaves_inbound_buffer_create, + _exclaves_launch_conclave, _exclaves_lookup_service, _exclaves_named_buffer_copyin, _exclaves_named_buffer_copyout, _exclaves_named_buffer_create, + _exclaves_notification_create, _exclaves_outbound_buffer_copyout, + _exclaves_outbound_buffer_create, _exclaves_sensor_create, + _exclaves_sensor_start, _exclaves_sensor_status, _exclaves_sensor_stop, _execve, _faccessat, _fchdir, _fchflags, _fchmod, _fchmodat, - _fchown, _fchownat, _fclonefileat, _fcntl, _fdatasync, _ffsctl, - _fgetattrlist, _fgetxattr, _fhopen, _fileport_makefd, _fileport_makeport, - _flistxattr, _flock, _fmount, _fpathconf, _freadlink, _fremovexattr, - _fs_snapshot_create, _fs_snapshot_delete, _fs_snapshot_list, - _fs_snapshot_mount, _fs_snapshot_rename, _fs_snapshot_revert, - _fs_snapshot_root, _fsctl, _fsetattrlist, _fsetxattr, _fsgetpath, - _fsgetpath_ext, _fstat, _fstat64, _fstatat, _fstatat64, _fstatfs, - _fstatfs64, _fsync, _ftruncate, _futimens, _futimes, _getattrlist, - _getattrlistat, _getattrlistbulk, _getaudit, _getaudit_addr, - _getauid, _getdirentries, _getdirentriesattr, _getdtablesize, - _getegid, _getentropy, _geteuid, _getfh, _getfsstat, _getfsstat64, - _getgid, _getgroups, _gethostuuid, _getiopolicy_np, _getitimer, - _getpeername, _getpgid, _getpgrp, _getpid, _getppid, _getpriority, - _getrlimit, _getrusage, _getsgroups_np, _getsid, _getsockname, - _getsockopt, _getuid, _getwgroups_np, _getxattr, _grab_pgo_data, - _graftdmg, _guarded_close_np, _guarded_kqueue_np, _guarded_open_dprotected_np, - _guarded_open_np, _guarded_pwrite_np, _guarded_write_np, _guarded_writev_np, + _fchown, _fchownat, _fclonefileat, _fcntl, '_fcntl$NOCANCEL', + _fdatasync, _ffsctl, _fgetattrlist, _fgetxattr, _fhopen, _fileport_makefd, + _fileport_makeport, _flistxattr, _flock, _fmount, _fpathconf, + _freadlink, _fremovexattr, _fs_snapshot_create, _fs_snapshot_delete, + _fs_snapshot_list, _fs_snapshot_mount, _fs_snapshot_rename, + _fs_snapshot_revert, _fs_snapshot_root, _fsctl, _fsetattrlist, + _fsetxattr, _fsgetpath, _fsgetpath_ext, _fstat, _fstat64, + _fstatat, _fstatat64, _fstatfs, _fstatfs64, _fsync, '_fsync$NOCANCEL', + _ftruncate, _futimens, _futimes, _getattrlist, _getattrlistat, + _getattrlistbulk, _getaudit, _getaudit_addr, _getauid, _getdirentries, + _getdirentriesattr, _getdtablesize, _getegid, _getentropy, + _geteuid, _getfh, _getfsstat, _getfsstat64, _getgid, _getgroups, + _gethostuuid, _getiopolicy_np, _getitimer, _getpeername, _getpgid, + _getpgrp, _getpid, _getppid, _getpriority, _getrlimit, _getrusage, + _getsgroups_np, _getsid, _getsockname, _getsockopt, _getuid, + _getwgroups_np, _getxattr, _grab_pgo_data, _graftdmg, _guarded_close_np, + _guarded_kqueue_np, _guarded_open_dprotected_np, _guarded_open_np, + _guarded_pwrite_np, _guarded_write_np, _guarded_writev_np, _host_check_multiuser_mode, _host_create_mach_voucher, _host_create_mach_voucher_trap, _host_default_memory_manager, _host_get_UNDServer, _host_get_atm_diagnostic_flag, _host_get_boot_info, _host_get_clock_control, _host_get_clock_service, @@ -2237,11 +2278,11 @@ exports: _mach_init, _mach_make_memory_entry, _mach_make_memory_entry_64, _mach_memory_entry_access_tracking, _mach_memory_entry_ownership, _mach_memory_entry_purgable_control, _mach_memory_info, _mach_memory_object_memory_entry, - _mach_memory_object_memory_entry_64, _mach_msg, _mach_msg_destroy, - _mach_msg_overwrite, _mach_msg_overwrite_trap, _mach_msg_priority_encode, - _mach_msg_priority_is_pthread_priority, _mach_msg_priority_overide_qos, - _mach_msg_priority_qos, _mach_msg_priority_relpri, _mach_msg_receive, - _mach_msg_send, _mach_msg_server, _mach_msg_server_importance, + _mach_memory_object_memory_entry_64, _mach_msg, _mach_msg2_internal, + _mach_msg2_trap, _mach_msg_destroy, _mach_msg_overwrite, _mach_msg_overwrite_trap, + _mach_msg_priority_encode, _mach_msg_priority_is_pthread_priority, + _mach_msg_priority_overide_qos, _mach_msg_priority_qos, _mach_msg_priority_relpri, + _mach_msg_receive, _mach_msg_send, _mach_msg_server, _mach_msg_server_importance, _mach_msg_server_once, _mach_msg_trap, _mach_notify_dead_name, _mach_notify_no_senders, _mach_notify_port_deleted, _mach_notify_port_destroyed, _mach_notify_send_once, _mach_port_allocate, _mach_port_allocate_full, @@ -2273,6 +2314,10 @@ exports: _mach_vm_msync, _mach_vm_page_info, _mach_vm_page_query, _mach_vm_page_range_query, _mach_vm_protect, _mach_vm_purgable_control, _mach_vm_range_create, _mach_vm_read, _mach_vm_read_list, _mach_vm_read_overwrite, + _mach_vm_reclaim_is_available, _mach_vm_reclaim_is_reclaimed, + _mach_vm_reclaim_mark_free, _mach_vm_reclaim_mark_free_with_id, + _mach_vm_reclaim_mark_used, _mach_vm_reclaim_ringbuffer_init, + _mach_vm_reclaim_synchronize, _mach_vm_reclaim_update_kernel_accounting, _mach_vm_region, _mach_vm_region_recurse, _mach_vm_remap, _mach_vm_remap_new, _mach_vm_wire, _mach_vm_write, _mach_voucher_attr_command, _mach_voucher_deallocate, _mach_voucher_debug_info, _mach_voucher_extract_all_attr_recipes, @@ -2289,21 +2334,22 @@ exports: _mk_timer_arm, _mk_timer_arm_leeway, _mk_timer_cancel, _mk_timer_create, _mk_timer_destroy, _mkdir, _mkdirat, _mkfifo, _mkfifoat, _mknod, _mknodat, _mlock, _mlockall, _mmap, _mount, _mprotect, _mremap_encrypted, - _msg_receive, _msg_rpc, _msg_send, _msgget, _msgrcv, _msgsnd, - _msgsys, _msync, _munlock, _munlockall, _munmap, _necp_client_action, - _necp_match_policy, _necp_open, _necp_session_action, _necp_session_open, - _net_qos_guideline, _netagent_trigger, _netname_check_in, - _netname_check_out, _netname_look_up, _netname_version, _nfsclnt, - _nfssvc, _non_boost_assertion_token, _normal_boost_assertion_token, + _msg_receive, _msg_rpc, _msg_send, _msgctl, _msgget, _msgrcv, + '_msgrcv$NOCANCEL', _msgsnd, '_msgsnd$NOCANCEL', _msgsys, + _msync, '_msync$NOCANCEL', _munlock, _munlockall, _munmap, + _necp_client_action, _necp_match_policy, _necp_open, _necp_session_action, + _necp_session_open, _net_qos_guideline, _netagent_trigger, + _netname_check_in, _netname_check_out, _netname_look_up, _netname_version, + _nfsclnt, _nfssvc, _non_boost_assertion_token, _normal_boost_assertion_token, _ntp_adjtime, _ntp_gettime, _objc_bp_assist_cfg_np, _open, - _open_dprotected_np, _openat, '_openat$NOCANCEL', _openat_authenticated_np, - _openat_dprotected_np, _openbyid_np, _os_buflet_get_data_address, - _os_buflet_get_data_length, _os_buflet_get_data_limit, _os_buflet_get_data_offset, - _os_buflet_get_object_address, _os_buflet_get_object_limit, - _os_buflet_set_data_length, _os_buflet_set_data_offset, _os_channel_advance_slot, - _os_channel_attr_clone, _os_channel_attr_create, _os_channel_attr_destroy, - _os_channel_attr_get, _os_channel_attr_get_key, _os_channel_attr_set, - _os_channel_attr_set_key, _os_channel_available_slot_count, + '_open$NOCANCEL', _open_dprotected_np, _openat, '_openat$NOCANCEL', + _openat_authenticated_np, _openat_dprotected_np, _openbyid_np, + _os_buflet_get_data_address, _os_buflet_get_data_length, _os_buflet_get_data_limit, + _os_buflet_get_data_offset, _os_buflet_get_object_address, + _os_buflet_get_object_limit, _os_buflet_set_data_length, _os_buflet_set_data_offset, + _os_channel_advance_slot, _os_channel_attr_clone, _os_channel_attr_create, + _os_channel_attr_destroy, _os_channel_attr_get, _os_channel_attr_get_key, + _os_channel_attr_set, _os_channel_attr_set_key, _os_channel_available_slot_count, _os_channel_buflet_alloc, _os_channel_buflet_free, _os_channel_configure_interface_advisory, _os_channel_create, _os_channel_create_extended, _os_channel_destroy, _os_channel_event_free, _os_channel_event_get_event_data, @@ -2359,8 +2405,8 @@ exports: _pathconf, _peeloff, _pid_for_task, _pid_hibernate, _pid_resume, _pid_shutdown_networking, _pid_shutdown_sockets, _pid_suspend, _pipe, _pivot_root, _pkt_subtype_assert_fail, _pkt_type_assert_fail, - _poll, _port_obj_init, _port_obj_table, _port_obj_table_size, - _posix_madvise, _posix_spawn, _posix_spawn_file_actions_add_fileportdup2_np, + _poll, '_poll$NOCANCEL', _port_obj_init, _port_obj_table, + _port_obj_table_size, _posix_madvise, _posix_spawn, _posix_spawn_file_actions_add_fileportdup2_np, _posix_spawn_file_actions_addchdir_np, _posix_spawn_file_actions_addclose, _posix_spawn_file_actions_adddup2, _posix_spawn_file_actions_addfchdir_np, _posix_spawn_file_actions_addinherit_np, _posix_spawn_file_actions_addopen, @@ -2378,14 +2424,15 @@ exports: _posix_spawnattr_set_csm_np, _posix_spawnattr_set_darwin_role_np, _posix_spawnattr_set_filedesclimit_ext, _posix_spawnattr_set_gid_np, _posix_spawnattr_set_groups_np, _posix_spawnattr_set_importancewatch_port_np, - _posix_spawnattr_set_jetsam_ttr_np, _posix_spawnattr_set_launch_type_np, - _posix_spawnattr_set_login_np, _posix_spawnattr_set_max_addr_np, - _posix_spawnattr_set_persona_gid_np, _posix_spawnattr_set_persona_groups_np, - _posix_spawnattr_set_persona_np, _posix_spawnattr_set_persona_uid_np, - _posix_spawnattr_set_platform_np, _posix_spawnattr_set_portlimits_ext, - _posix_spawnattr_set_ptrauth_task_port_np, _posix_spawnattr_set_qos_clamp_np, - _posix_spawnattr_set_registered_ports_np, _posix_spawnattr_set_subsystem_root_path_np, - _posix_spawnattr_set_threadlimit_ext, _posix_spawnattr_set_uid_np, + _posix_spawnattr_set_jetsam_ttr_np, _posix_spawnattr_set_kqworklooplimit_ext, + _posix_spawnattr_set_launch_type_np, _posix_spawnattr_set_login_np, + _posix_spawnattr_set_max_addr_np, _posix_spawnattr_set_persona_gid_np, + _posix_spawnattr_set_persona_groups_np, _posix_spawnattr_set_persona_np, + _posix_spawnattr_set_persona_uid_np, _posix_spawnattr_set_platform_np, + _posix_spawnattr_set_portlimits_ext, _posix_spawnattr_set_ptrauth_task_port_np, + _posix_spawnattr_set_qos_clamp_np, _posix_spawnattr_set_registered_ports_np, + _posix_spawnattr_set_subsystem_root_path_np, _posix_spawnattr_set_threadlimit_ext, + _posix_spawnattr_set_uid_np, _posix_spawnattr_set_use_sec_transition_shims_np, _posix_spawnattr_setarchpref_np, _posix_spawnattr_setauditsessionport_np, _posix_spawnattr_setbinpref_np, _posix_spawnattr_setcoalition_np, _posix_spawnattr_setcpumonitor, _posix_spawnattr_setcpumonitor_default, @@ -2395,7 +2442,7 @@ exports: _posix_spawnattr_setpcontrol_np, _posix_spawnattr_setpgroup, _posix_spawnattr_setprocesstype_np, _posix_spawnattr_setsigdefault, _posix_spawnattr_setsigmask, _posix_spawnattr_setspecialport_np, - _pread, _preadv, '_preadv$NOCANCEL', _proc_clear_cpulimits, + _pread, '_pread$NOCANCEL', _preadv, '_preadv$NOCANCEL', _proc_clear_cpulimits, _proc_clear_delayidlesleep, _proc_clear_dirty, _proc_clear_vmpressure, _proc_current_thread_schedinfo, _proc_denap_assertion_begin_with_msg, _proc_denap_assertion_complete, _proc_disable_apptype, _proc_disable_cpumon, @@ -2414,39 +2461,44 @@ exports: _proc_set_no_smt, _proc_set_owner_vmpressure, _proc_set_wakemon_defaults, _proc_set_wakemon_params, _proc_setcpu_percentage, _proc_setpcontrol, _proc_setthread_cpupercent, _proc_setthread_csm, _proc_setthread_no_smt, - _proc_suppress, _proc_terminate, _proc_terminate_all_rsr, - _proc_trace_log, _proc_track_dirty, _proc_udata_info, _proc_uuid_policy, - _processor_assign, _processor_control, _processor_exit, _processor_get_assignment, - _processor_info, _processor_set_create, _processor_set_default, - _processor_set_destroy, _processor_set_info, _processor_set_max_priority, - _processor_set_policy_control, _processor_set_policy_disable, - _processor_set_policy_enable, _processor_set_stack_usage, - _processor_set_statistics, _processor_set_tasks, _processor_set_tasks_with_flavor, - _processor_set_threads, _processor_start, _pselect, '_pselect$DARWIN_EXTSN', - '_pselect$DARWIN_EXTSN$NOCANCEL', _pthread_getugid_np, _pthread_setugid_np, - _ptrace, _pwrite, _pwritev, '_pwritev$NOCANCEL', _quota, _quotactl, - _read, _readlink, _readlinkat, _readv, _reboot, _reboot_np, - _record_system_event_as_kernel, _recvfrom, _recvmsg, _recvmsg_x, - _register_uexc_handler, _removexattr, _rename, _rename_ext, - _renameat, _renameatx_np, _renamex_np, _revoke, _rmdir, _searchfs, - _select, '_select$DARWIN_EXTSN', '_select$DARWIN_EXTSN$NOCANCEL', - _sem_close, _sem_destroy, _sem_getvalue, _sem_init, _sem_open, - _sem_post, _sem_trywait, _sem_unlink, _sem_wait, _semaphore_create, - _semaphore_destroy, _semaphore_signal, _semaphore_signal_all, - _semaphore_signal_all_trap, _semaphore_signal_thread, _semaphore_signal_thread_trap, - _semaphore_signal_trap, _semaphore_timedwait, _semaphore_timedwait_signal, - _semaphore_timedwait_signal_trap, _semaphore_timedwait_trap, - _semaphore_wait, _semaphore_wait_signal, _semaphore_wait_signal_trap, - _semaphore_wait_trap, _semget, _semop, _semsys, _sendfile, - _sendmsg, _sendmsg_x, _sendto, _setattrlist, _setattrlistat, + _proc_signal_delegate, _proc_signal_with_audittoken, _proc_suppress, + _proc_terminate, _proc_terminate_all_rsr, _proc_terminate_delegate, + _proc_terminate_with_audittoken, _proc_trace_log, _proc_track_dirty, + _proc_udata_info, _proc_uuid_policy, _processor_assign, _processor_control, + _processor_exit, _processor_get_assignment, _processor_info, + _processor_set_create, _processor_set_default, _processor_set_destroy, + _processor_set_info, _processor_set_max_priority, _processor_set_policy_control, + _processor_set_policy_disable, _processor_set_policy_enable, + _processor_set_stack_usage, _processor_set_statistics, _processor_set_tasks, + _processor_set_tasks_with_flavor, _processor_set_threads, + _processor_start, _pselect, '_pselect$DARWIN_EXTSN', '_pselect$DARWIN_EXTSN$NOCANCEL', + '_pselect$NOCANCEL', _pthread_getugid_np, _pthread_setugid_np, + _ptrace, _pwrite, '_pwrite$NOCANCEL', _pwritev, '_pwritev$NOCANCEL', + _quota, _quotactl, _read, '_read$NOCANCEL', _readlink, _readlinkat, + _readv, '_readv$NOCANCEL', _reboot, _reboot_np, _record_system_event_as_kernel, + _recvfrom, '_recvfrom$NOCANCEL', _recvmsg, '_recvmsg$NOCANCEL', + _recvmsg_x, _register_uexc_handler, _removexattr, _rename, + _rename_ext, _renameat, _renameatx_np, _renamex_np, _revoke, + _rmdir, _searchfs, _select, '_select$DARWIN_EXTSN', '_select$DARWIN_EXTSN$NOCANCEL', + '_select$NOCANCEL', _sem_close, _sem_destroy, _sem_getvalue, + _sem_init, _sem_open, _sem_post, _sem_trywait, _sem_unlink, + _sem_wait, '_sem_wait$NOCANCEL', _semaphore_create, _semaphore_destroy, + _semaphore_signal, _semaphore_signal_all, _semaphore_signal_all_trap, + _semaphore_signal_thread, _semaphore_signal_thread_trap, _semaphore_signal_trap, + _semaphore_timedwait, _semaphore_timedwait_signal, _semaphore_timedwait_signal_trap, + _semaphore_timedwait_trap, _semaphore_wait, _semaphore_wait_signal, + _semaphore_wait_signal_trap, _semaphore_wait_trap, _semctl, + _semget, _semop, _semsys, _sendfile, _sendmsg, '_sendmsg$NOCANCEL', + _sendmsg_x, _sendto, '_sendto$NOCANCEL', _setattrlist, _setattrlistat, _setaudit, _setaudit_addr, _setauid, _setegid, _seteuid, _setgid, _setgroups, _setiopolicy_np, _setitimer, _setpgid, _setpriority, - _setprivexec, _setquota, _setrlimit, _setsgroups_np, _setsid, - _setsockopt, _setuid, _setwgroups_np, _setxattr, _sfi_get_class_offtime, - _sfi_process_get_flags, _sfi_process_set_flags, _sfi_set_class_offtime, - _shm_open, _shm_unlink, _shmat, _shmdt, _shmget, _shmsys, - _shutdown, _sigpending, _sigprocmask, _sigsuspend, _socket, - _socket_delegate, _socketpair, _stackshot_capture_with_config, + _setprivexec, _setquota, _setregid, _setreuid, _setrlimit, + _setsgroups_np, _setsid, _setsockopt, _setuid, _setwgroups_np, + _setxattr, _sfi_get_class_offtime, _sfi_process_get_flags, + _sfi_process_set_flags, _sfi_set_class_offtime, _shm_open, + _shm_unlink, _shmat, _shmctl, _shmdt, _shmget, _shmsys, _shutdown, + _sigpending, _sigprocmask, _sigsuspend, '_sigsuspend$NOCANCEL', + _socket, _socket_delegate, _socketpair, _stackshot_capture_with_config, _stackshot_config_create, _stackshot_config_dealloc, _stackshot_config_dealloc_buffer, _stackshot_config_get_stackshot_buffer, _stackshot_config_get_stackshot_size, _stackshot_config_set_delta_timestamp, _stackshot_config_set_flags, @@ -2454,12 +2506,12 @@ exports: _stackshot_config_set_size_hint, _stat, _stat64, _statfs, _statfs64, _swapon, _swtch, _swtch_pri, _symlink, _symlinkat, _sync, _syscall, _syscall_thread_switch, _system_get_sfi_window, - _system_override, _system_set_sfi_window, _task_assign, _task_assign_default, - _task_create, _task_create_identity_token, _task_dyld_process_info_notify_deregister, - _task_dyld_process_info_notify_get, _task_dyld_process_info_notify_register, - _task_for_pid, _task_generate_corpse, _task_get_assignment, - _task_get_dyld_image_infos, _task_get_emulation_vector, _task_get_exc_guard_behavior, - _task_get_exception_ports, _task_get_exception_ports_info, + _system_override, _system_set_sfi_window, _system_version_compat_mode, + _task_assign, _task_assign_default, _task_create, _task_create_identity_token, + _task_dyld_process_info_notify_deregister, _task_dyld_process_info_notify_get, + _task_dyld_process_info_notify_register, _task_for_pid, _task_generate_corpse, + _task_get_assignment, _task_get_dyld_image_infos, _task_get_emulation_vector, + _task_get_exc_guard_behavior, _task_get_exception_ports, _task_get_exception_ports_info, _task_get_mach_voucher, _task_get_special_port, _task_get_state, _task_identity_token_get_task_port, _task_info, _task_inspect, _task_inspect_for_pid, _task_map_corpse_info, _task_map_corpse_info_64, @@ -2467,20 +2519,22 @@ exports: _task_policy_get, _task_policy_set, _task_purgable_info, _task_read_for_pid, _task_register_dyld_get_process_state, _task_register_dyld_image_infos, _task_register_dyld_set_dyld_state, _task_register_dyld_shared_cache_image_info, - _task_restartable_ranges_register, _task_restartable_ranges_synchronize, - _task_resume, _task_resume2, _task_sample, _task_self_, _task_self_trap, - _task_set_corpse_forking_behavior, _task_set_emulation, _task_set_emulation_vector, - _task_set_exc_guard_behavior, _task_set_exception_ports, _task_set_info, - _task_set_mach_voucher, _task_set_phys_footprint_limit, _task_set_policy, - _task_set_port_space, _task_set_ras_pc, _task_set_special_port, - _task_set_state, _task_suspend, _task_suspend2, _task_swap_exception_ports, + _task_register_hardened_exception_handler, _task_restartable_ranges_register, + _task_restartable_ranges_synchronize, _task_resume, _task_resume2, + _task_sample, _task_self_, _task_self_trap, _task_set_corpse_forking_behavior, + _task_set_emulation, _task_set_emulation_vector, _task_set_exc_guard_behavior, + _task_set_exception_ports, _task_set_info, _task_set_mach_voucher, + _task_set_phys_footprint_limit, _task_set_policy, _task_set_port_space, + _task_set_ras_pc, _task_set_special_port, _task_set_state, + _task_suspend, _task_suspend2, _task_swap_exception_ports, _task_swap_mach_voucher, _task_terminate, _task_test_async_upcall_propagation, _task_test_sync_upcall, _task_threads, _task_unregister_dyld_image_infos, _task_zone_info, _terminate_with_payload, _terminate_with_reason, - _thread_abort, _thread_abort_safely, _thread_assign, _thread_assign_default, - _thread_convert_thread_state, _thread_create, _thread_create_running, - _thread_depress_abort, _thread_destruct_special_reply_port, - _thread_get_assignment, _thread_get_exception_ports, _thread_get_exception_ports_info, + _thread_abort, _thread_abort_safely, _thread_adopt_exception_handler, + _thread_assign, _thread_assign_default, _thread_convert_thread_state, + _thread_create, _thread_create_running, _thread_depress_abort, + _thread_destruct_special_reply_port, _thread_get_assignment, + _thread_get_exception_ports, _thread_get_exception_ports_info, _thread_get_mach_voucher, _thread_get_register_pointer_values, _thread_get_special_port, _thread_get_special_reply_port, _thread_get_state, _thread_info, _thread_policy, _thread_policy_get, @@ -2499,35 +2553,19 @@ exports: _vm_read_overwrite, _vm_region_64, _vm_region_recurse_64, _vm_remap, _vm_remap_new, _vm_wire, _vm_write, _voucher_mach_msg_adopt, _voucher_mach_msg_clear, _voucher_mach_msg_revert, _voucher_mach_msg_set, - _vprintf_stderr_func, _wait4, _waitid, _work_interval_copy_port, - _work_interval_create, _work_interval_destroy, _work_interval_get_flags_from_port, - _work_interval_instance_alloc, _work_interval_instance_clear, - _work_interval_instance_finish, _work_interval_instance_free, - _work_interval_instance_get_complexity, _work_interval_instance_get_deadline, - _work_interval_instance_get_finish, _work_interval_instance_get_id, - _work_interval_instance_get_start, _work_interval_instance_get_telemetry_data, - _work_interval_instance_set_complexity, _work_interval_instance_set_deadline, - _work_interval_instance_set_finish, _work_interval_instance_set_start, - _work_interval_instance_start, _work_interval_instance_update, - _work_interval_join, _work_interval_join_port, _work_interval_leave, - _work_interval_notify, _work_interval_notify_simple, _write, - _writev ] - - targets: [ x86_64-macos, x86_64-maccatalyst ] - symbols: [ '_pselect$1050', '_select$1050' ] - - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, - arm64e-macos, arm64e-maccatalyst ] - symbols: [ '_accept$NOCANCEL', '_aio_suspend$NOCANCEL', '_close$NOCANCEL', - '_connect$NOCANCEL', '_fcntl$NOCANCEL', '_fsync$NOCANCEL', - _mach_msg2_internal, _mach_msg2_trap, _mach_vm_reclaim_is_available, - _mach_vm_reclaim_mark_free, _mach_vm_reclaim_mark_used, _mach_vm_reclaim_ringbuffer_init, - _mach_vm_reclaim_synchronize, _mach_vm_reclaim_update_kernel_accounting, - _msgctl, '_msgrcv$NOCANCEL', '_msgsnd$NOCANCEL', '_msync$NOCANCEL', - '_open$NOCANCEL', '_poll$NOCANCEL', '_pread$NOCANCEL', '_pselect$NOCANCEL', - '_pwrite$NOCANCEL', '_read$NOCANCEL', '_readv$NOCANCEL', '_recvfrom$NOCANCEL', - '_recvmsg$NOCANCEL', '_select$NOCANCEL', '_sem_wait$NOCANCEL', - _semctl, '_sendmsg$NOCANCEL', '_sendto$NOCANCEL', _setregid, - _setreuid, _shmctl, '_sigsuspend$NOCANCEL', _system_version_compat_mode, - '_waitid$NOCANCEL', '_write$NOCANCEL', '_writev$NOCANCEL' ] + _vprintf_stderr_func, _wait4, _waitid, '_waitid$NOCANCEL', + _work_interval_copy_port, _work_interval_create, _work_interval_destroy, + _work_interval_get_flags_from_port, _work_interval_instance_alloc, + _work_interval_instance_clear, _work_interval_instance_finish, + _work_interval_instance_free, _work_interval_instance_get_complexity, + _work_interval_instance_get_deadline, _work_interval_instance_get_finish, + _work_interval_instance_get_id, _work_interval_instance_get_start, + _work_interval_instance_get_telemetry_data, _work_interval_instance_set_complexity, + _work_interval_instance_set_deadline, _work_interval_instance_set_finish, + _work_interval_instance_set_start, _work_interval_instance_start, + _work_interval_instance_update, _work_interval_join, _work_interval_join_port, + _work_interval_leave, _work_interval_notify, _work_interval_notify_simple, + _write, '_write$NOCANCEL', _writev, '_writev$NOCANCEL' ] - targets: [ arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] symbols: [ ___fstat, ___fstatat, ___fstatfs, ___getfsstat, ___lstat, ___stat, ___statfs, __current_pid, _mach_absolute_time_kernel, @@ -2537,7 +2575,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_m.dylib' -current-version: 3252 +current-version: 3289 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -2583,21 +2621,24 @@ exports: __simd_tgamma_f8 ] - targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] - symbols: [ __FE_DFL_ENV, ___Libm_version, ___cos_d2, ___cos_f4, ___cospi, - ___cospif, ___exp10, ___exp10f, ___fegetfltrounds, ___fpclassifyd, - ___fpclassifyf, ___fpclassifyl, ___inline_isfinited, ___inline_isfinitef, - ___inline_isfinitel, ___inline_isinfd, ___inline_isinff, ___inline_isinfl, - ___inline_isnand, ___inline_isnanf, ___inline_isnanl, ___inline_isnormald, - ___inline_isnormalf, ___inline_isnormall, ___inline_signbitd, - ___inline_signbitf, ___inline_signbitl, ___invert_d2, ___invert_d3, - ___invert_d4, ___invert_f2, ___invert_f3, ___invert_f4, ___isfinited, - ___isfinitef, ___isfinitel, ___isinfd, ___isinff, ___isinfl, - ___isnand, ___isnanf, ___isnanl, ___isnormald, ___isnormalf, - ___isnormall, ___math_errhandling, ___signbitd, ___signbitf, - ___signbitl, ___sin_d2, ___sin_f4, ___sincos, ___sincos_stret, - ___sincosf, ___sincosf_stret, ___sincospi, ___sincospi_stret, - ___sincospif, ___sincospif_stret, ___sinpi, ___sinpif, ___tanpi, - ___tanpif, __simd_acos_d2, __simd_acos_f4, __simd_acosh_d2, + symbols: [ __FE_DFL_ENV, ___Libm_version, ___ceilf16, ___copysignf16, + ___cos_d2, ___cos_f4, ___cospi, ___cospif, ___exp10, ___exp10f, + ___fabsf16, ___fegetfltrounds, ___floorf16, ___fmaf16, ___fmaxf16, + ___fminf16, ___fpclassifyd, ___fpclassifyf, ___fpclassifyl, + ___hypotf16, ___inline_isfinited, ___inline_isfinitef, ___inline_isfinitel, + ___inline_isinfd, ___inline_isinff, ___inline_isinfl, ___inline_isnand, + ___inline_isnanf, ___inline_isnanl, ___inline_isnormald, ___inline_isnormalf, + ___inline_isnormall, ___inline_signbitd, ___inline_signbitf, + ___inline_signbitl, ___invert_d2, ___invert_d3, ___invert_d4, + ___invert_f2, ___invert_f3, ___invert_f4, ___invert_h2, ___invert_h3, + ___invert_h4, ___isfinited, ___isfinitef, ___isfinitel, ___isinfd, + ___isinff, ___isinfl, ___isnand, ___isnanf, ___isnanl, ___isnormald, + ___isnormalf, ___isnormall, ___math_errhandling, ___nextafterf16, + ___rintf16, ___roundf16, ___signbitd, ___signbitf, ___signbitl, + ___sin_d2, ___sin_f4, ___sincos, ___sincos_stret, ___sincosf, + ___sincosf_stret, ___sincospi, ___sincospi_stret, ___sincospif, + ___sincospif_stret, ___sinpi, ___sinpif, ___sqrtf16, ___tanpi, + ___tanpif, ___truncf16, __simd_acos_d2, __simd_acos_f4, __simd_acosh_d2, __simd_acosh_f4, __simd_asin_d2, __simd_asin_f4, __simd_asinh_d2, __simd_asinh_f4, __simd_atan2_d2, __simd_atan2_f4, __simd_atan_d2, __simd_atan_f4, __simd_atanh_d2, __simd_atanh_f4, __simd_cbrt_d2, @@ -2608,13 +2649,15 @@ exports: __simd_exp_f4, __simd_expm1_d2, __simd_expm1_f4, __simd_fma_d2, __simd_fma_f4, __simd_fmod_d2, __simd_fmod_f4, __simd_hypot_d2, __simd_hypot_f4, __simd_incircle_pd2, __simd_incircle_pf2, - __simd_insphere_pd3, __simd_insphere_pf3, __simd_lgamma_d2, - __simd_lgamma_f4, __simd_log10_d2, __simd_log10_f4, __simd_log1p_d2, - __simd_log1p_f4, __simd_log2_d2, __simd_log2_f4, __simd_log_d2, - __simd_log_f4, __simd_nextafter_d2, __simd_nextafter_f4, __simd_orient_pd2, - __simd_orient_pd3, __simd_orient_pf2, __simd_orient_pf3, __simd_orient_vd2, - __simd_orient_vd3, __simd_orient_vf2, __simd_orient_vf3, __simd_pow_d2, - __simd_pow_f4, __simd_remainder_d2, __simd_remainder_f4, __simd_round_d2, + __simd_incircle_ph2, __simd_insphere_pd3, __simd_insphere_pf3, + __simd_insphere_ph3, __simd_lgamma_d2, __simd_lgamma_f4, __simd_log10_d2, + __simd_log10_f4, __simd_log1p_d2, __simd_log1p_f4, __simd_log2_d2, + __simd_log2_f4, __simd_log_d2, __simd_log_f4, __simd_nextafter_d2, + __simd_nextafter_f4, __simd_orient_pd2, __simd_orient_pd3, + __simd_orient_pf2, __simd_orient_pf3, __simd_orient_ph2, __simd_orient_ph3, + __simd_orient_vd2, __simd_orient_vd3, __simd_orient_vf2, __simd_orient_vf3, + __simd_orient_vh2, __simd_orient_vh3, __simd_pow_d2, __simd_pow_f4, + __simd_remainder_d2, __simd_remainder_f4, __simd_round_d2, __simd_round_f4, __simd_sin_d2, __simd_sin_f4, __simd_sincos_d2, __simd_sincos_f4, __simd_sincospi_d2, __simd_sincospi_f4, __simd_sinh_d2, __simd_sinh_f4, __simd_sinpi_d2, __simd_sinpi_f4, @@ -2649,7 +2692,8 @@ exports: _log2f, _log2l, _logb, _logbf, _logbl, _logf, _logl, _lrint, _lrintf, _lrintl, _lround, _lroundf, _lroundl, _matrix_identity_double2x2, _matrix_identity_double3x3, _matrix_identity_double4x4, _matrix_identity_float2x2, - _matrix_identity_float3x3, _matrix_identity_float4x4, _modf, + _matrix_identity_float3x3, _matrix_identity_float4x4, _matrix_identity_half2x2, + _matrix_identity_half3x3, _matrix_identity_half4x4, _modf, _modff, _modfl, _nan, _nanf, _nanl, _nearbyint, _nearbyintf, _nearbyintl, _nextafter, _nextafterf, _nextafterl, _nexttoward, _nexttowardf, _nexttowardl, _pow, _powf, _powl, _remainder, @@ -2753,7 +2797,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_malloc.dylib' -current-version: 474.0.13 +current-version: 646.40.3 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -2761,15 +2805,7 @@ parent-umbrella: exports: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] - symbols: [ ___mach_stack_logging_copy_uniquing_table, ___mach_stack_logging_enumerate_records, - ___mach_stack_logging_frames_for_uniqued_stack, ___mach_stack_logging_get_frames, - ___mach_stack_logging_get_frames_for_stackid, ___mach_stack_logging_set_file_path, - ___mach_stack_logging_shared_memory_address, ___mach_stack_logging_stackid_for_vm_region, - ___mach_stack_logging_start_reading, ___mach_stack_logging_stop_reading, - ___mach_stack_logging_uniquing_table_copy_from_serialized, - ___mach_stack_logging_uniquing_table_read_stack, ___mach_stack_logging_uniquing_table_release, - ___mach_stack_logging_uniquing_table_retain, ___mach_stack_logging_uniquing_table_serialize, - ___mach_stack_logging_uniquing_table_sizeof, ___malloc_init, + symbols: [ ___mach_stack_logging_shared_memory_address, ___malloc_init, ___malloc_late_init, __malloc_fork_child, __malloc_fork_parent, __malloc_fork_prepare, __malloc_no_asl_log, __os_cpu_number_override, _aligned_alloc, _calloc, _free, _mag_set_thread_index, _malloc, @@ -2777,11 +2813,11 @@ exports: _malloc_claimed_address, _malloc_create_legacy_default_zone, _malloc_create_zone, _malloc_debug, _malloc_default_purgeable_zone, _malloc_default_zone, _malloc_destroy_zone, _malloc_engaged_nano, - _malloc_enter_process_memory_limit_warn_mode, _malloc_error, - _malloc_freezedry, _malloc_get_all_zones, _malloc_get_thread_options, - _malloc_get_zone_name, _malloc_good_size, _malloc_jumpstart, - _malloc_logger, _malloc_make_nonpurgeable, _malloc_make_purgeable, - _malloc_memory_event_handler, _malloc_memorypressure_mask_default_4libdispatch, + _malloc_engaged_secure_allocator, _malloc_enter_process_memory_limit_warn_mode, + _malloc_error, _malloc_freezedry, _malloc_get_all_zones, _malloc_get_thread_options, + _malloc_get_wrapped_zone, _malloc_get_zone_name, _malloc_good_size, + _malloc_jumpstart, _malloc_logger, _malloc_make_nonpurgeable, + _malloc_make_purgeable, _malloc_memory_event_handler, _malloc_memorypressure_mask_default_4libdispatch, _malloc_memorypressure_mask_msl_4libdispatch, _malloc_num_zones, _malloc_num_zones_allocated, _malloc_printf, _malloc_register_stack_logger, _malloc_sanitizer_get_functions, _malloc_sanitizer_is_enabled, @@ -2790,24 +2826,27 @@ exports: _malloc_type_aligned_alloc, _malloc_type_calloc, _malloc_type_free, _malloc_type_malloc, _malloc_type_posix_memalign, _malloc_type_realloc, _malloc_type_valloc, _malloc_type_zone_calloc, _malloc_type_zone_free, - _malloc_type_zone_malloc, _malloc_type_zone_memalign, _malloc_type_zone_realloc, - _malloc_type_zone_valloc, _malloc_zero_on_free_disable, _malloc_zone_batch_free, - _malloc_zone_batch_malloc, _malloc_zone_calloc, _malloc_zone_check, - _malloc_zone_claimed_address, _malloc_zone_disable_discharge_checking, - _malloc_zone_discharge, _malloc_zone_enable_discharge_checking, - _malloc_zone_enumerate_discharged_pointers, _malloc_zone_free, - _malloc_zone_from_ptr, _malloc_zone_log, _malloc_zone_malloc, + _malloc_type_zone_malloc, _malloc_type_zone_malloc_with_options_internal, + _malloc_type_zone_malloc_with_options_np, _malloc_type_zone_memalign, + _malloc_type_zone_realloc, _malloc_type_zone_valloc, _malloc_variant_is_debug_4test, + _malloc_zero_on_free_disable, _malloc_zone_batch_free, _malloc_zone_batch_malloc, + _malloc_zone_calloc, _malloc_zone_check, _malloc_zone_claimed_address, + _malloc_zone_disable_discharge_checking, _malloc_zone_discharge, + _malloc_zone_enable_discharge_checking, _malloc_zone_enumerate_discharged_pointers, + _malloc_zone_free, _malloc_zone_from_ptr, _malloc_zone_log, + _malloc_zone_malloc, _malloc_zone_malloc_with_options_np, _malloc_zone_memalign, _malloc_zone_pressure_relief, _malloc_zone_print, _malloc_zone_print_ptr_info, _malloc_zone_realloc, _malloc_zone_register, _malloc_zone_statistics, _malloc_zone_unregister, _malloc_zone_valloc, - _malloc_zones, _mstats, _pgm_diagnose_fault_from_crash_reporter, - _pgm_extract_report_from_corpse, _posix_memalign, _realloc, - '_reallocarray$DARWIN_EXTSN', '_reallocarrayf$DARWIN_EXTSN', - _sanitizer_diagnose_fault_from_crash_reporter, _scalable_zone_info, - _scalable_zone_statistics, _set_malloc_singlethreaded, _stack_logging_enable_logging, - _szone_check_counter, _szone_check_modulo, _szone_check_start, - _tiny_print_region_free_list, _turn_off_stack_logging, _turn_on_stack_logging, - _valloc, _vfree, _xzm_ptr_lookup_4test, _zeroify_scalable_zone ] + _malloc_zones, _mstats, _pgm_extract_report_from_corpse, _posix_memalign, + _realloc, '_reallocarray$DARWIN_EXTSN', '_reallocarrayf$DARWIN_EXTSN', + _reallocf, _sanitizer_diagnose_fault_from_crash_reporter, + _scalable_zone_info, _scalable_zone_statistics, _set_malloc_singlethreaded, + _stack_logging_enable_logging, _szone_check_counter, _szone_check_modulo, + _szone_check_start, _tiny_print_region_free_list, _turn_off_stack_logging, + _turn_on_stack_logging, _valloc, _vfree, _xzm_malloc_zone_introspect, + _xzm_ptr_lookup_4test, _xzm_type_choose_ptr_bucket_4test, + _zeroify_scalable_zone ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, @@ -2821,9 +2860,10 @@ exports: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] symbols: [ _NEHelperCacheAddRedirectedAddress, _NEHelperCacheClearRedirectedAddresses, - _NEHelperCacheClearUUIDs, _NEHelperCacheCopyAppUUIDMapping, - _NEHelperCacheCopyAppUUIDMappingExtended, _NEHelperCacheCopyAppUUIDMappingForUIDExtended, - _NEHelperCacheCopySigningIdentifierMapping, _NEHelperCacheSetDomainDictionaries, + _NEHelperCacheClearUUIDs, _NEHelperCacheClearUUIDsForBundleID, + _NEHelperCacheCopyAppUUIDMapping, _NEHelperCacheCopyAppUUIDMappingExtended, + _NEHelperCacheCopyAppUUIDMappingForUIDExtended, _NEHelperCacheCopySigningIdentifierMapping, + _NEHelperCachePopulateUUIDsForConfiguration, _NEHelperCacheSetDomainDictionaries, _NEHelperCacheSetMatchDomains, _NEHelperCacheSetRoutes, _NEHelperCopyAggregatePathRules, _NEHelperCopyAppInfo, _NEHelperCopyCurrentNetworkAsync, _NEHelperCopyCurrentNetworkInfo, _NEHelperCopyDataForCertificate, _NEHelperCopyPerAppDomains, @@ -2856,9 +2896,9 @@ exports: _ne_session_disable_restrictions, _ne_session_dns_proxy_configs_present, _ne_session_dns_settings_configs_present, _ne_session_establish_ipc, _ne_session_fallback_advisory, _ne_session_fallback_default, - _ne_session_get_config_id_from_network_agent, _ne_session_get_configuration_id, - _ne_session_get_info, _ne_session_get_info2, _ne_session_get_status, - _ne_session_info_type_to_string, _ne_session_initialize_necp_drop_all, + _ne_session_get_boot_session_uuid, _ne_session_get_config_id_from_network_agent, + _ne_session_get_configuration_id, _ne_session_get_info, _ne_session_get_info2, + _ne_session_get_status, _ne_session_info_type_to_string, _ne_session_initialize_necp_drop_all, _ne_session_is_always_on_vpn_enabled, _ne_session_is_safeboot, _ne_session_local_communication_configs_present, _ne_session_local_communication_send_info, _ne_session_manager_get_pid, _ne_session_manager_has_active_sessions, @@ -2873,18 +2913,18 @@ exports: _ne_session_release, _ne_session_retain, _ne_session_send_barrier, _ne_session_service_copy_cached_match_domains, _ne_session_service_get_dns_service_id, _ne_session_service_get_dns_service_id_for_interface, _ne_session_service_matches_address, - _ne_session_service_matches_address_for_interface, _ne_session_set_event_handler, - _ne_session_set_socket_attributes, _ne_session_set_socket_context_attribute, - _ne_session_set_socket_tracker_attributes, _ne_session_should_disable_nexus, - _ne_session_start, _ne_session_start_on_behalf_of, _ne_session_start_with_options, - _ne_session_status_to_string, _ne_session_stop, _ne_session_stop_all_with_plugin_type, - _ne_session_stop_reason_to_string, _ne_session_type_to_string, - _ne_session_use_as_system_vpn, _ne_session_vod_evaluate_connection_present, - _ne_session_vpn_include_all_networks_configs_present, _ne_socket_set_attribution, - _ne_socket_set_domains, _ne_socket_set_is_app_initiated, _ne_socket_set_website_attribution, - _ne_tracker_build_cache, _ne_tracker_build_trie, _ne_tracker_check_info_changed, - _ne_tracker_check_is_hostname_blocked, _ne_tracker_check_tcc, - _ne_tracker_clear_cache, _ne_tracker_context_can_block_request, + _ne_session_service_matches_address_for_interface, _ne_session_set_device_communication_exception, + _ne_session_set_event_handler, _ne_session_set_socket_attributes, + _ne_session_set_socket_context_attribute, _ne_session_set_socket_tracker_attributes, + _ne_session_should_disable_nexus, _ne_session_start, _ne_session_start_on_behalf_of, + _ne_session_start_with_options, _ne_session_status_to_string, + _ne_session_stop, _ne_session_stop_all_with_plugin_type, _ne_session_stop_reason_to_string, + _ne_session_type_to_string, _ne_session_use_as_system_vpn, + _ne_session_vod_evaluate_connection_present, _ne_session_vpn_include_all_networks_configs_present, + _ne_socket_set_attribution, _ne_socket_set_domains, _ne_socket_set_is_app_initiated, + _ne_socket_set_website_attribution, _ne_tracker_build_cache, + _ne_tracker_build_trie, _ne_tracker_check_info_changed, _ne_tracker_check_is_hostname_blocked, + _ne_tracker_check_tcc, _ne_tracker_clear_cache, _ne_tracker_context_can_block_request, _ne_tracker_context_get_domain, _ne_tracker_context_get_domain_owner, _ne_tracker_context_is_from_app_list, _ne_tracker_context_is_from_web_list, _ne_tracker_copy_current_stacktrace, _ne_tracker_create_xcode_issue, @@ -2901,7 +2941,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_notify.dylib' -current-version: 317 +current-version: 327.0.5 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -2918,21 +2958,23 @@ exports: _notify_simple_post, _notify_suspend, _notify_suspend_pid ] --- !tapi-tbd tbd-version: 4 -targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] +targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_platform.dylib' -current-version: 306.0.1 +current-version: 340 parent-umbrella: - - targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] + - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] umbrella: System exports: - - targets: [ i386-macos, i386-maccatalyst ] - symbols: [ _MKGetTimeBaseInfo, _udiv10 ] - - targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst ] - symbols: [ __sigtramp, _longjmperror ] - - targets: [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, - arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] + - targets: [ x86_64-macos, x86_64-maccatalyst ] + symbols: [ '_OSAtomicFifoDequeue$VARIANT$PFZ', '_OSAtomicFifoDequeue$VARIANT$UnfairLock', + '_OSAtomicFifoEnqueue$VARIANT$PFZ', '_OSAtomicFifoEnqueue$VARIANT$UnfairLock', + ___no_overread_variant_setup, __sigtramp, _bzero_sse_np, _longjmperror, + _memmove_sse_np, _memset_pattern16_sse_np, _memset_pattern4_sse_np, + _memset_pattern8_sse_np, _memset_sse_np ] + - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] symbols: [ _OSAtomicAdd32, _OSAtomicAdd32Barrier, _OSAtomicAdd64, _OSAtomicAdd64Barrier, _OSAtomicAnd32, _OSAtomicAnd32Barrier, _OSAtomicAnd32Orig, _OSAtomicAnd32OrigBarrier, _OSAtomicCompareAndSwap32, _OSAtomicCompareAndSwap32Barrier, @@ -2975,9 +3017,12 @@ exports: __spin_lock, __spin_lock_try, __spin_unlock, _ffs, _ffsl, _ffsll, _fls, _flsl, _flsll, _getcontext, _longjmp, _makecontext, _os_lock_lock, _os_lock_trylock, _os_lock_unlock, _os_log_simple_now, - _os_log_simple_type_from_asl, _os_unfair_lock_assert_not_owner, + _os_log_simple_type_from_asl, _os_sync_wait_on_address, _os_sync_wait_on_address_with_deadline, + _os_sync_wait_on_address_with_timeout, _os_sync_wake_by_address_all, + _os_sync_wake_by_address_any, _os_unfair_lock_assert_not_owner, _os_unfair_lock_assert_owner, _os_unfair_lock_lock, _os_unfair_lock_lock_no_tsd, - _os_unfair_lock_lock_with_options, _os_unfair_lock_trylock, + _os_unfair_lock_lock_with_flags, _os_unfair_lock_lock_with_options, + _os_unfair_lock_trylock, _os_unfair_lock_trylock_with_options, _os_unfair_lock_unlock, _os_unfair_lock_unlock_no_tsd, _os_unfair_recursive_lock_lock_with_options, _os_unfair_recursive_lock_owned, _os_unfair_recursive_lock_trylock, _os_unfair_recursive_lock_tryunlock4objc, _os_unfair_recursive_lock_unlock, @@ -2985,39 +3030,21 @@ exports: _setjmp, _siglongjmp, _sigsetjmp, _spin_lock, _spin_lock_try, _spin_unlock, _swapcontext, _sys_cache_control, _sys_dcache_flush, _sys_icache_invalidate ] - - targets: [ x86_64-macos, x86_64-maccatalyst ] - symbols: [ '_OSAtomicFifoDequeue$VARIANT$PFZ', '_OSAtomicFifoDequeue$VARIANT$UnfairLock', - '_OSAtomicFifoEnqueue$VARIANT$PFZ', '_OSAtomicFifoEnqueue$VARIANT$UnfairLock', - ___no_overread_variant_setup, _bzero_sse_np, _memmove_sse_np, - _memset_pattern16_sse_np, _memset_pattern4_sse_np, _memset_pattern8_sse_np, - _memset_sse_np ] - targets: [ arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] symbols: [ __ctx_done ] --- !tapi-tbd tbd-version: 4 -targets: [ i386-macos, x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, +targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_pthread.dylib' -current-version: 519 +current-version: 535 parent-umbrella: - - targets: [ i386-macos, x86_64-macos, x86_64-maccatalyst, arm64-macos, - arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] + - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] umbrella: System exports: - - targets: [ i386-macos ] - symbols: [ '_pthread_cancel$UNIX2003', '_pthread_cond_init$UNIX2003', - '_pthread_cond_timedwait$NOCANCEL$UNIX2003', '_pthread_cond_timedwait$UNIX2003', - '_pthread_cond_wait$NOCANCEL$UNIX2003', '_pthread_cond_wait$UNIX2003', - '_pthread_join$NOCANCEL$UNIX2003', '_pthread_join$UNIX2003', - '_pthread_mutexattr_destroy$UNIX2003', '_pthread_rwlock_destroy$UNIX2003', - '_pthread_rwlock_init$UNIX2003', '_pthread_rwlock_rdlock$UNIX2003', - '_pthread_rwlock_tryrdlock$UNIX2003', '_pthread_rwlock_trywrlock$UNIX2003', - '_pthread_rwlock_unlock$UNIX2003', '_pthread_rwlock_wrlock$UNIX2003', - '_pthread_setcancelstate$UNIX2003', '_pthread_setcanceltype$UNIX2003', - '_pthread_sigmask$UNIX2003', '_pthread_testcancel$UNIX2003', - '_sigwait$NOCANCEL$UNIX2003', '_sigwait$UNIX2003' ] - - targets: [ i386-macos, x86_64-macos, x86_64-maccatalyst, arm64-macos, - arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] + - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, + arm64e-macos, arm64e-maccatalyst ] symbols: [ ____chkstk_darwin, ___is_threaded, ___pthread_init, ___pthread_late_init, ___pthread_workqueue_setkill, ___unix_conforming, __pthread_atfork_child, __pthread_atfork_child_handlers, __pthread_atfork_parent, @@ -3033,8 +3060,8 @@ exports: __pthread_set_properties_self, __pthread_set_self, __pthread_setspecific_static, __pthread_start, __pthread_tsd_shared_cache_first, __pthread_tsd_shared_cache_last, __pthread_workloop_create, __pthread_workloop_destroy, __pthread_workqueue_add_cooperativethreads, - __pthread_workqueue_addthreads, __pthread_workqueue_asynchronous_override_add, - __pthread_workqueue_asynchronous_override_reset_all_self, + __pthread_workqueue_addthreads, __pthread_workqueue_allow_send_signals, + __pthread_workqueue_asynchronous_override_add, __pthread_workqueue_asynchronous_override_reset_all_self, __pthread_workqueue_asynchronous_override_reset_self, __pthread_workqueue_init, __pthread_workqueue_init_with_kevent, __pthread_workqueue_init_with_workloop, __pthread_workqueue_override_reset, __pthread_workqueue_override_start_direct, @@ -3051,13 +3078,14 @@ exports: _pthread_attr_setdetachstate, _pthread_attr_setguardsize, _pthread_attr_setinheritsched, _pthread_attr_setschedparam, _pthread_attr_setschedpolicy, _pthread_attr_setscope, _pthread_attr_setstack, - _pthread_attr_setstackaddr, _pthread_attr_setstacksize, _pthread_cancel, - _pthread_chdir_np, _pthread_cond_broadcast, _pthread_cond_destroy, - _pthread_cond_init, _pthread_cond_signal, _pthread_cond_signal_thread_np, - _pthread_cond_timedwait, _pthread_cond_timedwait_relative_np, - _pthread_cond_wait, _pthread_condattr_destroy, _pthread_condattr_getpshared, - _pthread_condattr_init, _pthread_condattr_setpshared, _pthread_cpu_number_np, - _pthread_create, _pthread_create_from_mach_thread, _pthread_create_suspended_np, + _pthread_attr_setstackaddr, _pthread_attr_setstacksize, _pthread_attr_setworkinterval_np, + _pthread_cancel, _pthread_chdir_np, _pthread_cond_broadcast, + _pthread_cond_destroy, _pthread_cond_init, _pthread_cond_signal, + _pthread_cond_signal_thread_np, _pthread_cond_timedwait, '_pthread_cond_timedwait$NOCANCEL', + _pthread_cond_timedwait_relative_np, _pthread_cond_wait, '_pthread_cond_wait$NOCANCEL', + _pthread_condattr_destroy, _pthread_condattr_getpshared, _pthread_condattr_init, + _pthread_condattr_setpshared, _pthread_cpu_number_np, _pthread_create, + _pthread_create_from_mach_thread, _pthread_create_suspended_np, _pthread_create_with_workgroup_np, _pthread_current_stack_contains_np, _pthread_dependency_fulfill_np, _pthread_dependency_init_np, _pthread_dependency_wait_np, _pthread_detach, _pthread_equal, @@ -3067,7 +3095,9 @@ exports: _pthread_getspecific, _pthread_install_workgroup_functions_np, _pthread_introspection_getspecific_np, _pthread_introspection_hook_install, _pthread_introspection_setspecific_np, _pthread_is_threaded_np, - _pthread_join, _pthread_key_create, _pthread_key_delete, _pthread_key_init_np, + _pthread_jit_write_freeze_callbacks_np, _pthread_jit_write_protect_supported_np, + _pthread_jit_write_with_callback_np, _pthread_join, '_pthread_join$NOCANCEL', + _pthread_key_create, _pthread_key_delete, _pthread_key_init_np, _pthread_kill, _pthread_layout_offsets, _pthread_mach_thread_np, _pthread_main_np, _pthread_main_thread_np, _pthread_mutex_destroy, _pthread_mutex_getprioceiling, _pthread_mutex_init, _pthread_mutex_lock, @@ -3094,22 +3124,16 @@ exports: _pthread_workqueue_addthreads_np, _pthread_workqueue_setdispatch_np, _pthread_workqueue_setdispatchoffset_np, _pthread_workqueue_setup, _pthread_yield_np, _qos_class_main, _qos_class_self, _sched_get_priority_max, - _sched_get_priority_min, _sched_yield, _sigwait, _start_wqthread, - _thread_chkstk_darwin, _thread_start ] - - targets: [ i386-macos, x86_64-macos, arm64-macos, arm64e-macos ] - symbols: [ __pthread_mutex_enable_legacy_mode, _pthread_jit_write_freeze_callbacks_np, - _pthread_jit_write_protect_np, _pthread_jit_write_protect_supported_np, - _pthread_jit_write_with_callback_np ] - - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, - arm64e-macos, arm64e-maccatalyst ] - symbols: [ '_pthread_cond_timedwait$NOCANCEL', '_pthread_cond_wait$NOCANCEL', - '_pthread_join$NOCANCEL', '_sigwait$NOCANCEL' ] + _sched_get_priority_min, _sched_yield, _sigwait, '_sigwait$NOCANCEL', + _start_wqthread, _thread_chkstk_darwin, _thread_start ] + - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] + symbols: [ __pthread_mutex_enable_legacy_mode, _pthread_jit_write_protect_np ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_sandbox.dylib' -current-version: 2169.0.12 +current-version: 2401.40.25 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -3121,13 +3145,14 @@ exports: _APP_SANDBOX_READ_WRITE, _IOS_SANDBOX_APPLICATION_GROUP, _IOS_SANDBOX_CONTAINER, _SANDBOX_CHECK_ALLOW_APPROVAL, _SANDBOX_CHECK_CANONICAL, _SANDBOX_CHECK_NOFOLLOW, _SANDBOX_CHECK_NO_APPROVAL, _SANDBOX_CHECK_NO_REPORT, _SANDBOX_CHECK_POSIX_READABLE, - _SANDBOX_EXTENSION_CANONICAL, _SANDBOX_EXTENSION_DEFAULT, - _SANDBOX_EXTENSION_MAGIC, _SANDBOX_EXTENSION_NOFOLLOW, _SANDBOX_EXTENSION_NO_REPORT, + _SANDBOX_CHECK_POSIX_WRITEABLE, _SANDBOX_EXTENSION_CANONICAL, + _SANDBOX_EXTENSION_DEFAULT, _SANDBOX_EXTENSION_MAGIC, _SANDBOX_EXTENSION_NOFOLLOW, + _SANDBOX_EXTENSION_NOFOLLOW_ANY, _SANDBOX_EXTENSION_NO_REPORT, _SANDBOX_EXTENSION_NO_STORAGE_CLASS, _SANDBOX_EXTENSION_PREFIXMATCH, - _SANDBOX_EXTENSION_UNRESOLVED, __amkrtemp, __sandbox_in_a_container, - __sandbox_register_app_bundle_0, __sandbox_register_app_bundle_1, - _kSBXProfileNoInternet, _kSBXProfileNoNetwork, _kSBXProfileNoWrite, - _kSBXProfileNoWriteExceptTemporary, _kSBXProfilePureComputation, + _SANDBOX_EXTENSION_UNRESOLVED, __amkrtemp, __sandbox_enter_notify_libxpc, + __sandbox_in_a_container, __sandbox_register_app_bundle_0, + __sandbox_register_app_bundle_1, _kSBXProfileNoInternet, _kSBXProfileNoNetwork, + _kSBXProfileNoWrite, _kSBXProfileNoWriteExceptTemporary, _kSBXProfilePureComputation, _kSandboxAppBundleAnySigningId, _kSandboxAppBundlePlatformTeamId, _kSandboxAppContainerAnySigningId, _kSandboxAppContainerPlatformTeamId, _rootless_allows_task_for_pid, _rootless_check_datavault_flag, @@ -3139,14 +3164,17 @@ exports: _rootless_remove_datavault_in_favor_of_static_storage_class, _rootless_remove_restricted_in_favor_of_static_storage_class, _rootless_restricted_environment, _rootless_suspend, _rootless_trusted_by_self_token, - _rootless_verify_trusted_by_self_token, _sandbox_builtin_query, - _sandbox_check, _sandbox_check_bulk, _sandbox_check_by_audit_token, - _sandbox_check_by_reference, _sandbox_check_by_uniqueid, _sandbox_check_message_filter_integer, - _sandbox_check_message_filter_string, _sandbox_check_protected_app_container, + _rootless_verify_trusted_by_self_token, _sandbox_apply_bytecode, + _sandbox_builtin_query, _sandbox_check, _sandbox_check_bulk, + _sandbox_check_by_audit_token, _sandbox_check_by_reference, + _sandbox_check_by_uniqueid, _sandbox_check_message_filter_integer, + _sandbox_check_message_filter_string, _sandbox_check_process_signal_target, + _sandbox_check_protected_app_container, _sandbox_check_self_signal_target, _sandbox_consume_extension, _sandbox_consume_fs_extension, _sandbox_consume_mach_extension, _sandbox_container_path_for_audit_token, - _sandbox_container_path_for_pid, _sandbox_enable_root_translation, - _sandbox_enable_state_flag, _sandbox_extension_consume, _sandbox_extension_issue_file, + _sandbox_container_path_for_pid, _sandbox_enable_local_state_flag, + _sandbox_enable_root_translation, _sandbox_enable_state_flag, + _sandbox_extension_consume, _sandbox_extension_issue_file, _sandbox_extension_issue_file_to_process, _sandbox_extension_issue_file_to_process_by_pid, _sandbox_extension_issue_file_to_self, _sandbox_extension_issue_generic, _sandbox_extension_issue_generic_to_process, _sandbox_extension_issue_generic_to_process_by_pid, @@ -3155,10 +3183,11 @@ exports: _sandbox_extension_issue_iokit_user_client_class, _sandbox_extension_issue_mach, _sandbox_extension_issue_mach_to_process, _sandbox_extension_issue_mach_to_process_by_pid, _sandbox_extension_issue_posix_ipc, _sandbox_extension_issue_related_file_to_process, - _sandbox_extension_reap, _sandbox_extension_release, _sandbox_extension_release_file, - _sandbox_extension_update_file, _sandbox_extension_update_file_by_fileid, - _sandbox_free_error, _sandbox_get_container_expected, _sandbox_init, - _sandbox_init_from_pid, _sandbox_init_with_extensions, _sandbox_init_with_parameters, + _sandbox_extension_reap, _sandbox_extension_release, _sandbox_extension_release_and_detect_last_reference, + _sandbox_extension_release_file, _sandbox_extension_update_file, + _sandbox_extension_update_file_by_fileid, _sandbox_free_error, + _sandbox_get_container_expected, _sandbox_init, _sandbox_init_from_pid, + _sandbox_init_with_extensions, _sandbox_init_with_parameters, _sandbox_issue_extension, _sandbox_issue_fs_extension, _sandbox_issue_fs_rw_extension, _sandbox_issue_mach_extension, _sandbox_message_filter_query, _sandbox_message_filter_release, _sandbox_message_filter_retain, @@ -3185,10 +3214,42 @@ exports: _rootless_manifest_parse, _rootless_preflight ] --- !tapi-tbd tbd-version: 4 +targets: [ x86_64-macos, arm64-macos, arm64e-macos ] +install-name: '/usr/lib/system/libsystem_sanitizers.dylib' +parent-umbrella: + - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] + umbrella: System +exports: + - targets: [ x86_64-macos, arm64-macos, arm64e-macos ] + symbols: [ ___asan_abi_addr_is_in_fake_stack, ___asan_abi_address_is_poisoned, + ___asan_abi_after_dynamic_init, ___asan_abi_alloca_poison, + ___asan_abi_allocas_unpoison, ___asan_abi_before_dynamic_init, + ___asan_abi_exp_load_n, ___asan_abi_exp_store_n, ___asan_abi_get_current_fake_stack, + ___asan_abi_handle_no_return, ___asan_abi_init, ___asan_abi_load_cxx_array_cookie, + ___asan_abi_load_n, ___asan_abi_memcpy, ___asan_abi_memmove, + ___asan_abi_memset, ___asan_abi_poison_cxx_array_cookie, ___asan_abi_poison_intra_object_redzone, + ___asan_abi_poison_memory_region, ___asan_abi_poison_stack_memory, + ___asan_abi_region_is_poisoned, ___asan_abi_register_elf_globals, + ___asan_abi_register_globals, ___asan_abi_register_image_globals, + ___asan_abi_report_exp_load_n, ___asan_abi_report_exp_store_n, + ___asan_abi_report_load_n, ___asan_abi_report_store_n, ___asan_abi_set_shadow_xx_n, + ___asan_abi_stack_free_n, ___asan_abi_stack_malloc_always_n, + ___asan_abi_stack_malloc_n, ___asan_abi_store_n, ___asan_abi_unpoison_intra_object_redzone, + ___asan_abi_unpoison_memory_region, ___asan_abi_unpoison_stack_memory, + ___asan_abi_unregister_elf_globals, ___asan_abi_unregister_globals, + ___asan_abi_unregister_image_globals, ___asan_get_alloc_stack, + ___asan_get_free_stack, ___asan_get_report_access_size, ___asan_get_report_access_type, + ___asan_get_report_address, ___asan_get_report_bp, ___asan_get_report_description, + ___asan_get_report_pc, ___asan_get_report_sp, ___asan_get_shadow_mapping, + ___asan_locate_address, ___asan_report_present, __sanitizers_init, + _sanitizers_address_on_report, _sanitizers_diagnose_memory_error, + _sanitizers_report_globals ] +--- !tapi-tbd +tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_secinit.dylib' -current-version: 139 +current-version: 153.0.6 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -3221,7 +3282,7 @@ tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libsystem_trace.dylib' -current-version: 1481.0.12 +current-version: 1612.40.4 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -3238,8 +3299,9 @@ exports: __os_log_get_nscf_formatter, __os_log_impl, __os_log_internal, __os_log_pack_fill, __os_log_pack_size, __os_log_preferences_compute, __os_log_preferences_copy_cache, __os_log_preferences_load, - __os_log_preferences_load_sysprefs, __os_log_release, __os_log_send_and_compose_impl, - __os_log_set_nscf_formatter, __os_signpost_emit_impl, __os_signpost_emit_unreliably_with_name_impl, + __os_log_preferences_load_sysprefs, __os_log_preferences_merge, + __os_log_release, __os_log_send_and_compose_impl, __os_log_set_nscf_formatter, + __os_log_unreliable_impl, __os_signpost_emit_impl, __os_signpost_emit_unreliably_with_name_impl, __os_signpost_emit_with_name_impl, __os_signpost_pack_fill, __os_signpost_pack_send, __os_state_request_for_pidlist, __os_trace_app_cryptex_sysprefsdir_path, __os_trace_atm_diagnostic_config, __os_trace_basesystem_storage_available, @@ -3247,8 +3309,9 @@ exports: __os_trace_get_boot_uuid, __os_trace_get_image_info, __os_trace_get_mode_for_pid, __os_trace_get_times_now, __os_trace_getxattr_at, __os_trace_intprefsdir_path, __os_trace_is_development_build, __os_trace_lazy_init_completed_4libxpc, - __os_trace_log_simple, __os_trace_macho_for_each_slice, __os_trace_malloc, - __os_trace_memdup, __os_trace_mmap, __os_trace_mmap_at, __os_trace_mmap_offset, + __os_trace_lazy_init_completed_4swift, __os_trace_log_simple, + __os_trace_macho_for_each_slice, __os_trace_malloc, __os_trace_memdup, + __os_trace_mmap, __os_trace_mmap_at, __os_trace_mmap_offset, __os_trace_mode_match_4tests, __os_trace_os_cryptex_sysprefsdir_path, __os_trace_prefs_latest_version_4tests, __os_trace_prefsdir_path, __os_trace_read_file_at, __os_trace_read_plist_at, __os_trace_realloc, @@ -3278,58 +3341,23 @@ exports: _os_log_set_hook, _os_log_set_hook_with_params, _os_log_set_test_callback, _os_log_shim_enabled, _os_log_shim_legacy_logging_enabled, _os_log_shim_with_CFString, _os_log_type_enabled, _os_log_type_get_name, - _os_log_with_args, _os_signpost_enabled, _os_signpost_id_generate, - _os_signpost_id_make_with_pointer, _os_signpost_set_introspection_hook_4Perf, - _os_state_add_handler, _os_state_remove_handler, _os_trace_debug_enabled, - _os_trace_get_mode, _os_trace_get_type, _os_trace_info_enabled, - _os_trace_set_mode ] + _os_log_with_args, _os_set_logging_unreliable_for_current_thread, + _os_signpost_enabled, _os_signpost_id_generate, _os_signpost_id_make_with_pointer, + _os_signpost_set_introspection_hook_4Perf, _os_state_add_handler, + _os_state_remove_handler, _os_trace_debug_enabled, _os_trace_get_mode, + _os_trace_get_type, _os_trace_info_enabled, _os_trace_set_mode ] objc-classes: [ OS_os_log ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libunwind.dylib' -current-version: 1600.112 +current-version: 1800.85 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] umbrella: System exports: - - targets: [ x86_64-macos, x86_64-maccatalyst ] - symbols: [ '$ld$hide$os10.4$__Unwind_Backtrace', '$ld$hide$os10.4$__Unwind_DeleteException', - '$ld$hide$os10.4$__Unwind_FindEnclosingFunction', '$ld$hide$os10.4$__Unwind_Find_FDE', - '$ld$hide$os10.4$__Unwind_ForcedUnwind', '$ld$hide$os10.4$__Unwind_GetCFA', - '$ld$hide$os10.4$__Unwind_GetDataRelBase', '$ld$hide$os10.4$__Unwind_GetGR', - '$ld$hide$os10.4$__Unwind_GetIP', '$ld$hide$os10.4$__Unwind_GetIPInfo', - '$ld$hide$os10.4$__Unwind_GetLanguageSpecificData', '$ld$hide$os10.4$__Unwind_GetRegionStart', - '$ld$hide$os10.4$__Unwind_GetTextRelBase', '$ld$hide$os10.4$__Unwind_RaiseException', - '$ld$hide$os10.4$__Unwind_Resume', '$ld$hide$os10.4$__Unwind_Resume_or_Rethrow', - '$ld$hide$os10.4$__Unwind_SetGR', '$ld$hide$os10.4$__Unwind_SetIP', - '$ld$hide$os10.4$___deregister_frame', '$ld$hide$os10.4$___deregister_frame_info', - '$ld$hide$os10.4$___deregister_frame_info_bases', '$ld$hide$os10.4$___register_frame', - '$ld$hide$os10.4$___register_frame_info', '$ld$hide$os10.4$___register_frame_info_bases', - '$ld$hide$os10.4$___register_frame_info_table', '$ld$hide$os10.4$___register_frame_info_table_bases', - '$ld$hide$os10.4$___register_frame_table', '$ld$hide$os10.5$__Unwind_Backtrace', - '$ld$hide$os10.5$__Unwind_DeleteException', '$ld$hide$os10.5$__Unwind_FindEnclosingFunction', - '$ld$hide$os10.5$__Unwind_Find_FDE', '$ld$hide$os10.5$__Unwind_ForcedUnwind', - '$ld$hide$os10.5$__Unwind_GetCFA', '$ld$hide$os10.5$__Unwind_GetDataRelBase', - '$ld$hide$os10.5$__Unwind_GetGR', '$ld$hide$os10.5$__Unwind_GetIP', - '$ld$hide$os10.5$__Unwind_GetIPInfo', '$ld$hide$os10.5$__Unwind_GetLanguageSpecificData', - '$ld$hide$os10.5$__Unwind_GetRegionStart', '$ld$hide$os10.5$__Unwind_GetTextRelBase', - '$ld$hide$os10.5$__Unwind_RaiseException', '$ld$hide$os10.5$__Unwind_Resume', - '$ld$hide$os10.5$__Unwind_Resume_or_Rethrow', '$ld$hide$os10.5$__Unwind_SetGR', - '$ld$hide$os10.5$__Unwind_SetIP', '$ld$hide$os10.5$___deregister_frame', - '$ld$hide$os10.5$___deregister_frame_info', '$ld$hide$os10.5$___deregister_frame_info_bases', - '$ld$hide$os10.5$___register_frame', '$ld$hide$os10.5$___register_frame_info', - '$ld$hide$os10.5$___register_frame_info_bases', '$ld$hide$os10.5$___register_frame_info_table', - '$ld$hide$os10.5$___register_frame_info_table_bases', '$ld$hide$os10.5$___register_frame_table', - '$ld$hide$os10.6$___deregister_frame_info', '$ld$hide$os10.6$___deregister_frame_info_bases', - '$ld$hide$os10.6$___register_frame_info', '$ld$hide$os10.6$___register_frame_info_bases', - '$ld$hide$os10.6$___register_frame_info_table', '$ld$hide$os10.6$___register_frame_info_table_bases', - '$ld$hide$os10.6$___register_frame_table', ___deregister_frame_info, - ___deregister_frame_info_bases, ___register_frame_info, ___register_frame_info_bases, - ___register_frame_info_table, ___register_frame_info_table_bases, - ___register_frame_table ] - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] symbols: [ __Unwind_Backtrace, __Unwind_DeleteException, __Unwind_FindEnclosingFunction, @@ -3347,12 +3375,14 @@ exports: _unw_init_local, _unw_is_fpreg, _unw_is_signal_frame, _unw_iterate_dwarf_unwind_cache, _unw_local_addr_space, _unw_regname, _unw_resume, _unw_set_fpreg, _unw_set_reg, _unw_step ] + - targets: [ arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] + symbols: [ ___unw_is_pointer_auth_enabled ] --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] install-name: '/usr/lib/system/libxpc.dylib' -current-version: 2679.0.25 +current-version: 2866.40.11 parent-umbrella: - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] @@ -3397,15 +3427,16 @@ exports: _XPC_ACTIVITY_USES_DUET_POWER_BUDGETING, _XPC_COALITION_INFO_KEY_BUNDLE_IDENTIFIER, _XPC_COALITION_INFO_KEY_CID, _XPC_COALITION_INFO_KEY_NAME, _XPC_COALITION_INFO_KEY_RESOURCE_USAGE_BLOB, ___xpc_connection_set_logging, - __availability_version_check, __launch_job_routine, __launch_job_routine_async, - __launch_msg2, __launch_server_test_routine, __launch_service_stats_copy_4ppse_impl, + __availability_version_check, __launch_job_query_routine, + __launch_job_routine, __launch_job_routine_async, __launch_msg2, + __launch_server_test_routine, __launch_service_stats_copy_4ppse_impl, __launch_service_stats_copy_impl, __libxpc_initializer, __spawn_via_launchd, __system_ios_support_version_copy_string_sysctl, __system_version_copy_string_plist, __system_version_copy_string_sysctl, __system_version_fallback, - __system_version_parse_string, __vproc_get_last_exit_status, - __vproc_grab_subset, __vproc_kickstart_by_label, __vproc_log, - __vproc_log_error, __vproc_logv, __vproc_pid_is_managed, __vproc_post_fork_ping, - __vproc_send_signal_by_label, __vproc_set_global_on_demand, + __system_version_parse_string, __system_version_plist_path, + __vproc_get_last_exit_status, __vproc_grab_subset, __vproc_kickstart_by_label, + __vproc_log, __vproc_log_error, __vproc_logv, __vproc_pid_is_managed, + __vproc_post_fork_ping, __vproc_send_signal_by_label, __vproc_set_global_on_demand, __vproc_standby_begin, __vproc_standby_count, __vproc_standby_end, __vproc_standby_timeout, __vproc_transaction_begin, __vproc_transaction_count, __vproc_transaction_count_for_pid, __vproc_transaction_end, @@ -3419,19 +3450,22 @@ exports: __xpc_connection_set_event_handler_f, __xpc_data_set_value, __xpc_dictionary_create_reply_with_port, __xpc_dictionary_extract_mach_send, __xpc_dictionary_extract_reply_msg_id, __xpc_dictionary_extract_reply_port, - __xpc_dictionary_get_reply_msg_id, __xpc_dictionary_set_remote_connection, - __xpc_dictionary_set_reply_msg_id, __xpc_domain_routine, __xpc_double_set_value, - __xpc_error_connection_interrupted, __xpc_error_connection_invalid, - __xpc_error_key_description, __xpc_error_peer_code_signing_requirement, - __xpc_error_termination_imminent, __xpc_event_key_name, __xpc_event_key_stream_name, - __xpc_fd_get_port, __xpc_int64_set_value, __xpc_payload_create_from_mach_msg, + __xpc_dictionary_get_reply_msg_id, __xpc_dictionary_get_transaction, + __xpc_dictionary_set_remote_connection, __xpc_dictionary_set_reply_msg_id, + __xpc_domain_routine, __xpc_double_set_value, __xpc_error_connection_interrupted, + __xpc_error_connection_invalid, __xpc_error_key_description, + __xpc_error_peer_code_signing_requirement, __xpc_error_termination_imminent, + __xpc_event_key_name, __xpc_event_key_stream_name, __xpc_fd_get_port, + __xpc_int64_set_value, __xpc_payload_create_from_mach_msg, __xpc_pipe_handle_mig, __xpc_pipe_interface_routine, __xpc_pipe_interface_routine_async, __xpc_pipe_interface_simpleroutine, __xpc_runtime_get_entitlements_data, __xpc_runtime_get_self_entitlements, __xpc_runtime_is_app_sandboxed, - __xpc_service_last_xref_cancel, __xpc_service_routine, __xpc_shmem_get_mach_port, - __xpc_spawnattr_binprefs_pack, __xpc_spawnattr_binprefs_size, - __xpc_spawnattr_binprefs_unpack, __xpc_spawnattr_pack_bytes, - __xpc_spawnattr_pack_string, __xpc_spawnattr_pack_string_fragment, + __xpc_runtime_process_has_entered_sandbox, __xpc_service_last_xref_cancel, + __xpc_service_routine, __xpc_session_create_from_connection_4SWIFT, + __xpc_session_extract_connection_4SWIFT, __xpc_session_get_peer_audit_token_4SWIFT, + __xpc_shmem_get_mach_port, __xpc_spawnattr_binprefs_pack, + __xpc_spawnattr_binprefs_size, __xpc_spawnattr_binprefs_unpack, + __xpc_spawnattr_pack_bytes, __xpc_spawnattr_pack_string, __xpc_spawnattr_pack_string_fragment, __xpc_spawnattr_unpack_bytes, __xpc_spawnattr_unpack_string, __xpc_spawnattr_unpack_strings, __xpc_string_set_value, __xpc_type_activity, __xpc_type_array, __xpc_type_base, __xpc_type_bool, __xpc_type_bundle, @@ -3442,13 +3476,20 @@ exports: __xpc_type_null, __xpc_type_pipe, __xpc_type_pointer, __xpc_type_rich_error, __xpc_type_serializer, __xpc_type_service, __xpc_type_service_instance, __xpc_type_session, __xpc_type_shmem, __xpc_type_string, __xpc_type_uint64, - __xpc_type_uuid, __xpc_vtables, _bootstrap_check_in, _bootstrap_check_in2, - _bootstrap_check_in3, _bootstrap_create_server, _bootstrap_create_service, - _bootstrap_get_root, _bootstrap_info, _bootstrap_init, _bootstrap_look_up, - _bootstrap_look_up2, _bootstrap_look_up3, _bootstrap_look_up_per_user, - _bootstrap_lookup_children, _bootstrap_parent, _bootstrap_register, - _bootstrap_register2, _bootstrap_status, _bootstrap_strerror, - _bootstrap_subset, _bootstrap_unprivileged, _create_and_switch_to_per_session_launchd, + __xpc_type_uuid, __xpc_vtables, _amfi_developer_mode_resolved, + _amfi_developer_mode_status, _amfi_interface_authorize_local_signing, + _amfi_interface_cdhash_in_trustcache, _amfi_interface_get_local_signing_private_key, + _amfi_interface_get_local_signing_public_key, _amfi_interface_query_bootarg_state, + _amfi_interface_set_local_signing_public_key, _amfi_launch_constraint_matches_process, + _amfi_launch_constraint_set_spawnattr, _amfi_restricted_execution_mode_enable, + _amfi_restricted_execution_mode_status, _bootstrap_check_in, + _bootstrap_check_in2, _bootstrap_check_in3, _bootstrap_create_server, + _bootstrap_create_service, _bootstrap_get_root, _bootstrap_info, + _bootstrap_init, _bootstrap_look_up, _bootstrap_look_up2, + _bootstrap_look_up3, _bootstrap_look_up_per_user, _bootstrap_lookup_children, + _bootstrap_parent, _bootstrap_register, _bootstrap_register2, + _bootstrap_status, _bootstrap_strerror, _bootstrap_subset, + _bootstrap_unprivileged, _create_and_switch_to_per_session_launchd, _launch_activate_socket, _launch_active_user_login, _launch_active_user_logout, _launch_active_user_switch, _launch_add_external_service, _launch_bootout_user_service_4coresim, _launch_copy_busy_extension_instances, @@ -3474,27 +3515,28 @@ exports: _launch_extension_property_path, _launch_extension_property_pid, _launch_extension_property_version, _launch_extension_property_xpc_bundle, _launch_get_fd, _launch_get_service_enabled, _launch_get_system_service_enabled, - _launch_load_mounted_jetsam_properties, _launch_msg, _launch_path_for_user_service_4coresim, - _launch_perfcheck_property_endpoint_active, _launch_perfcheck_property_endpoint_event, - _launch_perfcheck_property_endpoint_name, _launch_perfcheck_property_endpoint_needs_activation, - _launch_perfcheck_property_endpoints, _launch_remove_external_service, - _launch_service_instance_copy_uuids, _launch_service_instance_create, - _launch_service_instance_remove, _launch_service_stats_disable, - _launch_service_stats_disable_4ppse, _launch_service_stats_enable, - _launch_service_stats_enable_4ppse, _launch_service_stats_is_enabled, - _launch_service_stats_is_enabled_4ppse, _launch_set_service_enabled, - _launch_set_system_service_enabled, _launch_socket_service_check_in, + _launch_job_query_get_additional_job_properties, _launch_load_mounted_jetsam_properties, + _launch_msg, _launch_path_for_user_service_4coresim, _launch_perfcheck_property_endpoint_active, + _launch_perfcheck_property_endpoint_event, _launch_perfcheck_property_endpoint_name, + _launch_perfcheck_property_endpoint_needs_activation, _launch_perfcheck_property_endpoints, + _launch_remove_external_service, _launch_service_instance_copy_uuids, + _launch_service_instance_create, _launch_service_instance_remove, + _launch_service_stats_disable, _launch_service_stats_disable_4ppse, + _launch_service_stats_enable, _launch_service_stats_enable_4ppse, + _launch_service_stats_is_enabled, _launch_service_stats_is_enabled_4ppse, + _launch_set_service_enabled, _launch_set_system_service_enabled, + _launch_socket_service_check_in, _launch_userspace_reboot_with_purpose, _launch_version_for_user_service_4coresim, _launch_wait, _launchd_close, _launchd_fdopen, _launchd_getfd, _launchd_msg_recv, _launchd_msg_send, _load_launchd_jobs_at_loginwindow_prompt, _mpm_uncork_fork, _mpm_wait, _os_system_version_get_current_version, _os_system_version_get_ios_support_version, _os_system_version_sim_get_current_host_version, _os_transaction_copy_description, - _os_transaction_create, _os_transaction_get_description, _os_transaction_get_timestamp, - _os_transaction_needs_more_time, _place_hold_on_real_loginwindow, - _reboot2, _reboot3, _vproc_release, _vproc_retain, _vproc_standby_begin, - _vproc_standby_end, _vproc_swap_complex, _vproc_swap_integer, - _vproc_swap_string, _vproc_transaction_begin, _vproc_transaction_end, - _vprocmgr_lookup_vproc, _xpc_activity_add_eligibility_changed_handler, + _os_transaction_create, _os_transaction_get_description, _os_transaction_get_ra, + _os_transaction_get_timestamp, _os_transaction_needs_more_time, + _place_hold_on_real_loginwindow, _reboot2, _reboot3, _vproc_release, + _vproc_retain, _vproc_standby_begin, _vproc_standby_end, _vproc_swap_complex, + _vproc_swap_integer, _vproc_swap_string, _vproc_transaction_begin, + _vproc_transaction_end, _vprocmgr_lookup_vproc, _xpc_activity_add_eligibility_changed_handler, _xpc_activity_copy_criteria, _xpc_activity_copy_dispatch_queue, _xpc_activity_copy_identifier, _xpc_activity_debug, _xpc_activity_defer_until_network_change, _xpc_activity_defer_until_percentage, _xpc_activity_get_percentage, @@ -3548,10 +3590,13 @@ exports: _xpc_connection_set_instance, _xpc_connection_set_instance_binpref, _xpc_connection_set_legacy, _xpc_connection_set_non_launching, _xpc_connection_set_oneshot_instance, _xpc_connection_set_peer_code_signing_requirement, - _xpc_connection_set_privileged, _xpc_connection_set_qos_class_fallback, - _xpc_connection_set_qos_class_floor, _xpc_connection_set_target_queue, - _xpc_connection_set_target_uid, _xpc_connection_set_target_user_session_uid, - _xpc_connection_suspend, _xpc_copy, _xpc_copy_bootstrap, _xpc_copy_clean_description, + _xpc_connection_set_peer_entitlement_exists_requirement, _xpc_connection_set_peer_entitlement_matches_value_requirement, + _xpc_connection_set_peer_lightweight_code_requirement, _xpc_connection_set_peer_platform_identity_requirement, + _xpc_connection_set_peer_team_identity_requirement, _xpc_connection_set_privileged, + _xpc_connection_set_qos_class_fallback, _xpc_connection_set_qos_class_floor, + _xpc_connection_set_target_queue, _xpc_connection_set_target_uid, + _xpc_connection_set_target_user_session_uid, _xpc_connection_suspend, + _xpc_copy, _xpc_copy_bootstrap, _xpc_copy_clean_description, _xpc_copy_code_signing_identity_for_token, _xpc_copy_debug_description, _xpc_copy_description, _xpc_copy_domain, _xpc_copy_entitlement_for_self, _xpc_copy_entitlement_for_token, _xpc_copy_entitlements_data_for_token, @@ -3587,31 +3632,36 @@ exports: _xpc_dictionary_set_string, _xpc_dictionary_set_uint64, _xpc_dictionary_set_uuid, _xpc_dictionary_set_value, _xpc_double_create, _xpc_double_get_value, _xpc_endpoint_compare, _xpc_endpoint_copy_listener_port_4sim, - _xpc_endpoint_create, _xpc_endpoint_create_bs_named, _xpc_endpoint_create_bs_service, - _xpc_endpoint_create_mach_port_4sim, _xpc_endpoint_get_bs_job_handle, - _xpc_equal, _xpc_event_publisher_activate, _xpc_event_publisher_copy_event, - _xpc_event_publisher_create, _xpc_event_publisher_fire, _xpc_event_publisher_fire_noboost, + _xpc_endpoint_create, _xpc_endpoint_create_bs_from_port, _xpc_endpoint_create_bs_named, + _xpc_endpoint_create_bs_service, _xpc_endpoint_create_mach_port_4sim, + _xpc_endpoint_get_bs_job_handle, _xpc_equal, _xpc_event_publisher_activate, + _xpc_event_publisher_copy_event, _xpc_event_publisher_create, + _xpc_event_publisher_create_subscription, _xpc_event_publisher_fire, + _xpc_event_publisher_fire_barrier, _xpc_event_publisher_fire_noboost, _xpc_event_publisher_fire_with_reply, _xpc_event_publisher_fire_with_reply_sync, _xpc_event_publisher_get_subscriber_asid, _xpc_event_publisher_set_error_handler, _xpc_event_publisher_set_event, _xpc_event_publisher_set_handler, _xpc_event_publisher_set_initial_load_completed_handler_4remoted, - _xpc_event_publisher_set_subscriber_keepalive, _xpc_event_stream_check_in, - _xpc_event_stream_check_in2, _xpc_exit_reason_get_label, _xpc_extension_type_init, - _xpc_fd_create, _xpc_fd_dup, _xpc_file_transfer_cancel, _xpc_file_transfer_copy_io, - _xpc_file_transfer_create_with_fd, _xpc_file_transfer_create_with_path, - _xpc_file_transfer_get_size, _xpc_file_transfer_get_transfer_id, - _xpc_file_transfer_send_finished, _xpc_file_transfer_set_transport_writing_callbacks, - _xpc_file_transfer_write_finished, _xpc_file_transfer_write_to_fd, - _xpc_file_transfer_write_to_path, _xpc_generate_audit_token, - _xpc_get_attachment_endpoint, _xpc_get_class4NSXPC, _xpc_get_event_name, - _xpc_get_instance, _xpc_get_type, _xpc_handle_service, _xpc_handle_subservice, + _xpc_event_publisher_set_subscriber_keepalive, _xpc_event_publisher_set_throttling, + _xpc_event_stream_check_in, _xpc_event_stream_check_in2, _xpc_exit_reason_get_label, + _xpc_extension_type_init, _xpc_fd_create, _xpc_fd_dup, _xpc_file_transfer_cancel, + _xpc_file_transfer_copy_io, _xpc_file_transfer_create_with_fd, + _xpc_file_transfer_create_with_path, _xpc_file_transfer_get_size, + _xpc_file_transfer_get_transfer_id, _xpc_file_transfer_send_finished, + _xpc_file_transfer_set_transport_writing_callbacks, _xpc_file_transfer_write_finished, + _xpc_file_transfer_write_to_fd, _xpc_file_transfer_write_to_path, + _xpc_generate_audit_token, _xpc_get_attachment_endpoint, _xpc_get_class4NSXPC, + _xpc_get_event_name, _xpc_get_instance, _xpc_get_service_identifier_for_token, + _xpc_get_service_name_from_pid, _xpc_get_service_uid_for_token, + _xpc_get_type, _xpc_handle_service, _xpc_handle_subservice, _xpc_hash, _xpc_impersonate_user, _xpc_init_services, _xpc_inspect_copy_description, _xpc_inspect_copy_description_local, _xpc_inspect_copy_short_description, _xpc_inspect_copy_short_description_local, _xpc_install_remote_hooks, _xpc_int64_create, _xpc_int64_get_value, _xpc_is_kind_of_xpc_object4NSXPC, - _xpc_is_system_session, _xpc_listener_activate, _xpc_listener_cancel, - _xpc_listener_copy_description, _xpc_listener_create, _xpc_listener_create_anonymous, - _xpc_listener_create_endpoint, _xpc_listener_reject_peer, + _xpc_is_system_session, _xpc_is_xpcservice, _xpc_listener_activate, + _xpc_listener_cancel, _xpc_listener_copy_description, _xpc_listener_create, + _xpc_listener_create_anonymous, _xpc_listener_create_endpoint, + _xpc_listener_reject_peer, _xpc_listener_set_peer_code_signing_requirement, _xpc_mach_recv_create, _xpc_mach_recv_extract_right, _xpc_mach_send_copy_right, _xpc_mach_send_create, _xpc_mach_send_create_with_disposition, _xpc_mach_send_get_right, _xpc_mach_send_once_create, _xpc_mach_send_once_extract_right, @@ -3622,9 +3672,10 @@ exports: _xpc_pipe_routine_async, _xpc_pipe_routine_forward, _xpc_pipe_routine_reply, _xpc_pipe_routine_with_flags, _xpc_pipe_simpleroutine, _xpc_pipe_try_receive, _xpc_pointer_create, _xpc_pointer_get_value, _xpc_receive_mach_msg, - _xpc_receive_remote_msg, _xpc_release, _xpc_retain, _xpc_rich_error_can_retry, - _xpc_rich_error_copy_description, _xpc_service_attach, _xpc_service_attach_with_flags, - _xpc_service_create, _xpc_service_create_from_specifier, _xpc_service_get_rendezvous_token, + _xpc_receive_mach_msg_validate_hdr, _xpc_receive_remote_msg, + _xpc_release, _xpc_retain, _xpc_rich_error_can_retry, _xpc_rich_error_copy_description, + _xpc_service_attach, _xpc_service_attach_with_flags, _xpc_service_create, + _xpc_service_create_from_specifier, _xpc_service_get_rendezvous_token, _xpc_service_instance_dup2, _xpc_service_instance_get_context, _xpc_service_instance_get_host_pid, _xpc_service_instance_get_pid, _xpc_service_instance_get_type, _xpc_service_instance_is_configurable, @@ -3639,7 +3690,8 @@ exports: _xpc_session_create_xpc_endpoint, _xpc_session_create_xpc_service, _xpc_session_send_message, _xpc_session_send_message_with_reply_async, _xpc_session_send_message_with_reply_sync, _xpc_session_set_cancel_handler, - _xpc_session_set_incoming_message_handler, _xpc_session_set_target_queue, + _xpc_session_set_incoming_message_handler, _xpc_session_set_instance, + _xpc_session_set_peer_code_signing_requirement, _xpc_session_set_target_queue, _xpc_session_set_target_user_session_uid, _xpc_set_event, _xpc_set_event_state, _xpc_set_event_stream_handler, _xpc_set_event_with_flags, _xpc_set_idle_handler, _xpc_shmem_create, _xpc_shmem_create_readonly, diff --git a/lib/libc/include/any-macos-any/AssertMacros.h b/lib/libc/include/any-macos-any/AssertMacros.h index 5fc9bc0389ca..5da90158f99d 100644 --- a/lib/libc/include/any-macos-any/AssertMacros.h +++ b/lib/libc/include/any-macos-any/AssertMacros.h @@ -218,18 +218,32 @@ #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)); + printf( "AssertMacros: %s, %s file: %s, line: %d, value: %lld\n", assertion, (message!=0) ? message : "", file, line, (long long) (value)); #elif TARGET_OS_DRIVERKIT #include #define DEBUG_ASSERT_MESSAGE(name, assertion, label, message, file, line, value) \ - os_log(OS_LOG_DEFAULT, "AssertMacros: %s, %s file: %s, line: %d, value: %ld\n", assertion, (message!=0) ? message : "", file, line, (long) (value)); + os_log(OS_LOG_DEFAULT, "AssertMacros: %s, %s file: %s, line: %d, value: %lld\n", assertion, (message!=0) ? message : "", file, line, (long 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)); + fprintf(stderr, "AssertMacros: %s, %s file: %s, line: %d, value: %lld\n", assertion, (message!=0) ? message : "", file, line, (long long) (value)); #endif #endif +/* + * DEBUG_ASSERT_FORCE_64_BIT_ERROR_CODE + * + * Summary: + * By default the errorCode passed to DEBUG_ASSERT_MESSAGE will be the system word + * length. If DEBUG_ASSERT_FORCE_64_BIT_ERROR_CODE is set then it will be changed + * to a 64 bit integer, even on 32 bit platforms. + */ +#ifndef DEBUG_ASSERT_FORCE_64_BIT_ERROR_CODE + #define DEBUG_ASSERT_ERROR_TYPE long +#else + #define DEBUG_ASSERT_ERROR_TYPE long long +#endif + @@ -361,7 +375,7 @@ #define __Check_noErr(errorCode) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ @@ -397,7 +411,7 @@ #define __Check_noErr_String(errorCode, message) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ @@ -523,7 +537,7 @@ #define __Verify_noErr(errorCode) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ @@ -565,7 +579,7 @@ #define __Verify_noErr_String(errorCode, message) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ @@ -605,7 +619,7 @@ #else #define __Verify_noErr_Action(errorCode, action) \ do { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) { \ DEBUG_ASSERT_MESSAGE( \ DEBUG_ASSERT_COMPONENT_NAME_STRING, \ @@ -970,7 +984,7 @@ #define __Require_noErr(errorCode, exceptionLabel) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ @@ -1022,7 +1036,7 @@ #define __Require_noErr_Action(errorCode, exceptionLabel, action) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ @@ -1131,7 +1145,7 @@ #define __Require_noErr_String(errorCode, exceptionLabel, message) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ @@ -1186,7 +1200,7 @@ #define __Require_noErr_Action_String(errorCode, exceptionLabel, action, message) \ do \ { \ - long evalOnceErrorCode = (errorCode); \ + DEBUG_ASSERT_ERROR_TYPE evalOnceErrorCode = (errorCode); \ if ( __builtin_expect(0 != evalOnceErrorCode, 0) ) \ { \ DEBUG_ASSERT_MESSAGE( \ diff --git a/lib/libc/include/any-macos-any/Availability.h b/lib/libc/include/any-macos-any/Availability.h index abb3b8e16a3a..2eccdf130720 100644 --- a/lib/libc/include/any-macos-any/Availability.h +++ b/lib/libc/include/any-macos-any/Availability.h @@ -159,13 +159,26 @@ #define __API_TO_BE_DEPRECATED_DRIVERKIT 100000 #endif -#ifndef __API_TO_BE_DEPRECATED_XROS -#define __API_TO_BE_DEPRECATED_XROS 100000 +#ifndef __API_TO_BE_DEPRECATED_VISIONOS +#define __API_TO_BE_DEPRECATED_VISIONOS 100000 #endif +#ifndef __API_TO_BE_DEPRECATED_EXCLAVEKIT + +#endif + + + +#ifndef __OPEN_SOURCE__ + +#endif /* __OPEN_SOURCE__ */ #include #include +#include +#if __has_include() + #include +#endif #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_ios @@ -419,9 +432,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,__API_AVAILABLE0,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,__API_AVAILABLE0,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,__API_AVAILABLE_BEGIN0,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,__API_AVAILABLE_BEGIN0,0)(__VA_ARGS__) #define __API_AVAILABLE_END _Pragma("clang attribute pop") /* @@ -440,13 +453,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_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1,__API_DEPRECATED_MSG0,0,0)(__VA_ARGS__) - #define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1,__API_DEPRECATED_REP0,0,0)(__VA_ARGS__) + #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,__API_DEPRECATED_MSG0,0,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,__API_DEPRECATED_REP0,0,0)(__VA_ARGS__) - #define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN7,__API_DEPRECATED_BEGIN6,__API_DEPRECATED_BEGIN5,__API_DEPRECATED_BEGIN4,__API_DEPRECATED_BEGIN3,__API_DEPRECATED_BEGIN2,__API_DEPRECATED_BEGIN1,__API_DEPRECATED_BEGIN0,0,0)(__VA_ARGS__) + #define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN8,__API_DEPRECATED_BEGIN7,__API_DEPRECATED_BEGIN6,__API_DEPRECATED_BEGIN5,__API_DEPRECATED_BEGIN4,__API_DEPRECATED_BEGIN3,__API_DEPRECATED_BEGIN2,__API_DEPRECATED_BEGIN1,__API_DEPRECATED_BEGIN0,0,0)(__VA_ARGS__) #define __API_DEPRECATED_END _Pragma("clang attribute pop") - #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_WITH_REPLACEMENT_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN7,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN6,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN5,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN4,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN3,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN2,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN1,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN0,0,0)(__VA_ARGS__) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_WITH_REPLACEMENT_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN8,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN7,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN6,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN5,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN4,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN3,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN2,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN1,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN0,0,0)(__VA_ARGS__) #define __API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop") /* @@ -457,9 +470,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,__API_UNAVAILABLE0,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,__API_UNAVAILABLE0,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,__API_UNAVAILABLE_BEGIN0,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,__API_UNAVAILABLE_BEGIN0,0)(__VA_ARGS__) #define __API_UNAVAILABLE_END _Pragma("clang attribute pop") #endif /* __has_attribute(availability) */ #endif /* #if defined(__has_feature) && defined(__has_attribute) */ @@ -524,6 +537,14 @@ #define __SPI_AVAILABLE(...) #endif +#ifndef __SPI_AVAILABLE_BEGIN + #define __SPI_AVAILABLE_BEGIN(...) +#endif + +#ifndef __SPI_AVAILABLE_END + #define __SPI_AVAILABLE_END(...) +#endif + #ifndef __SPI_DEPRECATED #define __SPI_DEPRECATED(...) #endif diff --git a/lib/libc/include/any-macos-any/AvailabilityInternal.h b/lib/libc/include/any-macos-any/AvailabilityInternal.h index c6189813a55c..37a7a075facc 100644 --- a/lib/libc/include/any-macos-any/AvailabilityInternal.h +++ b/lib/libc/include/any-macos-any/AvailabilityInternal.h @@ -30,19 +30,17 @@ #ifndef __AVAILABILITY_INTERNAL__ #define __AVAILABILITY_INTERNAL__ -#if __has_include() - #include -#endif +#include #ifndef __MAC_OS_X_VERSION_MIN_REQUIRED #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(macos) #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ - #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_14_0 + #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_15_1 #endif #elif __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_14_0 + #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_15_1 #endif /* __has_builtin(__is_target_os) && __is_target_os(macos) */ #endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */ @@ -50,11 +48,11 @@ #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(ios) #define __IPHONE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ - #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_17_0 + #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_18_1 #endif #elif __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ #define __IPHONE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ - #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_17_0 + #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_18_1 #endif /* __has_builtin(__is_target_os) && __is_target_os(ios) */ #endif /* __IPHONE_OS_VERSION_MIN_REQUIRED */ @@ -62,13 +60,13 @@ #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(watchos) #define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ - #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_10_0 + #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_11_1 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_9_0 #endif #elif __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ #define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ - #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_10_0 + #define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_11_1 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_9_0 #endif /* __has_builtin(__is_target_os) && __is_target_os(watchos) */ @@ -78,13 +76,13 @@ #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(tvos) #define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ - #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_17_0 + #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_18_1 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_9_0 #endif #elif __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ #define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ - #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_17_0 + #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_18_1 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_9_0 #endif /* __has_builtin(__is_target_os) && __is_target_os(tvos) */ @@ -94,7 +92,7 @@ #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(bridgeos) #define __BRIDGE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ - #define __BRIDGE_OS_VERSION_MAX_ALLOWED __BRIDGEOS_8_0 + #define __BRIDGE_OS_VERSION_MAX_ALLOWED __BRIDGEOS_9_1 /* for compatibility with existing code. New code should use platform specific checks */ #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_11_0 #endif @@ -105,22 +103,45 @@ #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(driverkit) #define __DRIVERKIT_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ - #define __DRIVERKIT_VERSION_MAX_ALLOWED __DRIVERKIT_23_0 + #define __DRIVERKIT_VERSION_MAX_ALLOWED __DRIVERKIT_24_1 #endif #endif /* __has_builtin(__is_target_os) && __is_target_os(driverkit) */ #endif /* __DRIVERKIT_VERSION_MIN_REQUIRED */ -#ifndef __XR_OS_VERSION_MIN_REQUIRED +#ifndef __VISION_OS_VERSION_MIN_REQUIRED + #if defined(__has_builtin) && __has_builtin(__is_target_os) + #if __is_target_os(visionos) + #define __VISION_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ + #define __VISION_OS_VERSION_MAX_ALLOWED __VISIONOS_2_1 + /* for compatibility with existing code. New code should use platform specific checks */ + #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_17_1 + #endif + #endif /* __has_builtin(__is_target_os) && __is_target_os(visionos) */ +#endif /* __VISION_OS_VERSION_MIN_REQUIRED */ + + +//FIXME: Workaround for rdar://116062344 +#ifndef __VISION_OS_VERSION_MIN_REQUIRED #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(xros) - #define __XR_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ - #define __XR_OS_VERSION_MAX_ALLOWED __XROS_1_0 + #define __VISION_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ + // Hardcoded these since until compiler fix for rdar://116062344 will land + #if defined(__VISIONOS_2_0) + #define __VISION_OS_VERSION_MAX_ALLOWED __VISIONOS_2_0 + #elif defined(__VISIONOS_1_1) + #define __VISION_OS_VERSION_MAX_ALLOWED __VISIONOS_1_1 + #elif defined(__VISIONOS_1_0) + #define __VISION_OS_VERSION_MAX_ALLOWED __VISIONOS_1_0 + #endif /* for compatibility with existing code. New code should use platform specific checks */ - #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_17_0 + #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_17_1 #endif - #endif /* __has_builtin(__is_target_os) && __is_target_os(xros) */ -#endif /* __XR_OS_VERSION_MIN_REQUIRED */ + #endif /* __has_builtin(__is_target_os) && __is_target_os(visionos) */ +#endif /* __VISION_OS_VERSION_MIN_REQUIRED */ +#ifndef __OPEN_SOURCE__ + +#endif /* __OPEN_SOURCE__ */ #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED /* make sure a default max version is set */ @@ -150,43 +171,42 @@ #define __AVAILABILITY_INTERNAL_WEAK_IMPORT __attribute__((weak_import)) #define __AVAILABILITY_INTERNAL_REGULAR -#include - #if defined(__has_feature) && defined(__has_attribute) #if __has_attribute(availability) #define __API_AVAILABLE_PLATFORM_macos(x) macos,introduced=x - #define __API_UNAVAILABLE_PLATFORM_macos macos,unavailable #define __API_DEPRECATED_PLATFORM_macos(x,y) macos,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_macos macos,unavailable #define __API_AVAILABLE_PLATFORM_macosx(x) macos,introduced=x - #define __API_UNAVAILABLE_PLATFORM_macosx macos,unavailable #define __API_DEPRECATED_PLATFORM_macosx(x,y) macos,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_macosx macos,unavailable #define __API_AVAILABLE_PLATFORM_ios(x) ios,introduced=x - #define __API_UNAVAILABLE_PLATFORM_ios ios,unavailable #define __API_DEPRECATED_PLATFORM_ios(x,y) ios,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_ios ios,unavailable #define __API_AVAILABLE_PLATFORM_macCatalyst(x) macCatalyst,introduced=x - #define __API_UNAVAILABLE_PLATFORM_macCatalyst macCatalyst,unavailable #define __API_DEPRECATED_PLATFORM_macCatalyst(x,y) macCatalyst,introduced=x,deprecated=y - #define __API_AVAILABLE_PLATFORM_macCatalyst(x) macCatalyst,introduced=x #define __API_UNAVAILABLE_PLATFORM_macCatalyst macCatalyst,unavailable + #define __API_AVAILABLE_PLATFORM_macCatalyst(x) macCatalyst,introduced=x #define __API_DEPRECATED_PLATFORM_macCatalyst(x,y) macCatalyst,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_macCatalyst macCatalyst,unavailable #define __API_AVAILABLE_PLATFORM_watchos(x) watchos,introduced=x - #define __API_UNAVAILABLE_PLATFORM_watchos watchos,unavailable #define __API_DEPRECATED_PLATFORM_watchos(x,y) watchos,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_watchos watchos,unavailable #define __API_AVAILABLE_PLATFORM_tvos(x) tvos,introduced=x - #define __API_UNAVAILABLE_PLATFORM_tvos tvos,unavailable #define __API_DEPRECATED_PLATFORM_tvos(x,y) tvos,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_tvos tvos,unavailable #define __API_AVAILABLE_PLATFORM_driverkit(x) driverkit,introduced=x - #define __API_UNAVAILABLE_PLATFORM_driverkit driverkit,unavailable #define __API_DEPRECATED_PLATFORM_driverkit(x,y) driverkit,introduced=x,deprecated=y - #define __API_AVAILABLE_PLATFORM_xros(x) xros,introduced=x - #define __API_UNAVAILABLE_PLATFORM_xros xros,unavailable - #define __API_DEPRECATED_PLATFORM_xros(x,y) xros,introduced=x,deprecated=y - #define __API_AVAILABLE_PLATFORM_visionos(x) xros,introduced=x - #define __API_UNAVAILABLE_PLATFORM_visionos xros,unavailable - #define __API_DEPRECATED_PLATFORM_visionos(x,y) xros,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_driverkit driverkit,unavailable + #define __API_AVAILABLE_PLATFORM_visionos(x) visionos,introduced=x + #define __API_DEPRECATED_PLATFORM_visionos(x,y) visionos,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_visionos visionos,unavailable + #define __API_AVAILABLE_PLATFORM_xros(x) visionos,introduced=x + #define __API_DEPRECATED_PLATFORM_xros(x,y) visionos,introduced=x,deprecated=y + #define __API_UNAVAILABLE_PLATFORM_xros visionos,unavailable + #endif /* __has_attribute(availability) */ #endif /* defined(__has_feature) && defined(__has_attribute) */ @@ -218,7 +238,8 @@ #define __API_AVAILABLE5(arg0,arg1,arg2,arg3,arg4,arg5) __API_A(arg0) __API_A(arg1) __API_A(arg2) __API_A(arg3) __API_A(arg4) __API_A(arg5) #define __API_AVAILABLE6(arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_A(arg0) __API_A(arg1) __API_A(arg2) __API_A(arg3) __API_A(arg4) __API_A(arg5) __API_A(arg6) #define __API_AVAILABLE7(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_A(arg0) __API_A(arg1) __API_A(arg2) __API_A(arg3) __API_A(arg4) __API_A(arg5) __API_A(arg6) __API_A(arg7) - #define __API_AVAILABLE_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_AVAILABLE8(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_A(arg0) __API_A(arg1) __API_A(arg2) __API_A(arg3) __API_A(arg4) __API_A(arg5) __API_A(arg6) __API_A(arg7) __API_A(arg8) + #define __API_AVAILABLE_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME #define __API_A_BEGIN(x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_AVAILABLE_PLATFORM_##x))), apply_to = __API_APPLY_TO))) @@ -230,7 +251,8 @@ #define __API_AVAILABLE_BEGIN5(arg0,arg1,arg2,arg3,arg4,arg5) __API_A_BEGIN(arg0) __API_A_BEGIN(arg1) __API_A_BEGIN(arg2) __API_A_BEGIN(arg3) __API_A_BEGIN(arg4) __API_A_BEGIN(arg5) #define __API_AVAILABLE_BEGIN6(arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_A_BEGIN(arg0) __API_A_BEGIN(arg1) __API_A_BEGIN(arg2) __API_A_BEGIN(arg3) __API_A_BEGIN(arg4) __API_A_BEGIN(arg5) __API_A_BEGIN(arg6) #define __API_AVAILABLE_BEGIN7(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_A_BEGIN(arg0) __API_A_BEGIN(arg1) __API_A_BEGIN(arg2) __API_A_BEGIN(arg3) __API_A_BEGIN(arg4) __API_A_BEGIN(arg5) __API_A_BEGIN(arg6) __API_A_BEGIN(arg7) - #define __API_AVAILABLE_BEGIN_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_AVAILABLE_BEGIN8(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_A_BEGIN(arg0) __API_A_BEGIN(arg1) __API_A_BEGIN(arg2) __API_A_BEGIN(arg3) __API_A_BEGIN(arg4) __API_A_BEGIN(arg5) __API_A_BEGIN(arg6) __API_A_BEGIN(arg7) __API_A_BEGIN(arg8) + #define __API_AVAILABLE_BEGIN_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME @@ -244,7 +266,8 @@ #define __API_DEPRECATED_MSG5(msg,arg0,arg1,arg2,arg3,arg4,arg5) __API_D(msg,arg0) __API_D(msg,arg1) __API_D(msg,arg2) __API_D(msg,arg3) __API_D(msg,arg4) __API_D(msg,arg5) #define __API_DEPRECATED_MSG6(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_D(msg,arg0) __API_D(msg,arg1) __API_D(msg,arg2) __API_D(msg,arg3) __API_D(msg,arg4) __API_D(msg,arg5) __API_D(msg,arg6) #define __API_DEPRECATED_MSG7(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_D(msg,arg0) __API_D(msg,arg1) __API_D(msg,arg2) __API_D(msg,arg3) __API_D(msg,arg4) __API_D(msg,arg5) __API_D(msg,arg6) __API_D(msg,arg7) - #define __API_DEPRECATED_MSG_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_MSG8(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_D(msg,arg0) __API_D(msg,arg1) __API_D(msg,arg2) __API_D(msg,arg3) __API_D(msg,arg4) __API_D(msg,arg5) __API_D(msg,arg6) __API_D(msg,arg7) __API_D(msg,arg8) + #define __API_DEPRECATED_MSG_GET_MACRO(_0,_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))) @@ -256,7 +279,8 @@ #define __API_DEPRECATED_BEGIN5(msg,arg0,arg1,arg2,arg3,arg4,arg5) __API_D_BEGIN(msg,arg0) __API_D_BEGIN(msg,arg1) __API_D_BEGIN(msg,arg2) __API_D_BEGIN(msg,arg3) __API_D_BEGIN(msg,arg4) __API_D_BEGIN(msg,arg5) #define __API_DEPRECATED_BEGIN6(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_D_BEGIN(msg,arg0) __API_D_BEGIN(msg,arg1) __API_D_BEGIN(msg,arg2) __API_D_BEGIN(msg,arg3) __API_D_BEGIN(msg,arg4) __API_D_BEGIN(msg,arg5) __API_D_BEGIN(msg,arg6) #define __API_DEPRECATED_BEGIN7(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_D_BEGIN(msg,arg0) __API_D_BEGIN(msg,arg1) __API_D_BEGIN(msg,arg2) __API_D_BEGIN(msg,arg3) __API_D_BEGIN(msg,arg4) __API_D_BEGIN(msg,arg5) __API_D_BEGIN(msg,arg6) __API_D_BEGIN(msg,arg7) - #define __API_DEPRECATED_BEGIN_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_BEGIN8(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_D_BEGIN(msg,arg0) __API_D_BEGIN(msg,arg1) __API_D_BEGIN(msg,arg2) __API_D_BEGIN(msg,arg3) __API_D_BEGIN(msg,arg4) __API_D_BEGIN(msg,arg5) __API_D_BEGIN(msg,arg6) __API_D_BEGIN(msg,arg7) __API_D_BEGIN(msg,arg8) + #define __API_DEPRECATED_BEGIN_GET_MACRO(_0,_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))) @@ -272,7 +296,8 @@ #define __API_DEPRECATED_REP5(msg,arg0,arg1,arg2,arg3,arg4,arg5) __API_R(msg,arg0) __API_R(msg,arg1) __API_R(msg,arg2) __API_R(msg,arg3) __API_R(msg,arg4) __API_R(msg,arg5) #define __API_DEPRECATED_REP6(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_R(msg,arg0) __API_R(msg,arg1) __API_R(msg,arg2) __API_R(msg,arg3) __API_R(msg,arg4) __API_R(msg,arg5) __API_R(msg,arg6) #define __API_DEPRECATED_REP7(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_R(msg,arg0) __API_R(msg,arg1) __API_R(msg,arg2) __API_R(msg,arg3) __API_R(msg,arg4) __API_R(msg,arg5) __API_R(msg,arg6) __API_R(msg,arg7) - #define __API_DEPRECATED_REP_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_REP8(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_R(msg,arg0) __API_R(msg,arg1) __API_R(msg,arg2) __API_R(msg,arg3) __API_R(msg,arg4) __API_R(msg,arg5) __API_R(msg,arg6) __API_R(msg,arg7) __API_R(msg,arg8) + #define __API_DEPRECATED_REP_GET_MACRO(_0,_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))) @@ -280,15 +305,16 @@ #define __API_R_BEGIN(rep,x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_DEPRECATED_PLATFORM_##x))), apply_to = __API_APPLY_TO))) #endif - #define __API_DEPRECATED_BEGIN_REP0(msg,arg0) __API_R_BEGIN(msg,arg0) - #define __API_DEPRECATED_BEGIN_REP1(msg,arg0,arg1) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) - #define __API_DEPRECATED_BEGIN_REP2(msg,arg0,arg1,arg2) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) - #define __API_DEPRECATED_BEGIN_REP3(msg,arg0,arg1,arg2,arg3) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) - #define __API_DEPRECATED_BEGIN_REP4(msg,arg0,arg1,arg2,arg3,arg4) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) - #define __API_DEPRECATED_BEGIN_REP5(msg,arg0,arg1,arg2,arg3,arg4,arg5) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) __API_R_BEGIN(msg,arg5) - #define __API_DEPRECATED_BEGIN_REP6(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) __API_R_BEGIN(msg,arg5) __API_R_BEGIN(msg,arg6) - #define __API_DEPRECATED_BEGIN_REP7(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) __API_R_BEGIN(msg,arg5) __API_R_BEGIN(msg,arg6) __API_R_BEGIN(msg,arg7) - #define __API_DEPRECATED_BEGIN_REP_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN0(msg,arg0) __API_R_BEGIN(msg,arg0) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN1(msg,arg0,arg1) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN2(msg,arg0,arg1,arg2) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN3(msg,arg0,arg1,arg2,arg3) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN4(msg,arg0,arg1,arg2,arg3,arg4) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN5(msg,arg0,arg1,arg2,arg3,arg4,arg5) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) __API_R_BEGIN(msg,arg5) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN6(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) __API_R_BEGIN(msg,arg5) __API_R_BEGIN(msg,arg6) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN7(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) __API_R_BEGIN(msg,arg5) __API_R_BEGIN(msg,arg6) __API_R_BEGIN(msg,arg7) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN8(msg,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_R_BEGIN(msg,arg0) __API_R_BEGIN(msg,arg1) __API_R_BEGIN(msg,arg2) __API_R_BEGIN(msg,arg3) __API_R_BEGIN(msg,arg4) __API_R_BEGIN(msg,arg5) __API_R_BEGIN(msg,arg6) __API_R_BEGIN(msg,arg7) __API_R_BEGIN(msg,arg8) + #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME /* * API Unavailability @@ -309,7 +335,8 @@ #define __API_UNAVAILABLE5(arg0,arg1,arg2,arg3,arg4,arg5) __API_U(arg0) __API_U(arg1) __API_U(arg2) __API_U(arg3) __API_U(arg4) __API_U(arg5) #define __API_UNAVAILABLE6(arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_U(arg0) __API_U(arg1) __API_U(arg2) __API_U(arg3) __API_U(arg4) __API_U(arg5) __API_U(arg6) #define __API_UNAVAILABLE7(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_U(arg0) __API_U(arg1) __API_U(arg2) __API_U(arg3) __API_U(arg4) __API_U(arg5) __API_U(arg6) __API_U(arg7) - #define __API_UNAVAILABLE_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_UNAVAILABLE8(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_U(arg0) __API_U(arg1) __API_U(arg2) __API_U(arg3) __API_U(arg4) __API_U(arg5) __API_U(arg6) __API_U(arg7) __API_U(arg8) + #define __API_UNAVAILABLE_GET_MACRO(_0,_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))) @@ -321,7 +348,8 @@ #define __API_UNAVAILABLE_BEGIN5(arg0,arg1,arg2,arg3,arg4,arg5) __API_U_BEGIN(arg0) __API_U_BEGIN(arg1) __API_U_BEGIN(arg2) __API_U_BEGIN(arg3) __API_U_BEGIN(arg4) __API_U_BEGIN(arg5) #define __API_UNAVAILABLE_BEGIN6(arg0,arg1,arg2,arg3,arg4,arg5,arg6) __API_U_BEGIN(arg0) __API_U_BEGIN(arg1) __API_U_BEGIN(arg2) __API_U_BEGIN(arg3) __API_U_BEGIN(arg4) __API_U_BEGIN(arg5) __API_U_BEGIN(arg6) #define __API_UNAVAILABLE_BEGIN7(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7) __API_U_BEGIN(arg0) __API_U_BEGIN(arg1) __API_U_BEGIN(arg2) __API_U_BEGIN(arg3) __API_U_BEGIN(arg4) __API_U_BEGIN(arg5) __API_U_BEGIN(arg6) __API_U_BEGIN(arg7) - #define __API_UNAVAILABLE_BEGIN_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME + #define __API_UNAVAILABLE_BEGIN8(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) __API_U_BEGIN(arg0) __API_U_BEGIN(arg1) __API_U_BEGIN(arg2) __API_U_BEGIN(arg3) __API_U_BEGIN(arg4) __API_U_BEGIN(arg5) __API_U_BEGIN(arg6) __API_U_BEGIN(arg7) __API_U_BEGIN(arg8) + #define __API_UNAVAILABLE_BEGIN_GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME #endif /* __has_attribute(availability) */ #endif /* #if defined(__has_feature) && defined(__has_attribute) */ @@ -346,12 +374,4 @@ #define __swift_compiler_version_at_least(...) 1 #endif -/* - * If __SPI_AVAILABLE has not been defined elsewhere, disable it. - */ - -#ifndef __SPI_AVAILABLE - #define __SPI_AVAILABLE(...) -#endif - #endif /* __AVAILABILITY_INTERNAL__ */ diff --git a/lib/libc/include/any-macos-any/AvailabilityInternalLegacy.h b/lib/libc/include/any-macos-any/AvailabilityInternalLegacy.h index 8ac4cc8c42ee..9226c576293b 100644 --- a/lib/libc/include/any-macos-any/AvailabilityInternalLegacy.h +++ b/lib/libc/include/any-macos-any/AvailabilityInternalLegacy.h @@ -31,6 +31,8 @@ #ifndef __AVAILABILITY_INTERNAL_LEGACY__ #define __AVAILABILITY_INTERNAL_LEGACY__ +#include + #if defined(__has_builtin) #if __has_builtin(__is_target_arch) #if __has_builtin(__is_target_vendor) diff --git a/lib/libc/include/any-macos-any/AvailabilityVersions.h b/lib/libc/include/any-macos-any/AvailabilityVersions.h index 5a6d41968f3c..8f8e7a9fd723 100644 --- a/lib/libc/include/any-macos-any/AvailabilityVersions.h +++ b/lib/libc/include/any-macos-any/AvailabilityVersions.h @@ -70,13 +70,24 @@ #define __MAC_12_3 120300 #define __MAC_12_4 120400 #define __MAC_12_5 120500 +#define __MAC_12_6 120600 +#define __MAC_12_7 120700 #define __MAC_13_0 130000 #define __MAC_13_1 130100 #define __MAC_13_1 130100 #define __MAC_13_2 130200 #define __MAC_13_3 130300 #define __MAC_13_4 130400 +#define __MAC_13_5 130500 +#define __MAC_13_6 130600 #define __MAC_14_0 140000 +#define __MAC_14_1 140100 +#define __MAC_14_2 140200 +#define __MAC_14_3 140300 +#define __MAC_14_4 140400 +#define __MAC_14_5 140500 +#define __MAC_15_0 150000 +#define __MAC_15_1 150100 /* __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 @@ -143,13 +154,24 @@ #define __IPHONE_15_4 150400 #define __IPHONE_15_5 150500 #define __IPHONE_15_6 150600 +#define __IPHONE_15_7 150700 +#define __IPHONE_15_8 150800 #define __IPHONE_16_0 160000 #define __IPHONE_16_1 160100 #define __IPHONE_16_2 160200 #define __IPHONE_16_3 160300 #define __IPHONE_16_4 160400 #define __IPHONE_16_5 160500 +#define __IPHONE_16_6 160600 +#define __IPHONE_16_7 160700 #define __IPHONE_17_0 170000 +#define __IPHONE_17_1 170100 +#define __IPHONE_17_2 170200 +#define __IPHONE_17_3 170300 +#define __IPHONE_17_4 170400 +#define __IPHONE_17_5 170500 +#define __IPHONE_18_0 180000 +#define __IPHONE_18_1 180100 /* __IPHONE__NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ #define __WATCHOS_1_0 10000 @@ -185,13 +207,22 @@ #define __WATCHOS_8_5 80500 #define __WATCHOS_8_6 80600 #define __WATCHOS_8_7 80700 +#define __WATCHOS_8_8 80800 #define __WATCHOS_9_0 90000 #define __WATCHOS_9_1 90100 #define __WATCHOS_9_2 90200 #define __WATCHOS_9_3 90300 #define __WATCHOS_9_4 90400 #define __WATCHOS_9_5 90500 +#define __WATCHOS_9_6 90600 #define __WATCHOS_10_0 100000 +#define __WATCHOS_10_1 100100 +#define __WATCHOS_10_2 100200 +#define __WATCHOS_10_3 100300 +#define __WATCHOS_10_4 100400 +#define __WATCHOS_10_5 100500 +#define __WATCHOS_11_0 110000 +#define __WATCHOS_11_1 110100 /* __WATCHOS__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 @@ -235,7 +266,15 @@ #define __TVOS_16_3 160300 #define __TVOS_16_4 160400 #define __TVOS_16_5 160500 +#define __TVOS_16_6 160600 #define __TVOS_17_0 170000 +#define __TVOS_17_1 170100 +#define __TVOS_17_2 170200 +#define __TVOS_17_3 170300 +#define __TVOS_17_4 170400 +#define __TVOS_17_5 170500 +#define __TVOS_18_0 180000 +#define __TVOS_18_1 180100 /* __TVOS__NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ #define __BRIDGEOS_2_0 20000 @@ -258,7 +297,15 @@ #define __BRIDGEOS_7_2 70200 #define __BRIDGEOS_7_3 70300 #define __BRIDGEOS_7_4 70400 +#define __BRIDGEOS_7_6 70600 #define __BRIDGEOS_8_0 80000 +#define __BRIDGEOS_8_1 80100 +#define __BRIDGEOS_8_2 80200 +#define __BRIDGEOS_8_3 80300 +#define __BRIDGEOS_8_4 80400 +#define __BRIDGEOS_8_5 80500 +#define __BRIDGEOS_9_0 90000 +#define __BRIDGEOS_9_1 90100 #define __DRIVERKIT_19_0 190000 @@ -267,13 +314,31 @@ #define __DRIVERKIT_22_0 220000 #define __DRIVERKIT_22_4 220400 #define __DRIVERKIT_22_5 220500 +#define __DRIVERKIT_22_6 220600 #define __DRIVERKIT_23_0 230000 +#define __DRIVERKIT_23_1 230100 +#define __DRIVERKIT_23_2 230200 +#define __DRIVERKIT_23_3 230300 +#define __DRIVERKIT_23_4 230400 +#define __DRIVERKIT_23_5 230500 +#define __DRIVERKIT_24_0 240000 +#define __DRIVERKIT_24_1 240100 /* __DRIVERKIT__NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ -#define __XROS_1_0 10000 -/* __XROS__NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ +#define __VISIONOS_1_0 10000 +#define __VISIONOS_1_1 10100 +#define __VISIONOS_1_2 10200 +#define __VISIONOS_2_0 20000 +#define __VISIONOS_2_1 20100 +/* __VISIONOS__NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */ + + +#ifndef __OPEN_SOURCE__ + +#endif /* __OPEN_SOURCE__ */ + /* * Set up standard Mac OS X versions */ @@ -326,13 +391,24 @@ #define MAC_OS_VERSION_12_3 __MAC_12_3 #define MAC_OS_VERSION_12_4 __MAC_12_4 #define MAC_OS_VERSION_12_5 __MAC_12_5 +#define MAC_OS_VERSION_12_6 __MAC_12_6 +#define MAC_OS_VERSION_12_7 __MAC_12_7 #define MAC_OS_VERSION_13_0 __MAC_13_0 #define MAC_OS_VERSION_13_1 __MAC_13_1 #define MAC_OS_VERSION_13_1 __MAC_13_1 #define MAC_OS_VERSION_13_2 __MAC_13_2 #define MAC_OS_VERSION_13_3 __MAC_13_3 #define MAC_OS_VERSION_13_4 __MAC_13_4 +#define MAC_OS_VERSION_13_5 __MAC_13_5 +#define MAC_OS_VERSION_13_6 __MAC_13_6 #define MAC_OS_VERSION_14_0 __MAC_14_0 +#define MAC_OS_VERSION_14_1 __MAC_14_1 +#define MAC_OS_VERSION_14_2 __MAC_14_2 +#define MAC_OS_VERSION_14_3 __MAC_14_3 +#define MAC_OS_VERSION_14_4 __MAC_14_4 +#define MAC_OS_VERSION_14_5 __MAC_14_5 +#define MAC_OS_VERSION_15_0 __MAC_15_0 +#define MAC_OS_VERSION_15_1 __MAC_15_1 #endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */ diff --git a/lib/libc/include/any-macos-any/MacTypes.h b/lib/libc/include/any-macos-any/MacTypes.h index 135fad0fd28e..a23f92598f0c 100644 --- a/lib/libc/include/any-macos-any/MacTypes.h +++ b/lib/libc/include/any-macos-any/MacTypes.h @@ -37,10 +37,12 @@ #ifndef __MACTYPES__ #define __MACTYPES__ -#ifndef __CONDITIONALMACROS__ +#if __has_include() #include #endif +#include + #include #include @@ -153,7 +155,7 @@ typedef struct UnsignedWide UnsignedWide; #endif -#if TYPE_LONGLONG +#if TYPE_LONGLONG || 0 /* Note: wide and UnsignedWide must always be structs for source code compatibility. On the other hand UInt64 and SInt64 can be @@ -178,7 +180,7 @@ typedef struct UnsignedWide UnsignedWide; typedef wide SInt64; typedef UnsignedWide UInt64; -#endif /* TYPE_LONGLONG */ +#endif /******************************************************************************** @@ -307,6 +309,8 @@ typedef ResType * ResTypePtr; *********************************************************************************/ typedef unsigned char Boolean; + +#if !0 /******************************************************************************** Function Pointer Types @@ -330,6 +334,8 @@ typedef ProcPtr UniversalProcPtr; typedef ProcPtr * ProcHandle; typedef UniversalProcPtr * UniversalProcHandle; +#endif + /******************************************************************************** RefCon Types @@ -691,6 +697,8 @@ typedef UnsignedWide * UnsignedWidePtr; typedef Float80 extended80; typedef Float96 extended96; typedef SInt8 VHSelect; + +#if !0 /********************************************************************************* Debugger functions @@ -718,7 +726,7 @@ Debugger(void) __OSX_AVAILABLE_BU */ extern void DebugStr(ConstStr255Param debuggerMsg) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA); - +#endif /* * debugstr() diff --git a/lib/libc/include/any-macos-any/TargetConditionals.h b/lib/libc/include/any-macos-any/TargetConditionals.h index 59cb4faf373c..7b661b05055e 100644 --- a/lib/libc/include/any-macos-any/TargetConditionals.h +++ b/lib/libc/include/any-macos-any/TargetConditionals.h @@ -51,49 +51,56 @@ * 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. + * The IOS/TV/WATCH/VISION conditionals are mutually exclusive. * + * TARGET_OS_WIN32 - Generated code will run on WIN32 API + * TARGET_OS_WINDOWS - Generated code will run on Windows + * TARGET_OS_UNIX - Generated code will run on some Unix (not macOS) + * TARGET_OS_LINUX - Generated code will run on Linux + * TARGET_OS_MAC - Generated code will run on a variant of macOS + * TARGET_OS_OSX - Generated code will run on macOS + * TARGET_OS_IPHONE - Generated code will run on a variant of iOS (firmware, devices, simulator) + * TARGET_OS_IOS - Generated code will run on iOS + * TARGET_OS_MACCATALYST - Generated code will run on macOS + * TARGET_OS_TV - Generated code will run on tvOS + * TARGET_OS_WATCH - Generated code will run on watchOS + * TARGET_OS_VISION - Generated code will run on visionOS + * TARGET_OS_BRIDGE - Generated code will run on bridge devices + * TARGET_OS_SIMULATOR - Generated code will run on an iOS, tvOS, watchOS, or visionOS simulator + * TARGET_OS_DRIVERKIT - Generated code will run on macOS, iOS, tvOS, watchOS, or visionOS * - * TARGET_OS_WIN32 - Generated code will run under WIN32 API - * TARGET_OS_WINDOWS - Generated code will run under Windows - * TARGET_OS_UNIX - Generated code will run under some Unix (not OSX) - * TARGET_OS_LINUX - Generated code will run under Linux - * 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_DRIVERKIT - Generated code will run under macOS, iOS, Apple TV OS, or Apple Watch OS - * 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_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 | | | | - * | | | | +-----------------+ +----+ +-------+ +--------+ | | | | - * | | | | | IOS | | | | | | | | | | | - * | | OSX | | | +-------------+ | | TV | | WATCH | | BRIDGE | | | DRIVERKIT | | - * | | | | | | MACCATALYST | | | | | | | | | | | | - * | | | | | +-------------+ | | | | | | | | | | | - * | | | | +-----------------+ +----+ +-------+ +--------+ | | | | - * | +-----+ +-------------------------------------------------+ +-----------+ | - * +---------------------------------------------------------------------------+ + * +--------------------------------------------------------------------------------------+ + * | TARGET_OS_MAC | + * | +-----+ +------------------------------------------------------------+ +-----------+ | + * | | | | TARGET_OS_IPHONE | | | | + * | | | | +-----------------+ +----+ +-------+ +--------+ +--------+ | | | | + * | | | | | IOS | | | | | | | | | | | | | + * | | OSX | | | +-------------+ | | TV | | WATCH | | BRIDGE | | VISION | | | DRIVERKIT | | + * | | | | | | 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). @@ -105,7 +112,7 @@ * 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 @@ -130,6 +137,7 @@ * It is disabled by default. */ +#if !defined(__has_extension) || !__has_extension(define_target_os_macros) #if defined(__has_builtin) #if __has_builtin(__is_target_arch) #if __has_builtin(__is_target_vendor) @@ -141,26 +149,15 @@ /* "-target=arm64e-apple-ios12-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 TARGET_OS_MAC 1 - #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 - - #define TARGET_OS_VISION 0 - - #ifndef TARGET_OS_UIKITFORMAC #define TARGET_OS_UIKITFORMAC 1 #endif - #define TARGET_OS_DRIVERKIT 0 - #define DYNAMIC_TARGETS_ENABLED 1 + #define TARGET_OS_UNIX 0 + #define DYNAMIC_TARGETS_ENABLED 1 #endif /* "-target=x86_64-apple-ios12-simulator" */ @@ -168,131 +165,42 @@ /* "-target=arm64e-apple-ios12-simulator" */ #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(simulator) #define TARGET_OS_MAC 1 - #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 - - #define TARGET_OS_VISION 0 - - - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif - #define TARGET_OS_DRIVERKIT 0 + #define TARGET_OS_UNIX 0 #define DYNAMIC_TARGETS_ENABLED 1 #endif - /* "-target=arm64e-apple-xros1.0" */ - #if (__is_target_arch(arm64e) || __is_target_arch(arm64)) && __is_target_vendor(apple) && __is_target_os(xros) + /* "-target=arm64e-apple-xros1.0[-simulator]" */ + #if __is_target_vendor(apple) && __is_target_os(xros) #define TARGET_OS_MAC 1 - #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 1 - #define TARGET_OS_RTKIT 0 - #define TARGET_OS_MACCATALYST 0 - #define TARGET_OS_MACCATALYST 0 - #define TARGET_OS_VISION 1 - - - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 + #if __is_target_environment(simulator) + #define TARGET_OS_SIMULATOR 1 + #else + #define TARGET_OS_EMBEDDED 1 #endif - #define TARGET_OS_DRIVERKIT 0 - #define DYNAMIC_TARGETS_ENABLED 1 - #endif - - /* "-target=arm64e-apple-xros1.0-simulator" */ - #if (__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(xros) && __is_target_environment(simulator) - #define TARGET_OS_MAC 1 - #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 - #define TARGET_OS_VISION 1 - - - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif - #define TARGET_OS_DRIVERKIT 0 + #define TARGET_OS_UNIX 0 #define DYNAMIC_TARGETS_ENABLED 1 #endif - - //FIXME: Workaround for rdar://100536146 - #if (__is_target_vendor(apple) && defined(__APPLE_EXCLAVECORE__) && __APPLE_EXCLAVECORE__) - #define TARGET_OS_MAC 0 - #define TARGET_OS_OSX 0 - #define TARGET_OS_IPHONE 0 - #define TARGET_OS_IOS 0 - #define TARGET_OS_WATCH 0 + #if (__is_target_vendor(apple) && __is_target_environment(exclavecore)) - #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 - - #define TARGET_OS_VISION 0 - - - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif - #define TARGET_OS_DRIVERKIT 0 + #define TARGET_OS_UNIX 0 #define DYNAMIC_TARGETS_ENABLED 1 #endif - - //FIXME: Workaround for rdar://100536146 - #if (__is_target_vendor(apple) && defined(__APPLE_EXCLAVEKIT__) && __APPLE_EXCLAVEKIT__) + #if (__is_target_vendor(apple) && __is_target_environment(exclavekit)) #define TARGET_OS_MAC 1 - #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 - - #define TARGET_OS_VISION 0 - - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif - #define TARGET_OS_DRIVERKIT 0 + #define TARGET_OS_UNIX 0 #define DYNAMIC_TARGETS_ENABLED 1 #endif @@ -301,25 +209,8 @@ /* "-target=arm64e-apple-driverkit19.0" */ #if __is_target_vendor(apple) && __is_target_os(driverkit) #define TARGET_OS_MAC 1 - #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 - - #define TARGET_OS_VISION 0 - - - #ifndef TARGET_OS_UIKITFORMAC - #define TARGET_OS_UIKITFORMAC 0 - #endif #define TARGET_OS_DRIVERKIT 1 + #define TARGET_OS_UNIX 0 #define DYNAMIC_TARGETS_ENABLED 1 #endif @@ -329,186 +220,83 @@ #endif /* #if __has_builtin(__is_target_arch) */ #endif /* #if defined(__has_builtin) */ - #ifndef DYNAMIC_TARGETS_ENABLED - #define DYNAMIC_TARGETS_ENABLED 0 + #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_WIN32 0 - #define TARGET_OS_WINDOWS 0 - #define TARGET_OS_UNIX 0 - #define TARGET_OS_LINUX 0 - #if !DYNAMIC_TARGETS_ENABLED #define TARGET_OS_MAC 1 #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 - - - - #define TARGET_OS_VISION 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 + #define TARGET_OS_UNIX 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_CPU_X86_64 || (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 +/* + * CodeWarrior compiler from Metrowerks/Motorola + */ +#elif defined(__MWERKS__) + #define TARGET_OS_MAC 1 + +/* + * unknown compiler + */ +#else + #define TARGET_OS_MAC 1 +#endif +#endif /* !defined(__has_extension) || !__has_extension(define_target_os_macros) */ + +// This has to always be defined in the header due to limitations in define_target_os_macros +#define TARGET_OS_RTKIT 0 + +/* + * gcc based compiler used on Mac OS X + */ +#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) ) + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 + #else + #define TARGET_RT_LITTLE_ENDIAN 0 + #define TARGET_RT_BIG_ENDIAN 1 + #endif + #if __LP64__ #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 + #else #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 + #endif + #if defined(__ppc__) && __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 - #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_WINDOWS 0 - #define TARGET_OS_UNIX 0 - #define TARGET_OS_LINUX 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 @@ -527,98 +315,6 @@ * 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_WINDOWS 0 - #define TARGET_OS_UNIX 0 - #define TARGET_OS_LINUX 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 @@ -638,7 +334,201 @@ #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_CFM 1 #endif - #endif +/* + * __is_target_arch based defines + */ +#if defined(__has_builtin) && __has_builtin(__is_target_arch) + #if __is_target_arch(arm64) || __is_target_arch(arm64e) || __is_target_arch(arm64_32) + #define TARGET_CPU_ARM64 1 + #elif __is_target_arch(arm) + #define TARGET_CPU_ARM 1 + #elif __is_target_arch(x86_64) + #define TARGET_CPU_X86_64 1 + #elif __is_target_arch(i386) + #define TARGET_CPU_X86 1 + #else + + #error unrecognized arch using compiler with __is_target_arch support + + #endif + +/* + * GCC and older clang fallback + */ +#elif defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) ) + #if defined(__ppc__) + #define TARGET_CPU_PPC 1 + #elif defined(__ppc64__) + #define TARGET_CPU_PPC64 1 + #elif defined(__i386__) + #define TARGET_CPU_X86 1 + #elif defined(__x86_64__) + #define TARGET_CPU_X86_64 1 + #elif defined(__arm__) + #define TARGET_CPU_ARM 1 + #elif defined(__arm64__) + #define TARGET_CPU_ARM64 1 + #else + #error unrecognized GNU C compiler + #endif + +/* + * CodeWarrior compiler from Metrowerks/Motorola + */ +#elif defined(__MWERKS__) + #if defined(__POWERPC__) + #define TARGET_CPU_PPC 1 + #elif defined(__INTEL__) + #define TARGET_CPU_X86 1 + #else + #error unknown Metrowerks CPU type + #endif + +/* + * unknown compiler + */ +#else + #if !defined(TARGET_CPU_PPC) && !defined(TARGET_CPU_PPC64) \ + && !defined(TARGET_CPU_X86) && !defined(TARGET_CPU_X86_64) \ + && !defined(TARGET_CPU_ARM) && !defined(TARGET_CPU_ARM64) + /* + 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 suppport for __is_target_arch and __is_target_os + to your compiler. + */ + #error TargetConditionals.h: unknown compiler (see comment above) + #endif +#endif + + + +// Make sure all TARGET_OS_* and TARGET_CPU_* values are defined +#ifndef TARGET_OS_MAC + #define TARGET_OS_MAC 0 +#endif + +#ifndef TARGET_OS_OSX + #define TARGET_OS_OSX 0 +#endif + +#ifndef TARGET_OS_IPHONE + #define TARGET_OS_IPHONE 0 +#endif + +#ifndef TARGET_OS_IOS + #define TARGET_OS_IOS 0 +#endif + +#ifndef TARGET_OS_WATCH + #define TARGET_OS_WATCH 0 +#endif + +#ifndef TARGET_OS_TV + #define TARGET_OS_TV 0 +#endif + +#ifndef TARGET_OS_SIMULATOR + #define TARGET_OS_SIMULATOR 0 +#endif + +#ifndef TARGET_OS_EMBEDDED + #define TARGET_OS_EMBEDDED 0 +#endif + +#ifndef TARGET_OS_RTKIT + #define TARGET_OS_RTKIT 0 +#endif + +#ifndef TARGET_OS_MACCATALYST + #define TARGET_OS_MACCATALYST 0 +#endif + +#ifndef TARGET_OS_VISION + #define TARGET_OS_VISION 0 +#endif + +#ifndef TARGET_OS_UIKITFORMAC + #define TARGET_OS_UIKITFORMAC 0 +#endif + +#ifndef TARGET_OS_DRIVERKIT + #define TARGET_OS_DRIVERKIT 0 +#endif + +#ifndef TARGET_OS_WIN32 + #define TARGET_OS_WIN32 0 +#endif + +#ifndef TARGET_OS_WINDOWS + #define TARGET_OS_WINDOWS 0 +#endif + + + +#ifndef TARGET_OS_LINUX + #define TARGET_OS_LINUX 0 +#endif + +#ifndef TARGET_CPU_PPC + #define TARGET_CPU_PPC 0 +#endif + +#ifndef TARGET_CPU_PPC64 + #define TARGET_CPU_PPC64 0 +#endif + +#ifndef TARGET_CPU_68K + #define TARGET_CPU_68K 0 +#endif + +#ifndef TARGET_CPU_X86 + #define TARGET_CPU_X86 0 +#endif + +#ifndef TARGET_CPU_X86_64 + #define TARGET_CPU_X86_64 0 +#endif + +#ifndef TARGET_CPU_ARM + #define TARGET_CPU_ARM 0 +#endif + +#ifndef TARGET_CPU_ARM64 + #define TARGET_CPU_ARM64 0 +#endif + +#ifndef TARGET_CPU_MIPS + #define TARGET_CPU_MIPS 0 +#endif + +#ifndef TARGET_CPU_SPARC + #define TARGET_CPU_SPARC 0 +#endif + +#ifndef TARGET_CPU_ALPHA + #define TARGET_CPU_ALPHA 0 +#endif + +#ifndef TARGET_ABI_USES_IOS_VALUES + #define TARGET_ABI_USES_IOS_VALUES (!TARGET_CPU_X86_64 || (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST)) +#endif + +#ifndef TARGET_IPHONE_SIMULATOR + #define TARGET_IPHONE_SIMULATOR TARGET_OS_SIMULATOR /* deprecated */ +#endif + +#ifndef TARGET_OS_NANO + #define TARGET_OS_NANO TARGET_OS_WATCH /* deprecated */ +#endif + + + #endif /* __TARGETCONDITIONALS__ */ diff --git a/lib/libc/include/any-macos-any/___wctype.h b/lib/libc/include/any-macos-any/___wctype.h new file mode 100644 index 000000000000..e700e8e08822 --- /dev/null +++ b/lib/libc/include/any-macos-any/___wctype.h @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2017 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)1999 Citrus Project, + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + */ + +/* + * Common header for __wctype.h and xlocale/___wctype.h + */ + +#ifndef __WCTYPE_H_ +#define __WCTYPE_H_ +#define ___WCTYPE_H_ + +#include +#include <_types.h> + +#include +#include <_types/_wctype_t.h> + +#ifndef WEOF +#define WEOF __DARWIN_WEOF +#endif + +#ifndef __DARWIN_WCTYPE_TOP_inline +#define __DARWIN_WCTYPE_TOP_inline __header_inline +#endif + +#include + +/* + * Use inline functions if we are allowed to and the compiler supports them. + */ +#if !defined(_DONT_USE_CTYPE_INLINE_) && \ + (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) + +__DARWIN_WCTYPE_TOP_inline int +iswalnum(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_A|_CTYPE_D)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswalpha(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_A)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswcntrl(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_C)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswctype(wint_t _wc, wctype_t _charclass) +{ + return (__istype(_wc, _charclass)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswdigit(wint_t _wc) +{ + return (__isctype(_wc, _CTYPE_D)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswgraph(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_G)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswlower(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_L)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswprint(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_R)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswpunct(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_P)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswspace(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_S)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswupper(wint_t _wc) +{ + return (__istype(_wc, _CTYPE_U)); +} + +__DARWIN_WCTYPE_TOP_inline int +iswxdigit(wint_t _wc) +{ + return (__isctype(_wc, _CTYPE_X)); +} + +__DARWIN_WCTYPE_TOP_inline wint_t +towlower(wint_t _wc) +{ + return (__tolower(_wc)); +} + +__DARWIN_WCTYPE_TOP_inline wint_t +towupper(wint_t _wc) +{ + return (__toupper(_wc)); +} + +#else /* not using inlines */ + +__BEGIN_DECLS +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswcntrl(wint_t); +int iswctype(wint_t, wctype_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +__END_DECLS + +#endif /* using inlines */ + +__BEGIN_DECLS +wctype_t + wctype(const char *); +__END_DECLS + +#endif /* __WCTYPE_H_ */ diff --git a/lib/libc/include/any-macos-any/__wctype.h b/lib/libc/include/any-macos-any/__wctype.h index 3b4eb2c8a7af..413a11c1eaab 100644 --- a/lib/libc/include/any-macos-any/__wctype.h +++ b/lib/libc/include/any-macos-any/__wctype.h @@ -1,25 +1,3 @@ -/* - * Copyright (c) 2017 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)1999 Citrus Project, * All rights reserved. @@ -48,27 +26,18 @@ */ /* - * Common header for _wctype.h and xlocale/__wctype.h + * Common header for _wctype.h and _wchar.h + * + * Contains everything required by wctype.h except: + * + * #include <_types/_wctrans_t.h> + * int iswblank(wint_t); + * wint_t towctrans(wint_t, wctrans_t); + * wctrans_t wctrans(const char *); */ -#ifndef ___WCTYPE_H_ -#define ___WCTYPE_H_ - -#include -#include <_types.h> - -#include -#include -#include <_types/_wctype_t.h> - -#ifndef WEOF -#define WEOF __DARWIN_WEOF -#endif - -#ifndef __DARWIN_WCTYPE_TOP_inline -#define __DARWIN_WCTYPE_TOP_inline __header_inline -#endif - -#include +#include <___wctype.h> -#endif /* ___WCTYPE_H_ */ +#ifdef _USE_EXTENDED_LOCALES_ +#include +#endif /* _USE_EXTENDED_LOCALES_ */ diff --git a/lib/libc/include/any-macos-any/__xlocale.h b/lib/libc/include/any-macos-any/__xlocale.h new file mode 100644 index 000000000000..900e714172b7 --- /dev/null +++ b/lib/libc/include/any-macos-any/__xlocale.h @@ -0,0 +1,40 @@ +/* + * 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_H_ +#define __XLOCALE_H_ + +#include +#include <_mb_cur_max.h> + +struct _xlocale; /* forward reference */ +typedef struct _xlocale * locale_t; + +__BEGIN_DECLS +int ___mb_cur_max_l(locale_t); +__END_DECLS + +#undef MB_CUR_MAX_L +#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) + +#endif /* __XLOCALE_H_ */ diff --git a/lib/libc/include/any-macos-any/_abort.h b/lib/libc/include/any-macos-any/_abort.h new file mode 100644 index 000000000000..2865ed80ebfa --- /dev/null +++ b/lib/libc/include/any-macos-any/_abort.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 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 __ABORT_H_ +#define __ABORT_H_ + +#include + +__BEGIN_DECLS +void abort(void) __cold __dead2; +__END_DECLS + +#endif /* __ABORT_H_ */ diff --git a/lib/libc/include/any-macos-any/_assert.h b/lib/libc/include/any-macos-any/_assert.h new file mode 100644 index 000000000000..96d886f87f42 --- /dev/null +++ b/lib/libc/include/any-macos-any/_assert.h @@ -0,0 +1,77 @@ +/*- + * 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 $ + */ + +#ifndef __ASSERT_H_ +#define __ASSERT_H_ + +#include + +#ifndef __GNUC__ + +#ifndef __cplusplus +#include <_abort.h> +#endif /* !__cplusplus */ +#include <_printf.h> + +#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 + +#endif /* __GNUC__ */ + +#endif /* __ASSERT_H_ */ diff --git a/lib/libc/include/any-macos-any/_ctype.h b/lib/libc/include/any-macos-any/_ctype.h index 86e8b229b4a5..cbee2fb58d7e 100644 --- a/lib/libc/include/any-macos-any/_ctype.h +++ b/lib/libc/include/any-macos-any/_ctype.h @@ -63,7 +63,8 @@ * @(#)ctype.h 8.4 (Berkeley) 1/21/94 */ -#ifndef __CTYPE_H_ +#ifndef _CTYPE_H_ +#define _CTYPE_H_ #define __CTYPE_H_ #include @@ -118,6 +119,7 @@ #define __DARWIN_CTYPE_TOP_inline __header_inline + /* * Use inline functions if we are allowed to and the compiler supports them. */ @@ -380,8 +382,4 @@ __END_DECLS #endif /* using inlines */ -#ifdef _USE_EXTENDED_LOCALES_ -#include -#endif /* _USE_EXTENDED_LOCALES_ */ - #endif /* !_CTYPE_H_ */ diff --git a/lib/libc/include/any-macos-any/_inttypes.h b/lib/libc/include/any-macos-any/_inttypes.h new file mode 100644 index 000000000000..13ca56a23b01 --- /dev/null +++ b/lib/libc/include/any-macos-any/_inttypes.h @@ -0,0 +1,293 @@ +/* + * Copyright (c) 2023 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@ + */ + +/* + * -- Standard C header, defined in ISO/IEC 9899:1999 + * (aka "C99"), section 7.8. This defines format string conversion + * specifiers suitable for use within arguments to fprintf and fscanf + * and their ilk. + */ + +#if !defined(_INTTYPES_H_) +#define _INTTYPES_H_ + +# define __PRI_8_LENGTH_MODIFIER__ "hh" +# define __PRI_64_LENGTH_MODIFIER__ "ll" +# define __SCN_64_LENGTH_MODIFIER__ "ll" +# define __PRI_MAX_LENGTH_MODIFIER__ "j" +# define __SCN_MAX_LENGTH_MODIFIER__ "j" + +# define PRId8 __PRI_8_LENGTH_MODIFIER__ "d" +# define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i" +# define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o" +# define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" +# define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x" +# define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X" + +# define PRId16 "hd" +# define PRIi16 "hi" +# define PRIo16 "ho" +# define PRIu16 "hu" +# define PRIx16 "hx" +# define PRIX16 "hX" + +# define PRId32 "d" +# define PRIi32 "i" +# define PRIo32 "o" +# define PRIu32 "u" +# define PRIx32 "x" +# define PRIX32 "X" + +# define PRId64 __PRI_64_LENGTH_MODIFIER__ "d" +# define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i" +# define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o" +# define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u" +# define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" +# define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X" + +# define PRIdLEAST8 PRId8 +# define PRIiLEAST8 PRIi8 +# define PRIoLEAST8 PRIo8 +# define PRIuLEAST8 PRIu8 +# define PRIxLEAST8 PRIx8 +# define PRIXLEAST8 PRIX8 + +# define PRIdLEAST16 PRId16 +# define PRIiLEAST16 PRIi16 +# define PRIoLEAST16 PRIo16 +# define PRIuLEAST16 PRIu16 +# define PRIxLEAST16 PRIx16 +# define PRIXLEAST16 PRIX16 + +# define PRIdLEAST32 PRId32 +# define PRIiLEAST32 PRIi32 +# define PRIoLEAST32 PRIo32 +# define PRIuLEAST32 PRIu32 +# define PRIxLEAST32 PRIx32 +# define PRIXLEAST32 PRIX32 + +# define PRIdLEAST64 PRId64 +# define PRIiLEAST64 PRIi64 +# define PRIoLEAST64 PRIo64 +# define PRIuLEAST64 PRIu64 +# define PRIxLEAST64 PRIx64 +# define PRIXLEAST64 PRIX64 + +# define PRIdFAST8 PRId8 +# define PRIiFAST8 PRIi8 +# define PRIoFAST8 PRIo8 +# define PRIuFAST8 PRIu8 +# define PRIxFAST8 PRIx8 +# define PRIXFAST8 PRIX8 + +# define PRIdFAST16 PRId16 +# define PRIiFAST16 PRIi16 +# define PRIoFAST16 PRIo16 +# define PRIuFAST16 PRIu16 +# define PRIxFAST16 PRIx16 +# define PRIXFAST16 PRIX16 + +# define PRIdFAST32 PRId32 +# define PRIiFAST32 PRIi32 +# define PRIoFAST32 PRIo32 +# define PRIuFAST32 PRIu32 +# define PRIxFAST32 PRIx32 +# define PRIXFAST32 PRIX32 + +# define PRIdFAST64 PRId64 +# define PRIiFAST64 PRIi64 +# define PRIoFAST64 PRIo64 +# define PRIuFAST64 PRIu64 +# define PRIxFAST64 PRIx64 +# define PRIXFAST64 PRIX64 + +/* int32_t is 'int', but intptr_t is 'long'. */ +# define PRIdPTR "ld" +# define PRIiPTR "li" +# define PRIoPTR "lo" +# define PRIuPTR "lu" +# define PRIxPTR "lx" +# define PRIXPTR "lX" + +# define PRIdMAX __PRI_MAX_LENGTH_MODIFIER__ "d" +# define PRIiMAX __PRI_MAX_LENGTH_MODIFIER__ "i" +# define PRIoMAX __PRI_MAX_LENGTH_MODIFIER__ "o" +# define PRIuMAX __PRI_MAX_LENGTH_MODIFIER__ "u" +# define PRIxMAX __PRI_MAX_LENGTH_MODIFIER__ "x" +# define PRIXMAX __PRI_MAX_LENGTH_MODIFIER__ "X" + +# define SCNd8 __PRI_8_LENGTH_MODIFIER__ "d" +# define SCNi8 __PRI_8_LENGTH_MODIFIER__ "i" +# define SCNo8 __PRI_8_LENGTH_MODIFIER__ "o" +# define SCNu8 __PRI_8_LENGTH_MODIFIER__ "u" +# define SCNx8 __PRI_8_LENGTH_MODIFIER__ "x" + +# define SCNd16 "hd" +# define SCNi16 "hi" +# define SCNo16 "ho" +# define SCNu16 "hu" +# define SCNx16 "hx" + +# define SCNd32 "d" +# define SCNi32 "i" +# define SCNo32 "o" +# define SCNu32 "u" +# define SCNx32 "x" + +# define SCNd64 __SCN_64_LENGTH_MODIFIER__ "d" +# define SCNi64 __SCN_64_LENGTH_MODIFIER__ "i" +# define SCNo64 __SCN_64_LENGTH_MODIFIER__ "o" +# define SCNu64 __SCN_64_LENGTH_MODIFIER__ "u" +# define SCNx64 __SCN_64_LENGTH_MODIFIER__ "x" + +# define SCNdLEAST8 SCNd8 +# define SCNiLEAST8 SCNi8 +# define SCNoLEAST8 SCNo8 +# define SCNuLEAST8 SCNu8 +# define SCNxLEAST8 SCNx8 + +# define SCNdLEAST16 SCNd16 +# define SCNiLEAST16 SCNi16 +# define SCNoLEAST16 SCNo16 +# define SCNuLEAST16 SCNu16 +# define SCNxLEAST16 SCNx16 + +# define SCNdLEAST32 SCNd32 +# define SCNiLEAST32 SCNi32 +# define SCNoLEAST32 SCNo32 +# define SCNuLEAST32 SCNu32 +# define SCNxLEAST32 SCNx32 + +# define SCNdLEAST64 SCNd64 +# define SCNiLEAST64 SCNi64 +# define SCNoLEAST64 SCNo64 +# define SCNuLEAST64 SCNu64 +# define SCNxLEAST64 SCNx64 + +# define SCNdFAST8 SCNd8 +# define SCNiFAST8 SCNi8 +# define SCNoFAST8 SCNo8 +# define SCNuFAST8 SCNu8 +# define SCNxFAST8 SCNx8 + +# define SCNdFAST16 SCNd16 +# define SCNiFAST16 SCNi16 +# define SCNoFAST16 SCNo16 +# define SCNuFAST16 SCNu16 +# define SCNxFAST16 SCNx16 + +# define SCNdFAST32 SCNd32 +# define SCNiFAST32 SCNi32 +# define SCNoFAST32 SCNo32 +# define SCNuFAST32 SCNu32 +# define SCNxFAST32 SCNx32 + +# define SCNdFAST64 SCNd64 +# define SCNiFAST64 SCNi64 +# define SCNoFAST64 SCNo64 +# define SCNuFAST64 SCNu64 +# define SCNxFAST64 SCNx64 + +# define SCNdPTR "ld" +# define SCNiPTR "li" +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" + +# define SCNdMAX __SCN_MAX_LENGTH_MODIFIER__ "d" +# define SCNiMAX __SCN_MAX_LENGTH_MODIFIER__ "i" +# define SCNoMAX __SCN_MAX_LENGTH_MODIFIER__ "o" +# define SCNuMAX __SCN_MAX_LENGTH_MODIFIER__ "u" +# define SCNxMAX __SCN_MAX_LENGTH_MODIFIER__ "x" + +#include +#include + +#include <_types.h> +#include + +#include + +__BEGIN_DECLS + +/* 7.8.2.1 */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern intmax_t +imaxabs(intmax_t j); + +/* 7.8.2.2 */ +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern imaxdiv_t +imaxdiv(intmax_t __numer, intmax_t __denom); + +/* 7.8.2.3 */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern intmax_t +strtoimax(const char * __restrict __nptr, + char ** __restrict __endptr, + int __base); + +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern uintmax_t +strtoumax(const char * __restrict __nptr, + char ** __restrict __endptr, + int __base); + +/* 7.8.2.4 */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern intmax_t +wcstoimax(const wchar_t * __restrict __nptr, + wchar_t ** __restrict __endptr, + int __base); + +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern uintmax_t +wcstoumax(const wchar_t * __restrict __nptr, + wchar_t ** __restrict __endptr, + int __base); + +/* Poison the following routines if -fshort-wchar is set */ +#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU +#pragma GCC poison wcstoimax wcstoumax +#endif + +__END_DECLS + +/* + No need to #undef the __*_{8,64}_LENGTH_MODIFIER__ macros; + in fact, you can't #undef them, because later uses of any of + their dependents will *not* then do the intended substitution. + Expansion of a #define like this one: + + #define x IDENT y + + uses the cpp value of IDENT at the location where x is *expanded*, + not where it is #defined. +*/ + +#endif /* !_INTTYPES_H_ */ diff --git a/lib/libc/include/any-macos-any/_langinfo.h b/lib/libc/include/any-macos-any/_langinfo.h new file mode 100644 index 000000000000..e04ddb63818f --- /dev/null +++ b/lib/libc/include/any-macos-any/_langinfo.h @@ -0,0 +1,116 @@ +/*- + * Copyright (c) 2001 Alexey Zelkin + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD: /repoman/r/ncvs/src/include/langinfo.h,v 1.6 2002/09/18 05:54:25 mike Exp $ + */ + +#ifndef _LANGINFO_H_ +#define _LANGINFO_H_ + +#include <_types.h> +#include <_types/_nl_item.h> + +#define CODESET 0 /* codeset name */ +#define D_T_FMT 1 /* string for formatting date and time */ +#define D_FMT 2 /* date format string */ +#define T_FMT 3 /* time format string */ +#define T_FMT_AMPM 4 /* a.m. or p.m. time formatting string */ +#define AM_STR 5 /* Ante Meridian affix */ +#define PM_STR 6 /* Post Meridian affix */ + +/* week day names */ +#define DAY_1 7 +#define DAY_2 8 +#define DAY_3 9 +#define DAY_4 10 +#define DAY_5 11 +#define DAY_6 12 +#define DAY_7 13 + +/* abbreviated week day names */ +#define ABDAY_1 14 +#define ABDAY_2 15 +#define ABDAY_3 16 +#define ABDAY_4 17 +#define ABDAY_5 18 +#define ABDAY_6 19 +#define ABDAY_7 20 + +/* month names */ +#define MON_1 21 +#define MON_2 22 +#define MON_3 23 +#define MON_4 24 +#define MON_5 25 +#define MON_6 26 +#define MON_7 27 +#define MON_8 28 +#define MON_9 29 +#define MON_10 30 +#define MON_11 31 +#define MON_12 32 + +/* abbreviated month names */ +#define ABMON_1 33 +#define ABMON_2 34 +#define ABMON_3 35 +#define ABMON_4 36 +#define ABMON_5 37 +#define ABMON_6 38 +#define ABMON_7 39 +#define ABMON_8 40 +#define ABMON_9 41 +#define ABMON_10 42 +#define ABMON_11 43 +#define ABMON_12 44 + +#define ERA 45 /* era description segments */ +#define ERA_D_FMT 46 /* era date format string */ +#define ERA_D_T_FMT 47 /* era date and time format string */ +#define ERA_T_FMT 48 /* era time format string */ +#define ALT_DIGITS 49 /* alternative symbols for digits */ + +#define RADIXCHAR 50 /* radix char */ +#define THOUSEP 51 /* separator for thousands */ + +#define YESEXPR 52 /* affirmative response expression */ +#define NOEXPR 53 /* negative response expression */ + +#if (__DARWIN_C_LEVEL > __DARWIN_C_ANSI && __DARWIN_C_LEVEL < 200112L) || __DARWIN_C_LEVEL == __DARWIN_C_FULL +#define YESSTR 54 /* affirmative response for yes/no queries */ +#define NOSTR 55 /* negative response for yes/no queries */ +#endif + +#define CRNCYSTR 56 /* currency symbol */ + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +#define D_MD_ORDER 57 /* month/day order (local extension) */ +#endif + +__BEGIN_DECLS +char *nl_langinfo(nl_item); +__END_DECLS + +#endif /* !_LANGINFO_H_ */ diff --git a/lib/libc/include/any-macos-any/_mb_cur_max.h b/lib/libc/include/any-macos-any/_mb_cur_max.h new file mode 100644 index 000000000000..bb91f9a9e4f3 --- /dev/null +++ b/lib/libc/include/any-macos-any/_mb_cur_max.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 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 __MB_CUR_MAX_H_ +#define __MB_CUR_MAX_H_ + +#include + +__BEGIN_DECLS +int ___mb_cur_max(void); +__END_DECLS + +#undef MB_CUR_MAX +#define MB_CUR_MAX (___mb_cur_max()) + +#endif /* __MB_CUR_MAX_H_ */ diff --git a/lib/libc/include/any-macos-any/_monetary.h b/lib/libc/include/any-macos-any/_monetary.h new file mode 100644 index 000000000000..ca70fe50f75e --- /dev/null +++ b/lib/libc/include/any-macos-any/_monetary.h @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2001 Alexey Zelkin + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD: /repoman/r/ncvs/src/include/monetary.h,v 1.7 2002/09/20 08:22:48 mike Exp $ + */ + +#ifndef _MONETARY_H_ +#define _MONETARY_H_ + +#include +#include <_types.h> +#include +#include + +__BEGIN_DECLS +ssize_t strfmon(char *, size_t, const char *, ...); +__END_DECLS + +#endif /* !_MONETARY_H_ */ diff --git a/lib/libc/include/any-macos-any/_printf.h b/lib/libc/include/any-macos-any/_printf.h new file mode 100644 index 000000000000..4e9df834ef0f --- /dev/null +++ b/lib/libc/include/any-macos-any/_printf.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023 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 __PRINTF_H_ +#define __PRINTF_H_ + +#include + + +__BEGIN_DECLS +int printf(const char * __restrict, ...) __printflike(1, 2); +__END_DECLS + + +#endif /* __PRINTF_H_ */ diff --git a/lib/libc/include/any-macos-any/_regex.h b/lib/libc/include/any-macos-any/_regex.h index 1fb98e312d21..fc7b043ba60d 100644 --- a/lib/libc/include/any-macos-any/_regex.h +++ b/lib/libc/include/any-macos-any/_regex.h @@ -90,7 +90,8 @@ * Common header for regex.h and xlocale/_regex.h */ -#ifndef __REGEX_H_ +#ifndef _REGEX_H_ +#define _REGEX_H_ #define __REGEX_H_ #include <_types.h> @@ -118,4 +119,123 @@ typedef struct { regoff_t rm_eo; /* end of match */ } regmatch_t; -#endif /* !__REGEX_H_ */ +/*******************/ +/* regcomp() flags */ +/*******************/ +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define REG_BASIC 0000 /* Basic regular expressions (synonym for 0) */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + +#define REG_EXTENDED 0001 /* Extended regular expressions */ +#define REG_ICASE 0002 /* Compile ignoring upper/lower case */ +#define REG_NOSUB 0004 /* Compile only reporting success/failure */ +#define REG_NEWLINE 0010 /* Compile for newline-sensitive matching */ + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define REG_NOSPEC 0020 /* Compile turning off all special characters */ + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ + || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ + || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) +#define REG_LITERAL REG_NOSPEC +#endif + +#define REG_PEND 0040 /* Use re_endp as end pointer */ + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ + || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ + || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) +#define REG_MINIMAL 0100 /* Compile using minimal repetition */ +#define REG_UNGREEDY REG_MINIMAL +#endif + +#define REG_DUMP 0200 /* Unused */ + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ + || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ + || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) +#define REG_ENHANCED 0400 /* Additional (non-POSIX) features */ +#endif +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + +/********************/ +/* regerror() flags */ +/********************/ +#define REG_ENOSYS (-1) /* Reserved */ +#define REG_NOMATCH 1 /* regexec() function failed to match */ +#define REG_BADPAT 2 /* invalid regular expression */ +#define REG_ECOLLATE 3 /* invalid collating element */ +#define REG_ECTYPE 4 /* invalid character class */ +#define REG_EESCAPE 5 /* trailing backslash (\) */ +#define REG_ESUBREG 6 /* invalid backreference number */ +#define REG_EBRACK 7 /* brackets ([ ]) not balanced */ +#define REG_EPAREN 8 /* parentheses not balanced */ +#define REG_EBRACE 9 /* braces not balanced */ +#define REG_BADBR 10 /* invalid repetition count(s) */ +#define REG_ERANGE 11 /* invalid character range */ +#define REG_ESPACE 12 /* out of memory */ +#define REG_BADRPT 13 /* repetition-operator operand invalid */ + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define REG_EMPTY 14 /* Unused */ +#define REG_ASSERT 15 /* Unused */ +#define REG_INVARG 16 /* invalid argument to regex routine */ +#define REG_ILLSEQ 17 /* illegal byte sequence */ + +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + +/*******************/ +/* regexec() flags */ +/*******************/ +#define REG_NOTBOL 00001 /* First character not at beginning of line */ +#define REG_NOTEOL 00002 /* Last character not at end of line */ + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define REG_STARTEND 00004 /* String start/end in pmatch[0] */ +#define REG_TRACE 00400 /* Unused */ +#define REG_LARGE 01000 /* Unused */ +#define REG_BACKR 02000 /* force use of backref code */ + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ + || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ + || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) +#define REG_BACKTRACKING_MATCHER REG_BACKR +#endif +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + +__BEGIN_DECLS +int regcomp(regex_t * __restrict, const char * __restrict, int) __DARWIN_ALIAS(regcomp); +size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t) __cold; +/* + * gcc under c99 mode won't compile "[ __restrict]" by itself. As a workaround, + * a dummy argument name is added. + */ +int regexec(const regex_t * __restrict, const char * __restrict, size_t, + regmatch_t __pmatch[ __restrict], int); +void regfree(regex_t *); + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL + +/* Darwin extensions */ +int regncomp(regex_t * __restrict, const char * __restrict, size_t, int) + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); +int regnexec(const regex_t * __restrict, const char * __restrict, size_t, + size_t, regmatch_t __pmatch[ __restrict], int) + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); +int regwcomp(regex_t * __restrict, const wchar_t * __restrict, int) + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); +int regwexec(const regex_t * __restrict, const wchar_t * __restrict, size_t, + regmatch_t __pmatch[ __restrict], int) + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); +int regwncomp(regex_t * __restrict, const wchar_t * __restrict, size_t, int) + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); +int regwnexec(const regex_t * __restrict, const wchar_t * __restrict, + size_t, size_t, regmatch_t __pmatch[ __restrict], int) + __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); + +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ +__END_DECLS + +#endif /* !_REGEX_H_ */ diff --git a/lib/libc/include/any-macos-any/_static_assert.h b/lib/libc/include/any-macos-any/_static_assert.h new file mode 100644 index 000000000000..91e88d01b5fd --- /dev/null +++ b/lib/libc/include/any-macos-any/_static_assert.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 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 _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_ */ diff --git a/lib/libc/include/any-macos-any/_stdio.h b/lib/libc/include/any-macos-any/_stdio.h index 0f3ae7a7ba75..78395ca6b897 100644 --- a/lib/libc/include/any-macos-any/_stdio.h +++ b/lib/libc/include/any-macos-any/_stdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2005, 2007, 2009, 2010, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -62,7 +62,8 @@ * Common header for stdio.h and xlocale/_stdio.h */ -#ifndef __STDIO_H_ +#ifndef _STDIO_H_ +#define _STDIO_H_ #define __STDIO_H_ #include @@ -77,6 +78,7 @@ #include #include +#include <_printf.h> typedef __darwin_off_t fpos_t; @@ -156,4 +158,345 @@ typedef struct __sFILE { fpos_t _offset; /* current lseek offset (see WARNING) */ } FILE; -#endif /* __STDIO_H_ */ +#include + +__BEGIN_DECLS +extern FILE *__stdinp __swift_nonisolated_unsafe; +extern FILE *__stdoutp __swift_nonisolated_unsafe; +extern FILE *__stderrp __swift_nonisolated_unsafe; +__END_DECLS + +#define __SLBF 0x0001 /* line buffered */ +#define __SNBF 0x0002 /* unbuffered */ +#define __SRD 0x0004 /* OK to read */ +#define __SWR 0x0008 /* OK to write */ + /* RD and WR are never simultaneously asserted */ +#define __SRW 0x0010 /* open for reading & writing */ +#define __SEOF 0x0020 /* found EOF */ +#define __SERR 0x0040 /* found error */ +#define __SMBF 0x0080 /* _buf is from malloc */ +#define __SAPP 0x0100 /* fdopen()ed in append mode */ +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ +#define __SOPT 0x0400 /* do fseek() optimisation */ +#define __SNPT 0x0800 /* do not do fseek() optimisation */ +#define __SOFF 0x1000 /* set iff _offset is in fact correct */ +#define __SMOD 0x2000 /* true => fgetln modified _p text */ +#define __SALC 0x4000 /* allocate string space dynamically */ +#define __SIGN 0x8000 /* ignore this file in _fwalk */ + +/* + * The following three definitions are for ANSI C, which took them + * from System V, which brilliantly took internal interface macros and + * made them official arguments to setvbuf(), without renaming them. + * Hence, these ugly _IOxxx names are *supposed* to appear in user code. + * + * Although numbered as their counterparts above, the implementation + * does not rely on this. + */ +#define _IOFBF 0 /* setvbuf should set fully buffered */ +#define _IOLBF 1 /* setvbuf should set line buffered */ +#define _IONBF 2 /* setvbuf should set unbuffered */ + +#define BUFSIZ 1024 /* size of buffer used by setbuf */ +#define EOF (-1) + + /* must be == _POSIX_STREAM_MAX */ +#define FOPEN_MAX 20 /* must be <= OPEN_MAX */ +#define FILENAME_MAX 1024 /* must be <= PATH_MAX */ + +/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ +#ifndef _ANSI_SOURCE +#define P_tmpdir "/var/tmp/" +#endif +#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ +#define TMP_MAX 308915776 + +#define stdin __stdinp +#define stdout __stdoutp +#define stderr __stderrp + +#ifdef _DARWIN_UNLIMITED_STREAMS +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 +#error "_DARWIN_UNLIMITED_STREAMS 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_STREAMS specified, but -mmacosx-version-min version does not support it." +#endif +#endif + +/* ANSI-C */ + +__BEGIN_DECLS +void clearerr(FILE *); +int fclose(FILE *); +int feof(FILE *); +int ferror(FILE *); +int fflush(FILE *); +int fgetc(FILE *); +int fgetpos(FILE * __restrict, fpos_t *); +char *fgets(char * __restrict, int, FILE *); +#if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE) +FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(fopen)); +#else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */ +FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fopen)); +#endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */ +int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3); +int fputc(int, FILE *); +int fputs(const char * __restrict, FILE * __restrict) __DARWIN_ALIAS(fputs); +size_t fread(void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream); +FILE *freopen(const char * __restrict, const char * __restrict, + FILE * __restrict) __DARWIN_ALIAS(freopen); +int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3); +int fseek(FILE *, long, int); +int fsetpos(FILE *, const fpos_t *); +long ftell(FILE *); +size_t fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite); +int getc(FILE *); +int getchar(void); + +#if !defined(_POSIX_C_SOURCE) +__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of gets(3), it is highly recommended that you use fgets(3) instead.") +#endif +char *gets(char *); + +void perror(const char *) __cold; +int putc(int, FILE *); +int putchar(int); +int puts(const char *); +int remove(const char *); +int rename (const char *__old, const char *__new); +void rewind(FILE *); +int scanf(const char * __restrict, ...) __scanflike(1, 2); +void setbuf(FILE * __restrict, char * __restrict); +int setvbuf(FILE * __restrict, char * __restrict, int, size_t); + +__swift_unavailable("Use snprintf 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 sprintf(3), it is highly recommended that you use snprintf(3) instead.") +#endif +int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3); + +int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3); +FILE *tmpfile(void); + +__swift_unavailable("Use mkstemp(3) 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 tmpnam(3), it is highly recommended that you use mkstemp(3) instead.") +#endif +char *tmpnam(char *); + +int ungetc(int, FILE *); +int vfprintf(FILE * __restrict, const char * __restrict, va_list) __printflike(2, 0); +int vprintf(const char * __restrict, va_list) __printflike(1, 0); + +__swift_unavailable("Use vsnprintf 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 sprintf(3), it is highly recommended that you use vsnprintf(3) instead.") +#endif +int vsprintf(char * __restrict, const char * __restrict, va_list) __printflike(2, 0); +__END_DECLS + + + +/* Additional functionality provided by: + * POSIX.1-1988 + */ + +#if __DARWIN_C_LEVEL >= 198808L +#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ + +#include <_ctermid.h> + +__BEGIN_DECLS + +#if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE) +FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(fdopen)); +#else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */ +FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); +#endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */ +int fileno(FILE *); +__END_DECLS +#endif /* __DARWIN_C_LEVEL >= 198808L */ + + +/* Additional functionality provided by: + * POSIX.2-1992 C Language Binding Option + */ + +#if __DARWIN_C_LEVEL >= 199209L +__BEGIN_DECLS +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("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("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 */ + +/* Additional functionality provided by: + * POSIX.1c-1995, + * POSIX.1i-1995, + * and the omnibus ISO/IEC 9945-1: 1996 + */ + +#if __DARWIN_C_LEVEL >= 199506L + +/* Functions internal to the implementation. */ +__BEGIN_DECLS +int __srget(FILE *); +int __svfscanf(FILE *, const char *, va_list) __scanflike(2, 0); +int __swbuf(int, FILE *); +__END_DECLS + +/* + * The __sfoo macros are here so that we can + * define function versions in the C library. + */ +#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) +#if defined(__GNUC__) && defined(__STDC__) +__header_always_inline int __sputc(int _c, FILE *_p) { + if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) + return (*_p->_p++ = _c); + else + return (__swbuf(_c, _p)); +} +#else +/* + * This has been tuned to generate reasonable code on the vax using pcc. + */ +#define __sputc(c, p) \ + (--(p)->_w < 0 ? \ + (p)->_w >= (p)->_lbfsize ? \ + (*(p)->_p = (c)), *(p)->_p != '\n' ? \ + (int)*(p)->_p++ : \ + __swbuf('\n', p) : \ + __swbuf((int)(c), p) : \ + (*(p)->_p = (c), (int)*(p)->_p++)) +#endif + +#define __sfeof(p) (((p)->_flags & __SEOF) != 0) +#define __sferror(p) (((p)->_flags & __SERR) != 0) +#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) +#define __sfileno(p) ((p)->_file) + +__BEGIN_DECLS +void flockfile(FILE *); +int ftrylockfile(FILE *); +void funlockfile(FILE *); +int getc_unlocked(FILE *); +int getchar_unlocked(void); +int putc_unlocked(int, FILE *); +int putchar_unlocked(int); + +/* Removed in Issue 6 */ +#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L +int getw(FILE *); +int putw(int, FILE *); +#endif + +__swift_unavailable("Use mkstemp(3) 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 tempnam(3), it is highly recommended that you use mkstemp(3) instead.") +#endif +char *tempnam(const char *__dir, const char *__prefix) __DARWIN_ALIAS(tempnam); +__END_DECLS + +#ifndef lint +#define getc_unlocked(fp) __sgetc(fp) +#define putc_unlocked(x, fp) __sputc(x, fp) +#endif /* lint */ + +#define getchar_unlocked() getc_unlocked(stdin) +#define putchar_unlocked(x) putc_unlocked(x, stdout) +#endif /* __DARWIN_C_LEVEL >= 199506L */ + + + +/* Additional functionality provided by: + * POSIX.1-2001 + * ISO C99 + */ + +#if __DARWIN_C_LEVEL >= 200112L +#include + +__BEGIN_DECLS +int fseeko(FILE * __stream, off_t __offset, int __whence); +off_t ftello(FILE * __stream); +__END_DECLS +#endif /* __DARWIN_C_LEVEL >= 200112L */ + +#if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) +__BEGIN_DECLS +int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4); +int vfscanf(FILE * __restrict __stream, const char * __restrict __format, va_list) __scanflike(2, 0); +int vscanf(const char * __restrict __format, va_list) __scanflike(1, 0); +int vsnprintf(char * __restrict __str, size_t __size, const char * __restrict __format, va_list) __printflike(3, 0); +int vsscanf(const char * __restrict __str, const char * __restrict __format, va_list) __scanflike(2, 0); +__END_DECLS +#endif /* __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) */ + + + +/* Additional functionality provided by: + * POSIX.1-2008 + */ + +#if __DARWIN_C_LEVEL >= 200809L +#include + +__BEGIN_DECLS +int dprintf(int, const char * __restrict, ...) __printflike(2, 3) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +int vdprintf(int, const char * __restrict, va_list) __printflike(2, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +ssize_t getdelim(char ** __restrict __linep, size_t * __restrict __linecapp, int __delimiter, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +ssize_t getline(char ** __restrict __linep, size_t * __restrict __linecapp, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +FILE *fmemopen(void * __restrict __buf, size_t __size, const char * __restrict __mode) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); +FILE *open_memstream(char **__bufp, size_t *__sizep) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); +__END_DECLS +#endif /* __DARWIN_C_LEVEL >= 200809L */ + + + +/* Darwin extensions */ + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +__BEGIN_DECLS +extern __const int sys_nerr; /* perror(3) external variables */ +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 *) __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); + + +/* + * Stdio function-access interface. + */ +FILE *funopen(const void *, + int (* _Nullable)(void *, char *, int), + int (* _Nullable)(void *, const char *, int), + fpos_t (* _Nullable)(void *, fpos_t, int), + int (* _Nullable)(void *)); +__END_DECLS +#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) +#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) + +#define feof_unlocked(p) __sfeof(p) +#define ferror_unlocked(p) __sferror(p) +#define clearerr_unlocked(p) __sclearerr(p) +#define fileno_unlocked(p) __sfileno(p) + +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + + +#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus) +/* Security checking functions. */ +#include +#endif + +#endif /* _STDIO_H_ */ diff --git a/lib/libc/include/any-macos-any/_stdlib.h b/lib/libc/include/any-macos-any/_stdlib.h new file mode 100644 index 000000000000..54c03b8f81d8 --- /dev/null +++ b/lib/libc/include/any-macos-any/_stdlib.h @@ -0,0 +1,378 @@ +/* + * Copyright (c) 2023 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. + * + * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 + */ + +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +#include +#include + +#include <_types.h> +#if !defined(_ANSI_SOURCE) +#include +#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +#include +#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#endif /* !_ANSI_SOURCE */ + +/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: + * _GCC_SIZE_T */ +#include + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +#include +#include +#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ + +#include + +typedef struct { + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct { + long quot; /* quotient */ + long rem; /* remainder */ +} ldiv_t; + +#if !__DARWIN_NO_LONG_LONG +typedef struct { + long long quot; + long long rem; +} lldiv_t; +#endif /* !__DARWIN_NO_LONG_LONG */ + +#include + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#define RAND_MAX 0x7fffffff + +// When _USE_EXTENDED_LOCALES_ is enabled (by including xlocale.h), +// MB_CUR_MAX is defined by xlocale.h. +#if !defined(MB_CUR_MAX) && !defined(_USE_EXTENDED_LOCALES_) +#if __has_feature(modules) +// When clang modules are enabled, there can only be one definition of +// MB_CUR_MAX, and that needs to be the same one used by xlocale.h. +#include <_mb_cur_max.h> +#else +extern int __mb_cur_max; +#define MB_CUR_MAX __mb_cur_max +#endif /* __has_feature(modules) */ +#endif /* !MB_CUR_MAX && !_USE_EXTENDED_LOCALES_ */ + +#include +#include <_abort.h> + +__BEGIN_DECLS +int abs(int) __pure2; +int atexit(void (* _Nonnull)(void)); +#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) || \ + defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +int at_quick_exit(void (*)(void)); +#endif +double atof(const char *); +int atoi(const char *); +long atol(const char *); +#if !__DARWIN_NO_LONG_LONG +long long + atoll(const char *); +#endif /* !__DARWIN_NO_LONG_LONG */ +void *bsearch(const void *__key, const void *__base, size_t __nel, + size_t __width, int (* _Nonnull __compar)(const void *, const void *)); +/* calloc is now declared in _malloc.h */ +div_t div(int, int) __pure2; +void exit(int) __dead2; +/* free is now declared in _malloc.h */ +char *getenv(const char *); +long labs(long) __pure2; +ldiv_t ldiv(long, long) __pure2; +#if !__DARWIN_NO_LONG_LONG +long long + llabs(long long); +lldiv_t lldiv(long long, long long); +#endif /* !__DARWIN_NO_LONG_LONG */ +/* malloc is now declared in _malloc.h */ +int mblen(const char *__s, size_t __n); +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); +/* posix_memalign is now declared in _malloc.h */ +void qsort(void *__base, size_t __nel, size_t __width, + int (* _Nonnull __compar)(const void *, const void *)); +#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) || \ + defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +void quick_exit(int) __dead2; +#endif +int rand(void) __swift_unavailable("Use arc4random instead."); +/* realloc is now declared in _malloc.h */ +void srand(unsigned) __swift_unavailable("Use arc4random instead."); +double strtod(const char *, char **) __DARWIN_ALIAS(strtod); +float strtof(const char *, char **) __DARWIN_ALIAS(strtof); +long strtol(const char *__str, char **__endptr, int __base); +long double + strtold(const char *, char **); +#if !__DARWIN_NO_LONG_LONG +long long + strtoll(const char *__str, char **__endptr, int __base); +#endif /* !__DARWIN_NO_LONG_LONG */ +unsigned long + strtoul(const char *__str, char **__endptr, int __base); +#if !__DARWIN_NO_LONG_LONG +unsigned long long + strtoull(const char *__str, char **__endptr, int __base); +#endif /* !__DARWIN_NO_LONG_LONG */ + +__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); + + +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); +int wctomb(char *, wchar_t); + +#ifndef _ANSI_SOURCE +void _Exit(int) __dead2; +long a64l(const char *); +double drand48(void); +char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ +double erand48(unsigned short[3]); +char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ +char *gcvt(double, int, char *); /* LEGACY */ +int getsubopt(char **, char * const *, char **); +int grantpt(int); +#if __DARWIN_UNIX03 +char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ +#else /* !__DARWIN_UNIX03 */ +char *initstate(unsigned long, char *, long); +#endif /* __DARWIN_UNIX03 */ +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."); +long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); +int posix_openpt(int); +char *ptsname(int); + +#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); +#endif + +int putenv(char *) __DARWIN_ALIAS(putenv); +long random(void) __swift_unavailable("Use arc4random instead."); +int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); +#if (__DARWIN_UNIX03 && !defined(_POSIX_C_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(_DARWIN_BETTER_REALPATH) +char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); +#else /* (!__DARWIN_UNIX03 || _POSIX_C_SOURCE) && !_DARWIN_C_SOURCE && !_DARWIN_BETTER_REALPATH */ +char *realpath(const char * __restrict, char * __restrict) __DARWIN_ALIAS(realpath); +#endif /* (__DARWIN_UNIX03 && _POSIX_C_SOURCE) || _DARWIN_C_SOURCE || _DARWIN_BETTER_REALPATH */ +unsigned short + *seed48(unsigned short[3]); +int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); +#if __DARWIN_UNIX03 +void setkey(const char *) __DARWIN_ALIAS(setkey); +#else /* !__DARWIN_UNIX03 */ +int setkey(const char *); +#endif /* __DARWIN_UNIX03 */ +char *setstate(const char *); +void srand48(long); +#if __DARWIN_UNIX03 +void srandom(unsigned); +#else /* !__DARWIN_UNIX03 */ +void srandom(unsigned long); +#endif /* __DARWIN_UNIX03 */ +int unlockpt(int); +#if __DARWIN_UNIX03 +int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); +#else /* !__DARWIN_UNIX03 */ +void unsetenv(const char *); +#endif /* __DARWIN_UNIX03 */ +#endif /* !_ANSI_SOURCE */ +__END_DECLS + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +#include +#include +#include +#include <_types/_uint32_t.h> + +__BEGIN_DECLS +uint32_t arc4random(void); +void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) + __OSX_DEPRECATED(10.0, 10.12, "use arc4random_stir") + __IOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") + __TVOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") + __WATCHOS_DEPRECATED(1.0, 3.0, "use arc4random_stir"); +void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +void arc4random_stir(void); +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 *) __bsearch_noescape) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +#endif /* __BLOCKS__ */ + + /* getcap(3) functions */ +char *cgetcap(char *, const char *, int); +int cgetclose(void); +int cgetent(char **, char **, const char *); +int cgetfirst(char **, char **); +int cgetmatch(const char *, const char *); +int cgetnext(char **, char **); +int cgetnum(char *, const char *, long *); +int cgetset(const char *); +int cgetstr(char *, const char *, char **); +int cgetustr(char *, const char *, char **); + +int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +char *devname(dev_t, mode_t); +char *devname_r(dev_t, mode_t, char *buf, int len); +char *getbsize(int *, long *); +int getloadavg(double [], int); +const char + *getprogname(void); +void setprogname(const char *); + +#ifdef __BLOCKS__ +#if __has_attribute(noescape) +#define __sort_noescape __attribute__((__noescape__)) +#else +#define __sort_noescape +#endif +#endif /* __BLOCKS__ */ + +int heapsort(void *__base, size_t __nel, size_t __width, + int (* _Nonnull __compar)(const void *, const void *)); +#ifdef __BLOCKS__ +int heapsort_b(void *__base, size_t __nel, size_t __width, + int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +#endif /* __BLOCKS__ */ +int mergesort(void *__base, size_t __nel, size_t __width, + int (* _Nonnull __compar)(const void *, const void *)); +#ifdef __BLOCKS__ +int mergesort_b(void *__base, size_t __nel, size_t __width, + int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +#endif /* __BLOCKS__ */ +void psort(void *__base, size_t __nel, size_t __width, + int (* _Nonnull __compar)(const void *, const void *)) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +#ifdef __BLOCKS__ +void psort_b(void *__base, size_t __nel, size_t __width, + int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +#endif /* __BLOCKS__ */ +void psort_r(void *__base, size_t __nel, size_t __width, void *, + int (* _Nonnull __compar)(void *, const void *, const void *)) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +#ifdef __BLOCKS__ +void qsort_b(void *__base, size_t __nel, size_t __width, + int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) + __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); +#endif /* __BLOCKS__ */ +void qsort_r(void *__base, size_t __nel, size_t __width, void *, + int (* _Nonnull __compar)(void *, const void *, const void *)); +int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + unsigned __endbyte); +int rpmatch(const char *) + __API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0)); +int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, + unsigned __endbyte); +void sranddev(void); +void srandomdev(void); +/* reallocf is now declared in _malloc.h */ +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); +unsigned long long + strtouq(const char *__str, char **__endptr, int __base); +#endif /* !__DARWIN_NO_LONG_LONG */ +extern char *suboptarg; /* getsubopt(3) external variable */ +/* valloc is now declared in _malloc.h */ +__END_DECLS +#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ + +__BEGIN_DECLS +/* Poison the following routines if -fshort-wchar is set */ +#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU +#pragma GCC poison mbstowcs mbtowc wcstombs wctomb +#endif +__END_DECLS + +#endif /* _STDLIB_H_ */ diff --git a/lib/libc/include/any-macos-any/_string.h b/lib/libc/include/any-macos-any/_string.h new file mode 100644 index 000000000000..877123f69e10 --- /dev/null +++ b/lib/libc/include/any-macos-any/_string.h @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2023 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); + +__OSX_AVAILABLE(11.0) __IOS_AVAILABLE(14.0) +__TVOS_AVAILABLE(14.0) __WATCHOS_AVAILABLE(7.0) +int strsignal_r(int __sig, char *__strsignalbuf, size_t __buflen); +__END_DECLS + +/* Some functions historically defined in string.h were placed in strings.h + * by SUS. + */ +#include <_strings.h> +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + + +#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus) +/* Security checking functions. */ +#include +#endif + +#endif /* _STRING_H_ */ diff --git a/lib/libc/include/any-macos-any/_strings.h b/lib/libc/include/any-macos-any/_strings.h new file mode 100644 index 000000000000..91b0b5627f3a --- /dev/null +++ b/lib/libc/include/any-macos-any/_strings.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2000, 2007, 2010, 2023 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. + * + * @(#)strings.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef __STRINGS_H_ +#define __STRINGS_H_ + +#include <_types.h> + +#include +#include +#include + +__BEGIN_DECLS +/* Removed in Issue 7 */ +#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L +int bcmp(const void *, const void *, size_t) __POSIX_C_DEPRECATED(200112L); +void bcopy(const void *, void *, size_t) __POSIX_C_DEPRECATED(200112L); +void bzero(void *, size_t) __POSIX_C_DEPRECATED(200112L); +char *index(const char *, int) __POSIX_C_DEPRECATED(200112L); +char *rindex(const char *, int) __POSIX_C_DEPRECATED(200112L); +#endif + +int ffs(int); +int strcasecmp(const char *, const char *); +int strncasecmp(const char *, const char *, size_t); +__END_DECLS + +/* Darwin extensions */ +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +__BEGIN_DECLS +int ffsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); +int ffsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0); +int fls(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); +int flsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); +int flsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0); +__END_DECLS +#endif + +#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus) +/* Security checking functions. */ +#include +#endif + +#endif /* __STRINGS_H_ */ diff --git a/lib/libc/include/any-macos-any/_time.h b/lib/libc/include/any-macos-any/_time.h new file mode 100644 index 000000000000..c1b72edb3937 --- /dev/null +++ b/lib/libc/include/any-macos-any/_time.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2023 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 ((clock_t)1000000) /* [XSI] */ +#else /* !__DARWIN_UNIX03 */ +#include /* Include file containing CLK_TCK. */ + +#define CLOCKS_PER_SEC ((clock_t)(__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 + +#endif /* !_TIME_H_ */ diff --git a/lib/libc/include/any-macos-any/_wchar.h b/lib/libc/include/any-macos-any/_wchar.h new file mode 100644 index 000000000000..904c6fe720d5 --- /dev/null +++ b/lib/libc/include/any-macos-any/_wchar.h @@ -0,0 +1,227 @@ +/*- + * Copyright (c)1999 Citrus Project, + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD: /repoman/r/ncvs/src/include/wchar.h,v 1.34 2003/03/13 06:29:53 tjr Exp $ + */ + +/*- + * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * 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 NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + * + * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $ + */ + +#ifndef _WCHAR_H_ +#define _WCHAR_H_ + +#include <_types.h> +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifndef WCHAR_MIN +#define WCHAR_MIN __DARWIN_WCHAR_MIN +#endif + +#ifndef WCHAR_MAX +#define WCHAR_MAX __DARWIN_WCHAR_MAX +#endif + +#include +#include +#include +#include <__wctype.h> + + +/* Initially added in Issue 4 */ +__BEGIN_DECLS +wint_t btowc(int); +wint_t fgetwc(FILE *); +wchar_t *fgetws(wchar_t * __restrict, int, FILE * __restrict); +wint_t fputwc(wchar_t, FILE *); +int fputws(const wchar_t * __restrict, FILE * __restrict); +int fwide(FILE *, int); +int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...); +int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...); +wint_t getwc(FILE *); +wint_t getwchar(void); +size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); +size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, + mbstate_t * __restrict); +int mbsinit(const mbstate_t *); +size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, + mbstate_t * __restrict); +wint_t putwc(wchar_t, FILE *); +wint_t putwchar(wchar_t); +int swprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict, ...); +int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); +wint_t ungetwc(wint_t, FILE *); +int vfwprintf(FILE * __restrict, const wchar_t * __restrict, + __darwin_va_list); +int vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict, + __darwin_va_list); +int vwprintf(const wchar_t * __restrict, __darwin_va_list); +size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); +wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict); +wchar_t *wcschr(const wchar_t *, wchar_t); +int wcscmp(const wchar_t *, const wchar_t *); +int wcscoll(const wchar_t *, const wchar_t *); +wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); +size_t wcscspn(const wchar_t *, const wchar_t *); +size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, + const struct tm * __restrict) __DARWIN_ALIAS(wcsftime); +size_t wcslen(const wchar_t *); +wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t); +int wcsncmp(const wchar_t *, const wchar_t *, size_t); +wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t); +wchar_t *wcspbrk(const wchar_t *, const wchar_t *); +wchar_t *wcsrchr(const wchar_t *, wchar_t); +size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t, + mbstate_t * __restrict); +size_t wcsspn(const wchar_t *, const wchar_t *); +wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict); +size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t); +int wctob(wint_t); +double wcstod(const wchar_t * __restrict, wchar_t ** __restrict); +wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict, + wchar_t ** __restrict); +long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int); +unsigned long + wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int); +wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); +int wmemcmp(const wchar_t *, const wchar_t *, size_t); +wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); +wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); +wchar_t *wmemset(wchar_t *, wchar_t, size_t); +int wprintf(const wchar_t * __restrict, ...); +int wscanf(const wchar_t * __restrict, ...); +int wcswidth(const wchar_t *, size_t); +int wcwidth(wchar_t); +__END_DECLS + + + +/* Additional functionality provided by: + * POSIX.1-2001 + * ISO C99 + */ + +#if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) +__BEGIN_DECLS +int vfwscanf(FILE * __restrict, const wchar_t * __restrict, + __darwin_va_list); +int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, + __darwin_va_list); +int vwscanf(const wchar_t * __restrict, __darwin_va_list); +float wcstof(const wchar_t * __restrict, wchar_t ** __restrict); +long double + wcstold(const wchar_t * __restrict, wchar_t ** __restrict); +#if !__DARWIN_NO_LONG_LONG +long long + wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int); +unsigned long long + wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int); +#endif /* !__DARWIN_NO_LONG_LONG */ +__END_DECLS +#endif + + + +/* Additional functionality provided by: + * POSIX.1-2008 + */ + +#if __DARWIN_C_LEVEL >= 200809L +__BEGIN_DECLS +size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, + size_t, mbstate_t * __restrict); +wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +wchar_t *wcsdup(const wchar_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +int wcscasecmp(const wchar_t *, const wchar_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +size_t wcsnlen(const wchar_t *, size_t) __pure __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, + size_t, mbstate_t * __restrict); +FILE *open_wmemstream(wchar_t ** __bufp, size_t * __sizep) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); +__END_DECLS +#endif /* __DARWIN_C_LEVEL >= 200809L */ + + + +/* Darwin extensions */ + +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +__BEGIN_DECLS +wchar_t *fgetwln(FILE * __restrict, size_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); +size_t wcslcat(wchar_t *, const wchar_t *, size_t); +size_t wcslcpy(wchar_t *, const wchar_t *, size_t); +__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 fgetws fputwc fputws fwprintf fwscanf mbrtowc mbsnrtowcs mbsrtowcs putwc putwchar swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf vwprintf vwscanf wcrtomb wcscat wcschr wcscmp wcscoll wcscpy wcscspn wcsftime wcsftime wcslcat wcslcpy wcslen wcsncat wcsncmp wcsncpy wcsnrtombs wcspbrk wcsrchr wcsrtombs wcsspn wcsstr wcstod wcstof wcstok wcstol wcstold wcstoll wcstoul wcstoull wcswidth wcsxfrm wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset wprintf wscanf +#endif + +#endif /* !_WCHAR_H_ */ diff --git a/lib/libc/include/any-macos-any/_wctype.h b/lib/libc/include/any-macos-any/_wctype.h index 04da7960efaa..dc4bfa116fa6 100644 --- a/lib/libc/include/any-macos-any/_wctype.h +++ b/lib/libc/include/any-macos-any/_wctype.h @@ -23,23 +23,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp + * $NetBSD: wctype.h,v 1.3 2000/12/22 14:16:16 itojun Exp $ + * $FreeBSD: /repoman/r/ncvs/src/include/wctype.h,v 1.10 2002/08/21 16:19:55 mike Exp $ */ -/* - * Common header for wctype.h and wchar.h - * - * Contains everything required by wctype.h except: - * - * #include <_types/_wctrans_t.h> - * int iswblank(wint_t); - * wint_t towctrans(wint_t, wctrans_t); - * wctrans_t wctrans(const char *); - */ +#ifndef _WCTYPE_H_ +#define _WCTYPE_H_ -#ifndef __WCTYPE_H_ -#define __WCTYPE_H_ +#include +#include <_types.h> +#include <_types/_wctrans_t.h> + +#define __DARWIN_WCTYPE_TOP_inline __header_inline #include <__wctype.h> +#include /* * Use inline functions if we are allowed to and the compiler supports them. @@ -48,117 +47,80 @@ (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) __DARWIN_WCTYPE_TOP_inline int -iswalnum(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_A|_CTYPE_D)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswalpha(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_A)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswcntrl(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_C)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswctype(wint_t _wc, wctype_t _charclass) -{ - return (__istype(_wc, _charclass)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswdigit(wint_t _wc) +iswblank(wint_t _wc) { - return (__isctype(_wc, _CTYPE_D)); + return (__istype(_wc, _CTYPE_B)); } +#if !defined(_ANSI_SOURCE) __DARWIN_WCTYPE_TOP_inline int -iswgraph(wint_t _wc) +iswascii(wint_t _wc) { - return (__istype(_wc, _CTYPE_G)); + return ((_wc & ~0x7F) == 0); } __DARWIN_WCTYPE_TOP_inline int -iswlower(wint_t _wc) +iswhexnumber(wint_t _wc) { - return (__istype(_wc, _CTYPE_L)); + return (__istype(_wc, _CTYPE_X)); } __DARWIN_WCTYPE_TOP_inline int -iswprint(wint_t _wc) +iswideogram(wint_t _wc) { - return (__istype(_wc, _CTYPE_R)); + return (__istype(_wc, _CTYPE_I)); } __DARWIN_WCTYPE_TOP_inline int -iswpunct(wint_t _wc) +iswnumber(wint_t _wc) { - return (__istype(_wc, _CTYPE_P)); + return (__istype(_wc, _CTYPE_D)); } __DARWIN_WCTYPE_TOP_inline int -iswspace(wint_t _wc) +iswphonogram(wint_t _wc) { - return (__istype(_wc, _CTYPE_S)); + return (__istype(_wc, _CTYPE_Q)); } __DARWIN_WCTYPE_TOP_inline int -iswupper(wint_t _wc) +iswrune(wint_t _wc) { - return (__istype(_wc, _CTYPE_U)); + return (__istype(_wc, 0xFFFFFFF0L)); } __DARWIN_WCTYPE_TOP_inline int -iswxdigit(wint_t _wc) +iswspecial(wint_t _wc) { - return (__isctype(_wc, _CTYPE_X)); -} - -__DARWIN_WCTYPE_TOP_inline wint_t -towlower(wint_t _wc) -{ - return (__tolower(_wc)); -} - -__DARWIN_WCTYPE_TOP_inline wint_t -towupper(wint_t _wc) -{ - return (__toupper(_wc)); + return (__istype(_wc, _CTYPE_T)); } +#endif /* !_ANSI_SOURCE */ #else /* not using inlines */ __BEGIN_DECLS -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswcntrl(wint_t); -int iswctype(wint_t, wctype_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); -wint_t towlower(wint_t); -wint_t towupper(wint_t); +int iswblank(wint_t); + +#if !defined(_ANSI_SOURCE) +wint_t iswascii(wint_t); +wint_t iswhexnumber(wint_t); +wint_t iswideogram(wint_t); +wint_t iswnumber(wint_t); +wint_t iswphonogram(wint_t); +wint_t iswrune(wint_t); +wint_t iswspecial(wint_t); +#endif __END_DECLS #endif /* using inlines */ __BEGIN_DECLS -wctype_t - wctype(const char *); +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +wint_t nextwctype(wint_t, wctype_t); +#endif +wint_t towctrans(wint_t, wctrans_t); +wctrans_t + wctrans(const char *); __END_DECLS -#ifdef _USE_EXTENDED_LOCALES_ -#include -#endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* __WCTYPE_H_ */ +#endif /* _WCTYPE_H_ */ diff --git a/lib/libc/include/any-macos-any/_xlocale.h b/lib/libc/include/any-macos-any/_xlocale.h index 0ba412c5bd20..51bda307fb03 100644 --- a/lib/libc/include/any-macos-any/_xlocale.h +++ b/lib/libc/include/any-macos-any/_xlocale.h @@ -21,17 +21,46 @@ * @APPLE_LICENSE_HEADER_END@ */ -#ifndef __XLOCALE_H_ -#define __XLOCALE_H_ +#ifndef _XLOCALE_H_ +#define _XLOCALE_H_ #include -struct _xlocale; /* forward reference */ -typedef struct _xlocale * locale_t; +#ifndef _USE_EXTENDED_LOCALES_ +#define _USE_EXTENDED_LOCALES_ +#endif /* _USE_EXTENDED_LOCALES_ */ + +#include <_locale.h> +#include <__xlocale.h> + +#define LC_ALL_MASK ( LC_COLLATE_MASK \ + | LC_CTYPE_MASK \ + | LC_MESSAGES_MASK \ + | LC_MONETARY_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK ) +#define LC_COLLATE_MASK (1 << 0) +#define LC_CTYPE_MASK (1 << 1) +#define LC_MESSAGES_MASK (1 << 2) +#define LC_MONETARY_MASK (1 << 3) +#define LC_NUMERIC_MASK (1 << 4) +#define LC_TIME_MASK (1 << 5) + +#define _LC_NUM_MASK 6 +#define _LC_LAST_MASK (1 << (_LC_NUM_MASK - 1)) + +#define LC_GLOBAL_LOCALE ((locale_t)-1) +#define LC_C_LOCALE ((locale_t)NULL) __BEGIN_DECLS -int ___mb_cur_max(void); -int ___mb_cur_max_l(locale_t); +extern const locale_t _c_locale; + +locale_t duplocale(locale_t); +int freelocale(locale_t); +struct lconv * localeconv_l(locale_t); +locale_t newlocale(int, __const char *, locale_t); +__const char * querylocale(int, locale_t); +locale_t uselocale(locale_t); __END_DECLS -#endif /* __XLOCALE_H_ */ +#endif /* _XLOCALE_H_ */ diff --git a/lib/libc/include/any-macos-any/arm/_endian.h b/lib/libc/include/any-macos-any/arm/_endian.h new file mode 100644 index 000000000000..889e4ba1cdfc --- /dev/null +++ b/lib/libc/include/any-macos-any/arm/_endian.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2004, 2006, 2023 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) 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) 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. + */ + +#ifndef _ARM___ENDIAN_H_ +#define _ARM___ENDIAN_H_ + +#if defined (__arm__) || defined (__arm64__) + +#include + +#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN + +#if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) + +#define BYTE_ORDER __DARWIN_BYTE_ORDER + +#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ +#endif /* defined (__arm__) || defined (__arm64__) */ +#endif /* !_ARM___ENDIAN_H_ */ diff --git a/lib/libc/include/any-macos-any/arm/_types.h b/lib/libc/include/any-macos-any/arm/_types.h index 44575038a909..7af8008c5259 100644 --- a/lib/libc/include/any-macos-any/arm/_types.h +++ b/lib/libc/include/any-macos-any/arm/_types.h @@ -6,6 +6,19 @@ #if defined (__arm__) || defined (__arm64__) +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_TYPES 1 +#else +#define USE_CLANG_TYPES 0 +#endif + +#if USE_CLANG_TYPES +#include +#include +#include +#include +#endif + /* * This header file contains integer types. It's intended to also contain * flotaing point and other arithmetic types, as needed, later. @@ -58,7 +71,9 @@ typedef union { typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */ -#if defined(__PTRDIFF_TYPE__) +#if USE_CLANG_TYPES +typedef ptrdiff_t __darwin_ptrdiff_t; /* ptr1 - ptr2 */ +#elif defined(__PTRDIFF_TYPE__) typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */ #elif defined(__LP64__) typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */ @@ -66,19 +81,25 @@ typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */ typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */ #endif /* __GNUC__ */ -#if defined(__SIZE_TYPE__) +#if USE_CLANG_TYPES +typedef size_t __darwin_size_t; /* sizeof() */ +#elif defined(__SIZE_TYPE__) typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */ #else typedef unsigned long __darwin_size_t; /* sizeof() */ #endif -#if (__GNUC__ > 2) +#if USE_CLANG_TYPES +typedef va_list __darwin_va_list; /* va_list */ +#elif (__GNUC__ > 2) typedef __builtin_va_list __darwin_va_list; /* va_list */ #else typedef void * __darwin_va_list; /* va_list */ #endif -#if defined(__WCHAR_TYPE__) +#if USE_CLANG_TYPES +typedef wchar_t __darwin_wchar_t; /* wchar_t */ +#elif defined(__WCHAR_TYPE__) typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */ #else typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */ @@ -97,6 +118,8 @@ typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */ typedef long __darwin_ssize_t; /* byte count or error */ typedef long __darwin_time_t; /* time() */ +#undef USE_CLANG_TYPES + #endif /* defined (__arm__) || defined (__arm64__) */ #endif /* _BSD_ARM__TYPES_H_ */ diff --git a/lib/libc/include/any-macos-any/arm/endian.h b/lib/libc/include/any-macos-any/arm/endian.h index f5e555fe4eb1..0b43ea8b6c68 100644 --- a/lib/libc/include/any-macos-any/arm/endian.h +++ b/lib/libc/include/any-macos-any/arm/endian.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * Copyright (c) 2000-2023 Apple Inc. All rights reserved. */ /* * Copyright 1995 NeXT Computer, Inc. All rights reserved. @@ -56,24 +56,8 @@ #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)) */ diff --git a/lib/libc/include/any-macos-any/arm/limits.h b/lib/libc/include/any-macos-any/arm/limits.h index 1768884aaff8..8483a6976751 100644 --- a/lib/libc/include/any-macos-any/arm/limits.h +++ b/lib/libc/include/any-macos-any/arm/limits.h @@ -44,6 +44,12 @@ #include #include +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_LIMITS 1 +#else +#define USE_CLANG_LIMITS 0 +#endif + #undef MB_LEN_MAX #define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ @@ -59,7 +65,7 @@ #include_next #endif /* __has_include_next */ -#else +#elif !USE_CLANG_LIMITS #define CHAR_BIT 8 /* number of bits in a char */ @@ -102,7 +108,7 @@ #define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */ #define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */ -#endif /* defined(__has_include) && __has_include(<__xnu_libcxx_sentinel.h>) */ +#endif /* !USE_CLANG_LIMITS */ #if !defined(_ANSI_SOURCE) #ifdef __LP64__ @@ -123,6 +129,8 @@ #endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */ #endif /* !_ANSI_SOURCE */ +#undef USE_CLANG_LIMITS + #endif /* defined (__arm__) || defined (__arm64__) */ #endif /* _ARM_LIMITS_H_ */ diff --git a/lib/libc/include/any-macos-any/arm/types.h b/lib/libc/include/any-macos-any/arm/types.h index 35c55d0c8855..f85a6620d43c 100644 --- a/lib/libc/include/any-macos-any/arm/types.h +++ b/lib/libc/include/any-macos-any/arm/types.h @@ -91,6 +91,7 @@ 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))) diff --git a/lib/libc/include/any-macos-any/assert.h b/lib/libc/include/any-macos-any/assert.h index 4683018dc4a0..8a87524ae434 100644 --- a/lib/libc/include/any-macos-any/assert.h +++ b/lib/libc/include/any-macos-any/assert.h @@ -50,12 +50,13 @@ */ #undef assert -#undef __assert #ifdef NDEBUG #define assert(e) ((void)0) #else +#include <_assert.h> + #ifdef __FILE_NAME__ #define __ASSERT_FILE_NAME __FILE_NAME__ #else /* __FILE_NAME__ */ @@ -64,36 +65,11 @@ #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, __ASSERT_FILE_NAME, __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__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0) @@ -105,13 +81,4 @@ __END_DECLS #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_ */ +#include <_static_assert.h> diff --git a/lib/libc/include/any-macos-any/copyfile.h b/lib/libc/include/any-macos-any/copyfile.h index 0600722ceaee..2128a1699dc3 100644 --- a/lib/libc/include/any-macos-any/copyfile.h +++ b/lib/libc/include/any-macos-any/copyfile.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2021 Apple, Inc. All rights reserved. + * Copyright (c) 2004-2023 Apple, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -79,6 +79,10 @@ typedef int (*copyfile_callback_t)(int, int, copyfile_state_t, const char *__uns #define COPYFILE_STATE_DST_BSIZE 12 #define COPYFILE_STATE_BSIZE 13 #define COPYFILE_STATE_FORBID_CROSS_MOUNT 14 +#define COPYFILE_STATE_NOCPROTECT 15 +#define COPYFILE_STATE_PRESERVE_SUID 16 +#define COPYFILE_STATE_RECURSIVE_SRC_FTSENT 17 +#define COPYFILE_STATE_FORBID_DST_EXISTING_SYMLINKS 18 #define COPYFILE_DISABLE_VAR "COPYFILE_DISABLE" diff --git a/lib/libc/include/any-macos-any/ctype.h b/lib/libc/include/any-macos-any/ctype.h index b8933696a417..d55301330988 100644 --- a/lib/libc/include/any-macos-any/ctype.h +++ b/lib/libc/include/any-macos-any/ctype.h @@ -63,13 +63,8 @@ * @(#)ctype.h 8.4 (Berkeley) 1/21/94 */ -#ifndef _CTYPE_H_ -#define _CTYPE_H_ - #include <_ctype.h> #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* !_CTYPE_H_ */ diff --git a/lib/libc/include/any-macos-any/dispatch/queue.h b/lib/libc/include/any-macos-any/dispatch/queue.h index 3eeeb48a8113..ed92d11a56c8 100644 --- a/lib/libc/include/any-macos-any/dispatch/queue.h +++ b/lib/libc/include/any-macos-any/dispatch/queue.h @@ -99,7 +99,6 @@ DISPATCH_DECL_FACTORY_CLASS_SWIFT(dispatch_queue, DispatchQueue); * Calls to dispatch_suspend(), dispatch_resume(), dispatch_set_context(), etc., * will have no effect when used with queues of this type. */ -API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_DECL_SUBCLASS(dispatch_queue_global, dispatch_queue); /*! @@ -169,7 +168,6 @@ DISPATCH_DECL_SERIAL_EXECUTOR_SWIFT(dispatch_queue_serial, DispatchSerialQueue); * dispatch_suspend(), dispatch_resume(), dispatch_set_context(), etc., will * have no effect when used on the main queue. */ -API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) DISPATCH_DECL_SUBCLASS(dispatch_queue_main, dispatch_queue_serial); /*! @@ -1738,6 +1736,69 @@ dispatch_assert_queue_not(dispatch_queue_t queue) #define dispatch_assert_queue_not_debug(q) dispatch_assert_queue_not(q) #endif +/* @function dispatch_allow_send_signals + * + * @discussion + * This function provides the calling process an ability to send signals to + * it's pthread worker threads created to service incoming work to dispatch, + * including those which were already created prior to this function call + * and those who may be created in the future. After a call to this function + * returns successfully, this ability is retained for the lifetime of the + * calling process. + * Regular UNIX calls still need to be used to manipulate signal mask of + * each individual pthread worker thread to allow delivery of a specific + * signal to that thread. + * + * @param preserve_signum + * Dispatch and its kernel runtime subsystem manages a pool of pthread + * worker threads which are reused for handling incoming work to dispatch. + * The signal number specified here is used internally by this subsystem to + * preserve sigmask of the pthread worker threads across their reuse. + * + * In other words, if a pthread worker thread unblocks delivery of + * @preserve_signum using regular UNIX calls after a call to this + * function using the same @preserve_signum returns successfully, + * that @preserve_signum remains unblocked across that thread's + * reuse until it is further modified by regular UNIX calls. + * Therefore, it avoids the need to call regular UNIX calls to + * unblock delivery of @preserve_signum every time that thread + * is reused. The specific signal @preserve_signum can be sent + * to that specific pthread worker thread using pthread_kill(). + * + * The following code illustrates an expected usage of this API. + * + * + * + * // Enable sending signals to dispatch pthread worker threads. + * int ret = dispatch_allow_send_signals(sig); + * // Validate ret. + * + * dispatch_async(q, ^{ + * // Unblock sig for this worker thread if not already done. + * // Such a state could be saved in TSD or globally. + * mask = sigmask(sig); + * pthread_sigmask(SIG_UNBLOCK, &mask, NULL); + * // busy with some work. Can receive signal sig. + * // If this worker thread is re-used later, it does not + * // not need to call pthread_sigmask again to unblock delivery + * // of signal sig. + * } + * + * This function returns 0 upon success and -1 with an errno otherwise. + * Possible error codes are as below : + * + * EINVAL : @preserve_signum is prohibited and is not allowed to be preserved + * across the thread's reuse. + * ENOTSUP : The underlying kernel does not support this functionality. + * + * + */ +API_AVAILABLE(macos(14.4), ios(17.4), visionos(1.1)) +API_UNAVAILABLE(tvos, watchos, driverkit) +DISPATCH_EXPORT +int +dispatch_allow_send_signals(int preserve_signum); + __END_DECLS DISPATCH_ASSUME_ABI_SINGLE_END diff --git a/lib/libc/include/any-macos-any/dispatch/workloop.h b/lib/libc/include/any-macos-any/dispatch/workloop.h index 5f1315a02ae7..ae89dedcd11d 100644 --- a/lib/libc/include/any-macos-any/dispatch/workloop.h +++ b/lib/libc/include/any-macos-any/dispatch/workloop.h @@ -145,6 +145,10 @@ dispatch_workloop_set_autorelease_frequency(dispatch_workloop_t workloop, * The worker thread will be a member of the specified os_workgroup_t while executing * work items submitted to the workloop. * + * Using both dispatch_workloop_set_scheduler_priority() and + * dispatch_workloop_set_os_workgroup() will prefer scheduling policies + * from the workgroup, if they exist. + * * @param workloop * The dispatch workloop to modify. * diff --git a/lib/libc/include/any-macos-any/float.h b/lib/libc/include/any-macos-any/float.h index d0c159657a71..51af0f648f32 100644 --- a/lib/libc/include/any-macos-any/float.h +++ b/lib/libc/include/any-macos-any/float.h @@ -22,6 +22,15 @@ #ifndef __FLOAT_H #define __FLOAT_H +#if !defined(__has_feature) || !__has_feature(modules) +/* clang's float.h comes before this header in the search order. It + * will include this header first, undef all of these macros, and then + * redeclare them. That doesn't work when the two headers are in + * different clang modules. The only way to avoid redeclaration errors + * is to not declare the macros here, and let clang's float.h handle + * them. + */ + /* Undefine anything that we'll be redefining below. */ #undef FLT_EVAL_METHOD #undef FLT_ROUNDS @@ -137,4 +146,6 @@ # define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__ #endif +#endif /* !__has_feature(modules) */ + #endif /* __FLOAT_H */ diff --git a/lib/libc/include/any-macos-any/hfs/hfs_format.h b/lib/libc/include/any-macos-any/hfs/hfs_format.h index a094341aed57..cda1efe48bd1 100644 --- a/lib/libc/include/any-macos-any/hfs/hfs_format.h +++ b/lib/libc/include/any-macos-any/hfs/hfs_format.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2015 Apple Inc. All rights reserved. + * Copyright (c) 2000-2023 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -37,7 +37,7 @@ * * This file describes the on-disk format for HFS and HFS Plus volumes. * - * Note: Starting 10.9, definition of struct HFSUniStr255 exists in hfs_unitstr.h + * Note: Starting with MacOS 10.9, definition of struct HFSUniStr255 exists in hfs_unistr.h * */ @@ -373,10 +373,12 @@ enum { kHFSFastDevCandidateMask = 0x0400, kHFSAutoCandidateBit = 0x000b, /* this item was automatically marked as a fast-dev candidate by the kernel */ - kHFSAutoCandidateMask = 0x0800 + kHFSAutoCandidateMask = 0x0800, - // There are only 4 flag bits remaining: 0x1000, 0x2000, 0x4000, 0x8000 + kHFSCatExpandedTimesBit = 0x000c, /* this item has expanded timestamps */ + kHFSCatExpandedTimesMask = 0x1000 + // There are only 3 flag bits remaining: 0x2000, 0x4000, 0x8000 }; @@ -600,6 +602,7 @@ enum { */ kHFSUnusedNodeFixBit = 31, /* Unused nodes in the Catalog B-tree have been zero-filled. See Radar #6947811. */ kHFSContentProtectionBit = 30, /* Volume has per-file content protection */ + kHFSExpandedTimesBit = 29, /* Volume has expanded / non-MacOS native timestamps */ /*** Keep these in sync with the bits above ! ****/ kHFSVolumeHardwareLockMask = 0x00000080, @@ -614,6 +617,7 @@ enum { /* Bits 16-31 are allocated from high to low */ + kHFSExpandedTimesMask = 0x20000000, kHFSContentProtectionMask = 0x40000000, kHFSUnusedNodeFixMask = 0x80000000, @@ -621,7 +625,8 @@ enum { }; enum { - kHFSUnusedNodesFixDate = 0xc5ef2480 /* March 25, 2009 */ + kHFSUnusedNodesFixDate = 0xc5ef2480, /* March 25, 2009 (aka 3320784000) */ + kHFSUnusedNodesFixExpandedDate = 0x49c97400 /* March 25, 2009 (akai 1237939200) - BSD epoch-relative */ }; /* HFS Master Directory Block - 162 bytes */ diff --git a/lib/libc/include/any-macos-any/i386/_endian.h b/lib/libc/include/any-macos-any/i386/_endian.h new file mode 100644 index 000000000000..c85dcc649ce0 --- /dev/null +++ b/lib/libc/include/any-macos-any/i386/_endian.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2004, 2006, 2023 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) 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) 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. + */ + +#ifndef _I386___ENDIAN_H_ +#define _I386___ENDIAN_H_ + +#if defined (__i386__) || defined (__x86_64__) + +#include + +#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN + +#if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) + +#define BYTE_ORDER __DARWIN_BYTE_ORDER + +#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ +#endif /* defined (__i386__) || defined (__x86_64__) */ +#endif /* !_I386___ENDIAN_H_ */ diff --git a/lib/libc/include/any-macos-any/i386/_types.h b/lib/libc/include/any-macos-any/i386/_types.h index 317a4725110e..53089464a581 100644 --- a/lib/libc/include/any-macos-any/i386/_types.h +++ b/lib/libc/include/any-macos-any/i386/_types.h @@ -30,6 +30,19 @@ #if defined (__i386__) || defined (__x86_64__) +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_TYPES 1 +#else +#define USE_CLANG_TYPES 0 +#endif + +#if USE_CLANG_TYPES +#include +#include +#include +#include +#endif + /* * This header file contains integer types. It's intended to also contain * flotaing point and other arithmetic types, as needed, later. @@ -82,7 +95,9 @@ typedef union { typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */ -#if defined(__PTRDIFF_TYPE__) +#if USE_CLANG_TYPES +typedef ptrdiff_t __darwin_ptrdiff_t; /* ptr1 - ptr2 */ +#elif defined(__PTRDIFF_TYPE__) typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */ #elif defined(__LP64__) typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */ @@ -90,19 +105,25 @@ typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */ typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */ #endif /* __GNUC__ */ -#if defined(__SIZE_TYPE__) +#if USE_CLANG_TYPES +typedef size_t __darwin_size_t; /* sizeof() */ +#elif defined(__SIZE_TYPE__) typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */ #else typedef unsigned long __darwin_size_t; /* sizeof() */ #endif -#if (__GNUC__ > 2) +#if USE_CLANG_TYPES +typedef va_list __darwin_va_list; /* va_list */ +#elif (__GNUC__ > 2) typedef __builtin_va_list __darwin_va_list; /* va_list */ #else typedef void * __darwin_va_list; /* va_list */ #endif -#if defined(__WCHAR_TYPE__) +#if USE_CLANG_TYPES +typedef wchar_t __darwin_wchar_t; /* wchar_t */ +#elif defined(__WCHAR_TYPE__) typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */ #else typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */ @@ -121,6 +142,8 @@ typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */ typedef long __darwin_ssize_t; /* byte count or error */ typedef long __darwin_time_t; /* time() */ +#undef USE_CLANG_TYPES + #endif /* defined (__i386__) || defined (__x86_64__) */ #endif /* _BSD_I386__TYPES_H_ */ diff --git a/lib/libc/include/any-macos-any/i386/endian.h b/lib/libc/include/any-macos-any/i386/endian.h index cda31eb8e868..60314f97b502 100644 --- a/lib/libc/include/any-macos-any/i386/endian.h +++ b/lib/libc/include/any-macos-any/i386/endian.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2023 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -80,24 +80,8 @@ #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)) */ diff --git a/lib/libc/include/any-macos-any/i386/limits.h b/lib/libc/include/any-macos-any/i386/limits.h index 502bd6342307..30b7af6128a1 100644 --- a/lib/libc/include/any-macos-any/i386/limits.h +++ b/lib/libc/include/any-macos-any/i386/limits.h @@ -41,6 +41,12 @@ #include #include +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_LIMITS 1 +#else +#define USE_CLANG_LIMITS 0 +#endif + #undef MB_LEN_MAX #define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ @@ -56,7 +62,7 @@ #include_next #endif /* __has_include_next */ -#else +#elif !USE_CLANG_LIMITS #define CHAR_BIT 8 /* number of bits in a char */ @@ -99,7 +105,7 @@ #define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */ #define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */ -#endif /* defined(__has_include) && __has_include(<__xnu_libcxx_sentinel.h>) */ +#endif /* !USE_CLANG_LIMITS */ #if !defined(_ANSI_SOURCE) #ifdef __LP64__ @@ -120,6 +126,8 @@ #endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */ #endif /* !_ANSI_SOURCE */ +#undef USE_CLANG_LIMITS + #endif /* defined (__i386__) || defined (__x86_64__) */ #endif /* _I386_LIMITS_H_ */ diff --git a/lib/libc/include/any-macos-any/i386/types.h b/lib/libc/include/any-macos-any/i386/types.h index ebd249684ffc..1bad74242b69 100644 --- a/lib/libc/include/any-macos-any/i386/types.h +++ b/lib/libc/include/any-macos-any/i386/types.h @@ -104,6 +104,8 @@ 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; + + #define USER_ADDR_NULL ((user_addr_t) 0) #define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)((uintptr_t)(a_ptr))) diff --git a/lib/libc/include/any-macos-any/inttypes.h b/lib/libc/include/any-macos-any/inttypes.h index c29873da3112..78104af2de1a 100644 --- a/lib/libc/include/any-macos-any/inttypes.h +++ b/lib/libc/include/any-macos-any/inttypes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004, 2013 Apple Inc. All rights reserved. + * Copyright (c) 2000-2004, 2013, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -28,270 +28,8 @@ * and their ilk. */ -#if !defined(_INTTYPES_H_) -#define _INTTYPES_H_ - -# define __PRI_8_LENGTH_MODIFIER__ "hh" -# define __PRI_64_LENGTH_MODIFIER__ "ll" -# define __SCN_64_LENGTH_MODIFIER__ "ll" -# define __PRI_MAX_LENGTH_MODIFIER__ "j" -# define __SCN_MAX_LENGTH_MODIFIER__ "j" - -# define PRId8 __PRI_8_LENGTH_MODIFIER__ "d" -# define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i" -# define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o" -# define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" -# define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x" -# define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X" - -# define PRId16 "hd" -# define PRIi16 "hi" -# define PRIo16 "ho" -# define PRIu16 "hu" -# define PRIx16 "hx" -# define PRIX16 "hX" - -# define PRId32 "d" -# define PRIi32 "i" -# define PRIo32 "o" -# define PRIu32 "u" -# define PRIx32 "x" -# define PRIX32 "X" - -# define PRId64 __PRI_64_LENGTH_MODIFIER__ "d" -# define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i" -# define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o" -# define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u" -# define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" -# define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X" - -# define PRIdLEAST8 PRId8 -# define PRIiLEAST8 PRIi8 -# define PRIoLEAST8 PRIo8 -# define PRIuLEAST8 PRIu8 -# define PRIxLEAST8 PRIx8 -# define PRIXLEAST8 PRIX8 - -# define PRIdLEAST16 PRId16 -# define PRIiLEAST16 PRIi16 -# define PRIoLEAST16 PRIo16 -# define PRIuLEAST16 PRIu16 -# define PRIxLEAST16 PRIx16 -# define PRIXLEAST16 PRIX16 - -# define PRIdLEAST32 PRId32 -# define PRIiLEAST32 PRIi32 -# define PRIoLEAST32 PRIo32 -# define PRIuLEAST32 PRIu32 -# define PRIxLEAST32 PRIx32 -# define PRIXLEAST32 PRIX32 - -# define PRIdLEAST64 PRId64 -# define PRIiLEAST64 PRIi64 -# define PRIoLEAST64 PRIo64 -# define PRIuLEAST64 PRIu64 -# define PRIxLEAST64 PRIx64 -# define PRIXLEAST64 PRIX64 - -# define PRIdFAST8 PRId8 -# define PRIiFAST8 PRIi8 -# define PRIoFAST8 PRIo8 -# define PRIuFAST8 PRIu8 -# define PRIxFAST8 PRIx8 -# define PRIXFAST8 PRIX8 - -# define PRIdFAST16 PRId16 -# define PRIiFAST16 PRIi16 -# define PRIoFAST16 PRIo16 -# define PRIuFAST16 PRIu16 -# define PRIxFAST16 PRIx16 -# define PRIXFAST16 PRIX16 - -# define PRIdFAST32 PRId32 -# define PRIiFAST32 PRIi32 -# define PRIoFAST32 PRIo32 -# define PRIuFAST32 PRIu32 -# define PRIxFAST32 PRIx32 -# define PRIXFAST32 PRIX32 - -# define PRIdFAST64 PRId64 -# define PRIiFAST64 PRIi64 -# define PRIoFAST64 PRIo64 -# define PRIuFAST64 PRIu64 -# define PRIxFAST64 PRIx64 -# define PRIXFAST64 PRIX64 - -/* int32_t is 'int', but intptr_t is 'long'. */ -# define PRIdPTR "ld" -# define PRIiPTR "li" -# define PRIoPTR "lo" -# define PRIuPTR "lu" -# define PRIxPTR "lx" -# define PRIXPTR "lX" - -# define PRIdMAX __PRI_MAX_LENGTH_MODIFIER__ "d" -# define PRIiMAX __PRI_MAX_LENGTH_MODIFIER__ "i" -# define PRIoMAX __PRI_MAX_LENGTH_MODIFIER__ "o" -# define PRIuMAX __PRI_MAX_LENGTH_MODIFIER__ "u" -# define PRIxMAX __PRI_MAX_LENGTH_MODIFIER__ "x" -# define PRIXMAX __PRI_MAX_LENGTH_MODIFIER__ "X" - -# define SCNd8 __PRI_8_LENGTH_MODIFIER__ "d" -# define SCNi8 __PRI_8_LENGTH_MODIFIER__ "i" -# define SCNo8 __PRI_8_LENGTH_MODIFIER__ "o" -# define SCNu8 __PRI_8_LENGTH_MODIFIER__ "u" -# define SCNx8 __PRI_8_LENGTH_MODIFIER__ "x" - -# define SCNd16 "hd" -# define SCNi16 "hi" -# define SCNo16 "ho" -# define SCNu16 "hu" -# define SCNx16 "hx" - -# define SCNd32 "d" -# define SCNi32 "i" -# define SCNo32 "o" -# define SCNu32 "u" -# define SCNx32 "x" - -# define SCNd64 __SCN_64_LENGTH_MODIFIER__ "d" -# define SCNi64 __SCN_64_LENGTH_MODIFIER__ "i" -# define SCNo64 __SCN_64_LENGTH_MODIFIER__ "o" -# define SCNu64 __SCN_64_LENGTH_MODIFIER__ "u" -# define SCNx64 __SCN_64_LENGTH_MODIFIER__ "x" - -# define SCNdLEAST8 SCNd8 -# define SCNiLEAST8 SCNi8 -# define SCNoLEAST8 SCNo8 -# define SCNuLEAST8 SCNu8 -# define SCNxLEAST8 SCNx8 - -# define SCNdLEAST16 SCNd16 -# define SCNiLEAST16 SCNi16 -# define SCNoLEAST16 SCNo16 -# define SCNuLEAST16 SCNu16 -# define SCNxLEAST16 SCNx16 - -# define SCNdLEAST32 SCNd32 -# define SCNiLEAST32 SCNi32 -# define SCNoLEAST32 SCNo32 -# define SCNuLEAST32 SCNu32 -# define SCNxLEAST32 SCNx32 - -# define SCNdLEAST64 SCNd64 -# define SCNiLEAST64 SCNi64 -# define SCNoLEAST64 SCNo64 -# define SCNuLEAST64 SCNu64 -# define SCNxLEAST64 SCNx64 - -# define SCNdFAST8 SCNd8 -# define SCNiFAST8 SCNi8 -# define SCNoFAST8 SCNo8 -# define SCNuFAST8 SCNu8 -# define SCNxFAST8 SCNx8 - -# define SCNdFAST16 SCNd16 -# define SCNiFAST16 SCNi16 -# define SCNoFAST16 SCNo16 -# define SCNuFAST16 SCNu16 -# define SCNxFAST16 SCNx16 - -# define SCNdFAST32 SCNd32 -# define SCNiFAST32 SCNi32 -# define SCNoFAST32 SCNo32 -# define SCNuFAST32 SCNu32 -# define SCNxFAST32 SCNx32 - -# define SCNdFAST64 SCNd64 -# define SCNiFAST64 SCNi64 -# define SCNoFAST64 SCNo64 -# define SCNuFAST64 SCNu64 -# define SCNxFAST64 SCNx64 - -# define SCNdPTR "ld" -# define SCNiPTR "li" -# define SCNoPTR "lo" -# define SCNuPTR "lu" -# define SCNxPTR "lx" - -# define SCNdMAX __SCN_MAX_LENGTH_MODIFIER__ "d" -# define SCNiMAX __SCN_MAX_LENGTH_MODIFIER__ "i" -# define SCNoMAX __SCN_MAX_LENGTH_MODIFIER__ "o" -# define SCNuMAX __SCN_MAX_LENGTH_MODIFIER__ "u" -# define SCNxMAX __SCN_MAX_LENGTH_MODIFIER__ "x" - -#include -#include - -#include <_types.h> -#include - -#include - -__BEGIN_DECLS - -/* 7.8.2.1 */ -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) -extern intmax_t -imaxabs(intmax_t j); - -/* 7.8.2.2 */ -typedef struct { - intmax_t quot; - intmax_t rem; -} imaxdiv_t; - -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) -extern imaxdiv_t -imaxdiv(intmax_t __numer, intmax_t __denom); - -/* 7.8.2.3 */ -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) -extern intmax_t -strtoimax(const char * __restrict __nptr, - char ** __restrict __endptr, - int __base); - -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) -extern uintmax_t -strtoumax(const char * __restrict __nptr, - char ** __restrict __endptr, - int __base); - -/* 7.8.2.4 */ -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) -extern intmax_t -wcstoimax(const wchar_t * __restrict __nptr, - wchar_t ** __restrict __endptr, - int __base); - -__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) -extern uintmax_t -wcstoumax(const wchar_t * __restrict __nptr, - wchar_t ** __restrict __endptr, - int __base); - -/* Poison the following routines if -fshort-wchar is set */ -#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU -#pragma GCC poison wcstoimax wcstoumax -#endif - -__END_DECLS +#include <_inttypes.h> #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -/* - No need to #undef the __*_{8,64}_LENGTH_MODIFIER__ macros; - in fact, you can't #undef them, because later uses of any of - their dependents will *not* then do the intended substitution. - Expansion of a #define like this one: - - #define x IDENT y - - uses the cpp value of IDENT at the location where x is *expanded*, - not where it is #defined. -*/ - -#endif /* !_INTTYPES_H_ */ diff --git a/lib/libc/include/any-macos-any/langinfo.h b/lib/libc/include/any-macos-any/langinfo.h index a7a3b2b53e28..ac0941710a10 100644 --- a/lib/libc/include/any-macos-any/langinfo.h +++ b/lib/libc/include/any-macos-any/langinfo.h @@ -26,95 +26,8 @@ * $FreeBSD: /repoman/r/ncvs/src/include/langinfo.h,v 1.6 2002/09/18 05:54:25 mike Exp $ */ -#ifndef _LANGINFO_H_ -#define _LANGINFO_H_ - -#include <_types.h> -#include <_types/_nl_item.h> - -#define CODESET 0 /* codeset name */ -#define D_T_FMT 1 /* string for formatting date and time */ -#define D_FMT 2 /* date format string */ -#define T_FMT 3 /* time format string */ -#define T_FMT_AMPM 4 /* a.m. or p.m. time formatting string */ -#define AM_STR 5 /* Ante Meridian affix */ -#define PM_STR 6 /* Post Meridian affix */ - -/* week day names */ -#define DAY_1 7 -#define DAY_2 8 -#define DAY_3 9 -#define DAY_4 10 -#define DAY_5 11 -#define DAY_6 12 -#define DAY_7 13 - -/* abbreviated week day names */ -#define ABDAY_1 14 -#define ABDAY_2 15 -#define ABDAY_3 16 -#define ABDAY_4 17 -#define ABDAY_5 18 -#define ABDAY_6 19 -#define ABDAY_7 20 - -/* month names */ -#define MON_1 21 -#define MON_2 22 -#define MON_3 23 -#define MON_4 24 -#define MON_5 25 -#define MON_6 26 -#define MON_7 27 -#define MON_8 28 -#define MON_9 29 -#define MON_10 30 -#define MON_11 31 -#define MON_12 32 - -/* abbreviated month names */ -#define ABMON_1 33 -#define ABMON_2 34 -#define ABMON_3 35 -#define ABMON_4 36 -#define ABMON_5 37 -#define ABMON_6 38 -#define ABMON_7 39 -#define ABMON_8 40 -#define ABMON_9 41 -#define ABMON_10 42 -#define ABMON_11 43 -#define ABMON_12 44 - -#define ERA 45 /* era description segments */ -#define ERA_D_FMT 46 /* era date format string */ -#define ERA_D_T_FMT 47 /* era date and time format string */ -#define ERA_T_FMT 48 /* era time format string */ -#define ALT_DIGITS 49 /* alternative symbols for digits */ - -#define RADIXCHAR 50 /* radix char */ -#define THOUSEP 51 /* separator for thousands */ - -#define YESEXPR 52 /* affirmative response expression */ -#define NOEXPR 53 /* negative response expression */ - -#if (__DARWIN_C_LEVEL > __DARWIN_C_ANSI && __DARWIN_C_LEVEL < 200112L) || __DARWIN_C_LEVEL == __DARWIN_C_FULL -#define YESSTR 54 /* affirmative response for yes/no queries */ -#define NOSTR 55 /* negative response for yes/no queries */ -#endif - -#define CRNCYSTR 56 /* currency symbol */ - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -#define D_MD_ORDER 57 /* month/day order (local extension) */ -#endif - -__BEGIN_DECLS -char *nl_langinfo(nl_item); -__END_DECLS +#include <_langinfo.h> #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* !_LANGINFO_H_ */ diff --git a/lib/libc/include/any-macos-any/libkern/OSAtomic.h b/lib/libc/include/any-macos-any/libkern/OSAtomic.h index ac38f9440903..bf8745203814 100644 --- a/lib/libc/include/any-macos-any/libkern/OSAtomic.h +++ b/lib/libc/include/any-macos-any/libkern/OSAtomic.h @@ -40,6 +40,10 @@ #include +#if __has_include() +#include +#endif + #include "OSAtomicDeprecated.h" #include "OSSpinLockDeprecated.h" #include "OSAtomicQueue.h" diff --git a/lib/libc/include/any-macos-any/libkern/OSAtomicDeprecated.h b/lib/libc/include/any-macos-any/libkern/OSAtomicDeprecated.h index f838a2958745..1d79d51a3254 100644 --- a/lib/libc/include/any-macos-any/libkern/OSAtomicDeprecated.h +++ b/lib/libc/include/any-macos-any/libkern/OSAtomicDeprecated.h @@ -36,6 +36,7 @@ */ #include +#include #if !(defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED) diff --git a/lib/libc/include/any-macos-any/libkern/OSThermalNotification.h b/lib/libc/include/any-macos-any/libkern/OSThermalNotification.h index beeed587d196..60e8c264e491 100644 --- a/lib/libc/include/any-macos-any/libkern/OSThermalNotification.h +++ b/lib/libc/include/any-macos-any/libkern/OSThermalNotification.h @@ -26,6 +26,7 @@ #include #include +#include /* ** OSThermalNotification.h diff --git a/lib/libc/include/any-macos-any/libkern/_OSByteOrder.h b/lib/libc/include/any-macos-any/libkern/_OSByteOrder.h index db7419df0b10..06232695d4c8 100644 --- a/lib/libc/include/any-macos-any/libkern/_OSByteOrder.h +++ b/lib/libc/include/any-macos-any/libkern/_OSByteOrder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2006-2023 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -29,14 +29,6 @@ #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. */ @@ -62,22 +54,12 @@ #if defined(__GNUC__) -#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 - #if defined(__i386__) || defined(__x86_64__) #include #endif #if defined (__arm__) || defined(__arm64__) -#include +#include #endif @@ -94,28 +76,38 @@ #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 +__uint16_t _OSSwapInt16( - uint16_t data + __uint16_t data ) { return __DARWIN_OSSwapConstInt16(data); } __DARWIN_OS_INLINE -uint32_t +__uint32_t _OSSwapInt32( - uint32_t data + __uint32_t data ) { return __DARWIN_OSSwapConstInt32(data); } __DARWIN_OS_INLINE -uint64_t +__uint64_t _OSSwapInt64( - uint64_t data + __uint64_t data ) { return __DARWIN_OSSwapConstInt64(data); diff --git a/lib/libc/include/any-macos-any/libkern/arm/OSByteOrder.h b/lib/libc/include/any-macos-any/libkern/arm/OSByteOrder.h index 0cd44a579bf0..4a6516a0d51b 100644 --- a/lib/libc/include/any-macos-any/libkern/arm/OSByteOrder.h +++ b/lib/libc/include/any-macos-any/libkern/arm/OSByteOrder.h @@ -1,64 +1,41 @@ /* - * Copyright (c) 1999-2007 Apple Inc. All rights reserved. + * Copyright (c) 1999-2023 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 _OS_OSBYTEORDERARM_H #define _OS_OSBYTEORDERARM_H +#if defined (__arm__) || defined(__arm64__) + #include +#include +#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 { @@ -74,7 +51,7 @@ struct _OSUnalignedU64 { } __attribute__((__packed__)); #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -__DARWIN_OS_INLINE +OS_INLINE uint16_t _OSReadSwapInt16( const volatile void * _base, @@ -84,7 +61,7 @@ _OSReadSwapInt16( return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val); } #else -__DARWIN_OS_INLINE +OS_INLINE uint16_t OSReadSwapInt16( const volatile void * _base, @@ -96,7 +73,7 @@ OSReadSwapInt16( #endif #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -__DARWIN_OS_INLINE +OS_INLINE uint32_t _OSReadSwapInt32( const volatile void * _base, @@ -106,7 +83,7 @@ _OSReadSwapInt32( return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val); } #else -__DARWIN_OS_INLINE +OS_INLINE uint32_t OSReadSwapInt32( const volatile void * _base, @@ -118,7 +95,7 @@ OSReadSwapInt32( #endif #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -__DARWIN_OS_INLINE +OS_INLINE uint64_t _OSReadSwapInt64( const volatile void * _base, @@ -128,7 +105,7 @@ _OSReadSwapInt64( return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val); } #else -__DARWIN_OS_INLINE +OS_INLINE uint64_t OSReadSwapInt64( const volatile void * _base, @@ -142,7 +119,7 @@ OSReadSwapInt64( /* Functions for byte reversed stores. */ #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -__DARWIN_OS_INLINE +OS_INLINE void _OSWriteSwapInt16( volatile void * _base, @@ -153,7 +130,7 @@ _OSWriteSwapInt16( ((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data); } #else -__DARWIN_OS_INLINE +OS_INLINE void OSWriteSwapInt16( volatile void * _base, @@ -166,7 +143,7 @@ OSWriteSwapInt16( #endif #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -__DARWIN_OS_INLINE +OS_INLINE void _OSWriteSwapInt32( volatile void * _base, @@ -177,7 +154,7 @@ _OSWriteSwapInt32( ((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data); } #else -__DARWIN_OS_INLINE +OS_INLINE void OSWriteSwapInt32( volatile void * _base, @@ -190,7 +167,7 @@ OSWriteSwapInt32( #endif #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -__DARWIN_OS_INLINE +OS_INLINE void _OSWriteSwapInt64( volatile void * _base, @@ -201,7 +178,7 @@ _OSWriteSwapInt64( ((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data); } #else -__DARWIN_OS_INLINE +OS_INLINE void OSWriteSwapInt64( volatile void * _base, @@ -213,4 +190,6 @@ OSWriteSwapInt64( } #endif +#endif /* defined (__arm__) || defined(__arm64__) */ + #endif /* ! _OS_OSBYTEORDERARM_H */ diff --git a/lib/libc/include/any-macos-any/libkern/arm/_OSByteOrder.h b/lib/libc/include/any-macos-any/libkern/arm/_OSByteOrder.h new file mode 100644 index 000000000000..ad76091822d3 --- /dev/null +++ b/lib/libc/include/any-macos-any/libkern/arm/_OSByteOrder.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2023 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 _OS__OSBYTEORDERARM_H +#define _OS__OSBYTEORDERARM_H + +#if defined (__arm__) || defined(__arm64__) + +#include + +#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 + +/* 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 +} + +#endif /* defined (__arm__) || defined(__arm64__) */ + +#endif /* ! _OS__OSBYTEORDERARM_H */ diff --git a/lib/libc/include/any-macos-any/libkern/i386/OSByteOrder.h b/lib/libc/include/any-macos-any/libkern/i386/OSByteOrder.h index 84c632bb521a..9c2b18891873 100644 --- a/lib/libc/include/any-macos-any/libkern/i386/OSByteOrder.h +++ b/lib/libc/include/any-macos-any/libkern/i386/OSByteOrder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 1999-2023 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -29,6 +29,8 @@ #ifndef _OS_OSBYTEORDERI386_H #define _OS_OSBYTEORDERI386_H +#if defined(__i386__) || defined(__x86_64__) + #include #include #include @@ -109,4 +111,6 @@ OSWriteSwapInt64( *(volatile uint64_t *)((uintptr_t)base + byteOffset) = _OSSwapInt64(data); } +#endif /* defined(__i386__) || defined(__x86_64__) */ + #endif /* ! _OS_OSBYTEORDERI386_H */ diff --git a/lib/libc/include/any-macos-any/libkern/i386/_OSByteOrder.h b/lib/libc/include/any-macos-any/libkern/i386/_OSByteOrder.h index e95c3975d460..8390b56adb77 100644 --- a/lib/libc/include/any-macos-any/libkern/i386/_OSByteOrder.h +++ b/lib/libc/include/any-macos-any/libkern/i386/_OSByteOrder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2012 Apple Inc. All rights reserved. + * Copyright (c) 2006-2023 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -29,6 +29,10 @@ #ifndef _OS__OSBYTEORDERI386_H #define _OS__OSBYTEORDERI386_H +#if defined(__i386__) || defined(__x86_64__) + +#include + #if !defined(__DARWIN_OS_INLINE) # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define __DARWIN_OS_INLINE static inline @@ -101,4 +105,6 @@ _OSSwapInt64( #error Unknown architecture #endif +#endif /* defined(__i386__) || defined(__x86_64__) */ + #endif /* ! _OS__OSBYTEORDERI386_H */ diff --git a/lib/libc/include/any-macos-any/libproc.h b/lib/libc/include/any-macos-any/libproc.h index 18820e9c44ac..adb8ca39fca1 100644 --- a/lib/libc/include/any-macos-any/libproc.h +++ b/lib/libc/include/any-macos-any/libproc.h @@ -129,6 +129,10 @@ 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); +int proc_signal_with_audittoken(audit_token_t *audittoken, int sig); +int proc_terminate_with_audittoken(audit_token_t *audittoken, int *sig); +int proc_signal_delegate(audit_token_t instigator, audit_token_t target, int sig); +int proc_terminate_delegate(audit_token_t instigator, audit_token_t target, int *sig); /* * NO_SMT means that on an SMT CPU, this thread must be scheduled alone, @@ -164,10 +168,6 @@ int proc_setthread_csm(uint32_t flags) __API_AVAILABLE(macos(11.0)); int proc_udata_info(int pid, int flavor, void *buffer, int buffersize); -#if __has_include() -#include -#endif - __END_DECLS #endif /*_LIBPROC_H_ */ diff --git a/lib/libc/include/any-macos-any/mach-o/compact_unwind_encoding.h b/lib/libc/include/any-macos-any/mach-o/compact_unwind_encoding.h index 53b0d1871902..a6f2f6dbc3ff 100644 --- a/lib/libc/include/any-macos-any/mach-o/compact_unwind_encoding.h +++ b/lib/libc/include/any-macos-any/mach-o/compact_unwind_encoding.h @@ -108,7 +108,7 @@ enum { // 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 +// 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. @@ -119,16 +119,16 @@ enum { // UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION contains which registers were // saved and their order. // UNWIND_X86_MODE_STACK_IND: -// A "frameless" (EBP not used as frame pointer) function large constant +// 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 +// 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_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 +// 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. // @@ -233,36 +233,36 @@ enum { // 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 +// 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-2040. The offset/8 +// in a small range in the stack that starts RBP-8 to RBP-2040. The offset/8 // 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. +// 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 +// 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/8 is // encoded in the UNWIND_X86_64_FRAMELESS_STACK_SIZE (max stack size is 2048). // The number of registers saved is encoded in UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT. // UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION contains which registers were -// saved and their order. +// saved and their order. // UNWIND_X86_64_MODE_STACK_IND: -// A "frameless" (RBP not used as frame pointer) function large constant +// 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 +// 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_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 +// 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. // @@ -307,20 +307,20 @@ enum { // This is a standard arm64 prolog where FP/LR are immediately pushed on the // stack, then SP is copied to FP. If there are any non-volatile registers // saved, then are copied into the stack frame in pairs in a contiguous -// range right below the saved FP/LR pair. Any subset of the five X pairs +// range right below the saved FP/LR pair. Any subset of the five X pairs // and four D pairs can be saved, but the memory layout must be in register -// number order. +// number order. // UNWIND_ARM64_MODE_FRAMELESS: -// A "frameless" leaf function, where FP/LR are not saved. The return address +// A "frameless" leaf function, where FP/LR are not saved. The return address // remains in LR throughout the function. If any non-volatile registers // are saved, they must be pushed onto the stack before any stack space is // allocated for local variables. The stack sized (including any saved -// non-volatile registers) divided by 16 is encoded in the bits +// non-volatile registers) divided by 16 is encoded in the bits // UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK. // UNWIND_ARM64_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 +// 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. // @@ -393,19 +393,19 @@ enum { // // 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 +// 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 +// 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. +// The length and encoding fields are 32-bits. The other are all pointer sized. // // In x86_64 assembly, these entry would look like: // @@ -428,23 +428,23 @@ enum { // .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 +// Notes: There is no need for any labels in 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 +// 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 +// 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. +// 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. +// 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. @@ -458,7 +458,7 @@ enum { // // 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. +// to the page (4096 byte block) containing the unwind info for that function. // #define UNWIND_SECTION_VERSION 1 diff --git a/lib/libc/include/any-macos-any/mach-o/loader.h b/lib/libc/include/any-macos-any/mach-o/loader.h index 8dce41115af7..dc6e11fc0d45 100644 --- a/lib/libc/include/any-macos-any/mach-o/loader.h +++ b/lib/libc/include/any-macos-any/mach-o/loader.h @@ -234,7 +234,12 @@ struct mach_header_64 { the platforms macOS, macCatalyst, iOSSimulator, tvOSSimulator and watchOSSimulator. */ - + +#define MH_IMPLICIT_PAGEZERO 0x10000000 /* main executable has no __PAGEZERO + segment. Instead, loader (xnu) + will load program high and block + out all memory below it. */ + #define MH_DYLIB_IN_CACHE 0x80000000 /* Only for use on dylibs. When this bit is set, the dylib is part of the dyld shared cache, rather than loose in @@ -670,7 +675,7 @@ struct fvmlib_command { }; /* - * Dynamicly linked shared libraries are identified by two things. The + * Dynamically linked shared libraries are identified by two things. The * pathname (the name of the library as found for execution), and the * compatibility version number. The pathname must match and the compatibility * number in the user of the library must be greater than or equal to the @@ -699,6 +704,30 @@ struct dylib_command { struct dylib dylib; /* the library identification */ }; + +/* + * An alternate encoding for: LC_LOAD_DYLIB. + * The flags field contains independent flags DYLIB_USE_* + * First supported in macOS 15, iOS 18. + */ +struct dylib_use_command { + uint32_t cmd; /* LC_LOAD_DYLIB or LC_LOAD_WEAK_DYLIB */ + uint32_t cmdsize; /* overall size, including path */ + uint32_t nameoff; /* == 28, dylibs's path offset */ + uint32_t marker; /* == DYLIB_USE_MARKER */ + uint32_t current_version; /* dylib's current version number */ + uint32_t compat_version; /* dylib's compatibility version number */ + uint32_t flags; /* DYLIB_USE_... flags */ +}; +#define DYLIB_USE_WEAK_LINK 0x01 +#define DYLIB_USE_REEXPORT 0x02 +#define DYLIB_USE_UPWARD 0x04 +#define DYLIB_USE_DELAYED_INIT 0x08 + +#define DYLIB_USE_MARKER 0x1a741800 + + + /* * A dynamically linked shared library may be a subframework of an umbrella * framework. If so it will be linked with "-umbrella umbrella_name" where @@ -1287,6 +1316,8 @@ struct build_tool_version { #define PLATFORM_TVOSSIMULATOR 8 #define PLATFORM_WATCHOSSIMULATOR 9 #define PLATFORM_DRIVERKIT 10 +#define PLATFORM_VISIONOS 11 +#define PLATFORM_VISIONOSSIMULATOR 12 #ifndef __OPEN_SOURCE__ @@ -1299,6 +1330,10 @@ struct build_tool_version { #endif /* __OPEN_SOURCE__ */ +#ifndef __OPEN_SOURCE__ + +#endif /* __OPEN_SOURCE__ */ + /* Known values for the tool field above. */ #define TOOL_CLANG 1 #define TOOL_SWIFT 2 diff --git a/lib/libc/include/any-macos-any/mach-o/nlist.h b/lib/libc/include/any-macos-any/mach-o/nlist.h index 96b0cd5d56cc..2775fb8e60a5 100644 --- a/lib/libc/include/any-macos-any/mach-o/nlist.h +++ b/lib/libc/include/any-macos-any/mach-o/nlist.h @@ -202,7 +202,7 @@ struct nlist_64 { /* * To simplify stripping of objects that use are used with the dynamic link * editor, the static link editor marks the symbols defined an object that are - * referenced by a dynamicly bound object (dynamic shared libraries, bundles). + * referenced by a dynamically bound object (dynamic shared libraries, bundles). * With this marking strip knows not to strip these symbols. */ #define REFERENCED_DYNAMICALLY 0x0010 diff --git a/lib/libc/include/any-macos-any/mach/arm/_structs.h b/lib/libc/include/any-macos-any/mach/arm/_structs.h index e33ac5281e55..a948a45da0c1 100644 --- a/lib/libc/include/any-macos-any/mach/arm/_structs.h +++ b/lib/libc/include/any-macos-any/mach/arm/_structs.h @@ -62,6 +62,12 @@ _STRUCT_ARM_EXCEPTION_STATE64 __uint32_t __esr; /* Exception syndrome */ __uint32_t __exception; /* number of arm exception taken */ }; +#define _STRUCT_ARM_EXCEPTION_STATE64_V2 struct __darwin_arm_exception_state64_v2 +_STRUCT_ARM_EXCEPTION_STATE64_V2 +{ + __uint64_t __far; /* Virtual Fault Address */ + __uint64_t __esr; /* Exception syndrome */ +}; #else /* !__DARWIN_UNIX03 */ #define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64 _STRUCT_ARM_EXCEPTION_STATE64 @@ -70,6 +76,12 @@ _STRUCT_ARM_EXCEPTION_STATE64 __uint32_t esr; /* Exception syndrome */ __uint32_t exception; /* number of arm exception taken */ }; +#define _STRUCT_ARM_EXCEPTION_STATE64_V2 struct arm_exception_state64_v2 +_STRUCT_ARM_EXCEPTION_STATE64_V2 +{ + __uint64_t far; /* Virtual Fault Address */ + __uint64_t esr; /* Exception syndrome */ +}; #endif /* __DARWIN_UNIX03 */ #if __DARWIN_UNIX03 @@ -241,6 +253,12 @@ _STRUCT_ARM_THREAD_STATE64 ptrauth_key_function_pointer, 0)) : __f); \ __tsp->__opaque_flags &= \ ~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC; }) +/* Set pc field of arm_thread_state64_t to an already signed function pointer */ +#define __darwin_arm_thread_state64_set_pc_presigned_fptr(ts, presigned_fptr) \ + __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + __typeof__(presigned_fptr) __f = (presigned_fptr); __tsp->__opaque_pc = __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); \ @@ -295,6 +313,12 @@ _STRUCT_ARM_THREAD_STATE64 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; }) +/* Set lr field of arm_thread_state64_t to an already signed function pointer */ +#define __darwin_arm_thread_state64_set_lr_presigned_fptr(ts, presigned_fptr) \ + __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \ + __typeof__(presigned_fptr) __f = (presigned_fptr); __tsp->__opaque_lr = __f; \ + __tsp->__opaque_flags &= \ + ~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR & ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_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); \ @@ -368,6 +392,9 @@ _STRUCT_ARM_THREAD_STATE64 /* 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)) +/* Set pc field of arm_thread_state64_t to an already signed function pointer */ +#define __darwin_arm_thread_state64_set_pc_presigned_fptr(ts, presigned_fptr) \ + ((ts).__opaque_pc = (presigned_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)) @@ -377,6 +404,9 @@ _STRUCT_ARM_THREAD_STATE64 /* 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)) +/* Set lr field of arm_thread_state64_t to a presigned function pointer */ +#define __darwin_arm_thread_state64_set_lr_presigned_fptr(ts, presigned_fptr) \ + ((ts).__opaque_lr = (presigned_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)) @@ -405,6 +435,9 @@ _STRUCT_ARM_THREAD_STATE64 /* 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)) +/* Set pc field of arm_thread_state64_t to an already signed function pointer */ +#define __darwin_arm_thread_state64_set_pc_presigned_fptr(ts, presigned_fptr) \ + ((ts).__pc = (uintptr_t)(presigned_fptr)) /* Return lr field of arm_thread_state64_t as a data pointer value */ #define __darwin_arm_thread_state64_get_lr(ts) \ ((ts).__lr) @@ -414,6 +447,9 @@ _STRUCT_ARM_THREAD_STATE64 /* 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)) +/* Set lr field of arm_thread_state64_t to a presigned function pointer */ +#define __darwin_arm_thread_state64_set_lr_presigned_fptr(ts, presigned_fptr) \ + ((ts).__lr = ((uintptr_t)presigned_fptr)) /* Return sp field of arm_thread_state64_t as a data pointer value */ #define __darwin_arm_thread_state64_get_sp(ts) \ ((ts).__sp) @@ -441,6 +477,9 @@ _STRUCT_ARM_THREAD_STATE64 /* 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)) +/* Set pc field of arm_thread_state64_t to an already signed function pointer */ +#define __darwin_arm_thread_state64_set_pc_presigned_fptr(ts, presigned_fptr) \ + ((ts).pc = (uintptr_t)(presigned_fptr)) /* Return lr field of arm_thread_state64_t as a data pointer value */ #define __darwin_arm_thread_state64_get_lr(ts) \ ((ts).lr) @@ -450,6 +489,9 @@ _STRUCT_ARM_THREAD_STATE64 /* 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)) +/* Set lr field of arm_thread_state64_t to a presigned function pointer */ +#define __darwin_arm_thread_state64_set_lr_presigned_fptr(ts, presigned_fptr) \ + ((ts).lr = ((uintptr_t)presigned_fptr)) /* Return sp field of arm_thread_state64_t as a data pointer value */ #define __darwin_arm_thread_state64_get_sp(ts) \ ((ts).sp) diff --git a/lib/libc/include/any-macos-any/mach/arm/exception.h b/lib/libc/include/any-macos-any/mach/arm/exception.h index f918455bb7a4..70308cf74bdf 100644 --- a/lib/libc/include/any-macos-any/mach/arm/exception.h +++ b/lib/libc/include/any-macos-any/mach/arm/exception.h @@ -47,6 +47,7 @@ */ #define EXC_ARM_UNDEFINED 1 /* Undefined */ +#define EXC_ARM_SME_DISALLOWED 2 /* Current thread state prohibits use of SME resources */ /* * EXC_ARITHMETIC @@ -71,6 +72,7 @@ #define EXC_ARM_SWP 0x104 /* SWP instruction */ #define EXC_ARM_PAC_FAIL 0x105 /* PAC authentication failure */ + /* * EXC_BREAKPOINT */ diff --git a/lib/libc/include/any-macos-any/mach/arm/thread_status.h b/lib/libc/include/any-macos-any/mach/arm/thread_status.h index 3585831b6f55..0cc15f58b4db 100644 --- a/lib/libc/include/any-macos-any/mach/arm/thread_status.h +++ b/lib/libc/include/any-macos-any/mach/arm/thread_status.h @@ -60,6 +60,7 @@ #define ARM_EXCEPTION_STATE64 7 // ARM_THREAD_STATE_LAST 8 /* legacy */ #define ARM_THREAD_STATE32 9 +#define ARM_EXCEPTION_STATE64_V2 10 /* API */ @@ -73,6 +74,8 @@ #define ARM_PAGEIN_STATE 27 +#define THREAD_STATE_FLAVORS 29 /* This must be updated to 1 more than the highest numerical state flavor */ + #ifndef ARM_STATE_FLAVOR_IS_OTHER_VALID #define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0 #endif @@ -91,6 +94,7 @@ (x == ARM_THREAD_STATE32) || \ (x == ARM_THREAD_STATE64) || \ (x == ARM_EXCEPTION_STATE64) || \ + (x == ARM_EXCEPTION_STATE64_V2) || \ (x == ARM_NEON_STATE) || \ (x == ARM_NEON_STATE64) || \ (x == ARM_DEBUG_STATE32) || \ @@ -123,6 +127,9 @@ typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t; /* 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) +/* Set pc field of arm_thread_state64_t to an already signed function pointer */ +#define arm_thread_state64_set_pc_presigned_fptr(ts, fptr) \ + __darwin_arm_thread_state64_set_pc_presigned_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) @@ -134,6 +141,9 @@ typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t; /* 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) +/* Set lr field of arm_thread_state64_t to an already signed function pointer */ +#define arm_thread_state64_set_lr_presigned_fptr(ts, fptr) \ + __darwin_arm_thread_state64_set_lr_presigned_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) @@ -182,6 +192,7 @@ 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_EXCEPTION_STATE64_V2 arm_exception_state64_v2_t; typedef _STRUCT_ARM_DEBUG_STATE32 arm_debug_state32_t; typedef _STRUCT_ARM_DEBUG_STATE64 arm_debug_state64_t; @@ -209,6 +220,9 @@ typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_debug_state_t; #define ARM_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \ (sizeof (arm_exception_state64_t)/sizeof(uint32_t))) +#define ARM_EXCEPTION_STATE64_V2_COUNT ((mach_msg_type_number_t) \ + (sizeof (arm_exception_state64_v2_t)/sizeof(uint32_t))) + #define ARM_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \ (sizeof (arm_debug_state_t)/sizeof(uint32_t))) diff --git a/lib/libc/include/any-macos-any/mach/arm/vm_param.h b/lib/libc/include/any-macos-any/mach/arm/vm_param.h index 502d37fb94e4..def832c752f5 100644 --- a/lib/libc/include/any-macos-any/mach/arm/vm_param.h +++ b/lib/libc/include/any-macos-any/mach/arm/vm_param.h @@ -87,6 +87,11 @@ #define MACH_VM_MIN_ADDRESS_RAW 0x0ULL #define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL +/* + * `MACH_VM_MAX_ADDRESS` is exported to user space, but we don't want this + * larger value for `MACH_VM_MAX_ADDRESS` to be exposed outside the kernel. + */ + #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) diff --git a/lib/libc/include/any-macos-any/mach/clock_types.h b/lib/libc/include/any-macos-any/mach/clock_types.h index 9b3d49a94b78..6db3b01f1f1a 100644 --- a/lib/libc/include/any-macos-any/mach/clock_types.h +++ b/lib/libc/include/any-macos-any/mach/clock_types.h @@ -50,7 +50,7 @@ */ typedef int alarm_type_t; /* alarm time type */ typedef int sleep_type_t; /* sleep time type */ -typedef int clock_id_t; /* clock identification type */ +typedef int clock_id_t; /* clock identification type */ typedef int clock_flavor_t; /* clock flavor type */ typedef int *clock_attr_t; /* clock attribute type */ typedef int clock_res_t; /* clock resolution type */ @@ -60,7 +60,7 @@ typedef int clock_res_t; /* clock resolution type */ */ struct mach_timespec { unsigned int tv_sec; /* seconds */ - clock_res_t tv_nsec; /* nanoseconds */ + clock_res_t tv_nsec; /* nanoseconds */ }; typedef struct mach_timespec mach_timespec_t; @@ -86,39 +86,39 @@ typedef struct mach_timespec mach_timespec_t; #define NSEC_PER_SEC 1000000000ull /* nanoseconds per second */ #define NSEC_PER_MSEC 1000000ull /* nanoseconds per millisecond */ -#define BAD_MACH_TIMESPEC(t) \ +#define BAD_MACH_TIMESPEC(t) \ ((t)->tv_nsec < 0 || (t)->tv_nsec >= (long)NSEC_PER_SEC) /* t1 <=> t2, also (t1 - t2) in nsec with max of +- 1 sec */ -#define CMP_MACH_TIMESPEC(t1, t2) \ - ((t1)->tv_sec > (t2)->tv_sec ? (long) +NSEC_PER_SEC : \ - ((t1)->tv_sec < (t2)->tv_sec ? (long) -NSEC_PER_SEC : \ +#define CMP_MACH_TIMESPEC(t1, t2) \ + ((t1)->tv_sec > (t2)->tv_sec ? (long) +NSEC_PER_SEC : \ + ((t1)->tv_sec < (t2)->tv_sec ? (long) -NSEC_PER_SEC : \ (t1)->tv_nsec - (t2)->tv_nsec)) /* t1 += t2 */ -#define ADD_MACH_TIMESPEC(t1, t2) \ - do { \ - if (((t1)->tv_nsec += (t2)->tv_nsec) >= (long) NSEC_PER_SEC) { \ - (t1)->tv_nsec -= (long) NSEC_PER_SEC; \ - (t1)->tv_sec += 1; \ - } \ - (t1)->tv_sec += (t2)->tv_sec; \ +#define ADD_MACH_TIMESPEC(t1, t2) \ + do { \ + if (((t1)->tv_nsec += (t2)->tv_nsec) >= (long) NSEC_PER_SEC) { \ + (t1)->tv_nsec -= (long) NSEC_PER_SEC; \ + (t1)->tv_sec += 1; \ + } \ + (t1)->tv_sec += (t2)->tv_sec; \ } while (0) /* t1 -= t2 */ -#define SUB_MACH_TIMESPEC(t1, t2) \ - do { \ - if (((t1)->tv_nsec -= (t2)->tv_nsec) < 0) { \ - (t1)->tv_nsec += (long) NSEC_PER_SEC; \ - (t1)->tv_sec -= 1; \ - } \ - (t1)->tv_sec -= (t2)->tv_sec; \ +#define SUB_MACH_TIMESPEC(t1, t2) \ + do { \ + if (((t1)->tv_nsec -= (t2)->tv_nsec) < 0) { \ + (t1)->tv_nsec += (long) NSEC_PER_SEC; \ + (t1)->tv_sec -= 1; \ + } \ + (t1)->tv_sec -= (t2)->tv_sec; \ } while (0) /* * Alarm parameter defines. */ -#define ALRMTYPE 0xff /* type (8-bit field) */ +#define ALRMTYPE 0xff /* type (8-bit field) */ #define TIME_ABSOLUTE 0x00 /* absolute time */ #define TIME_RELATIVE 0x01 /* relative time */ diff --git a/lib/libc/include/any-macos-any/mach/error.h b/lib/libc/include/any-macos-any/mach/error.h index 50c77b9cdad5..e2d851f236a9 100644 --- a/lib/libc/include/any-macos-any/mach/error.h +++ b/lib/libc/include/any-macos-any/mach/error.h @@ -99,6 +99,9 @@ #define err_ipc err_system(0x3) /* old ipc errors */ #define err_mach_ipc err_system(0x4) /* mach-ipc errors */ #define err_dipc err_system(0x7) /* distributed ipc */ +#define err_vm err_system(0x8) /* virtual memory */ +/* err_system(0x37) libkern */ +/* err_system(0x38) iokit */ #define err_local err_system(0x3e) /* user defined errors */ #define err_ipc_compat err_system(0x3f) /* (compatibility) mach-ipc errors */ diff --git a/lib/libc/include/any-macos-any/mach/exception_types.h b/lib/libc/include/any-macos-any/mach/exception_types.h index 5e9e522dc254..877be27374f9 100644 --- a/lib/libc/include/any-macos-any/mach/exception_types.h +++ b/lib/libc/include/any-macos-any/mach/exception_types.h @@ -126,6 +126,11 @@ * and thread identity. */ +#define EXCEPTION_STATE_IDENTITY_PROTECTED 5 +/* Send a catch_exception_raise_state_identity_protected message including protected task + * and thread identity plus the thread state. + */ + #define MACH_EXCEPTION_BACKTRACE_PREFERRED 0x20000000 /* Prefer sending a catch_exception_raise_backtrace message, if applicable */ diff --git a/lib/libc/include/any-macos-any/mach/host_info.h b/lib/libc/include/any-macos-any/mach/host_info.h index 648d25ca7966..63b99bef18aa 100644 --- a/lib/libc/include/any-macos-any/mach/host_info.h +++ b/lib/libc/include/any-macos-any/mach/host_info.h @@ -184,6 +184,7 @@ typedef struct host_priority_info *host_priority_info_t; #define HOST_EXPIRED_TASK_INFO 6 /* Statistics for expired tasks */ + struct host_load_info { integer_t avenrun[3]; /* scaled by LOAD_SCALE */ integer_t mach_factor[3]; /* scaled by LOAD_SCALE */ diff --git a/lib/libc/include/any-macos-any/mach/host_special_ports.h b/lib/libc/include/any-macos-any/mach/host_special_ports.h index 782f0b075311..101aa7a780e6 100644 --- a/lib/libc/include/any-macos-any/mach/host_special_ports.h +++ b/lib/libc/include/any-macos-any/mach/host_special_ports.h @@ -110,8 +110,10 @@ #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_MANAGEDAPPDISTD_PORT (27 + HOST_MAX_SPECIAL_KERNEL_PORT) +#define HOST_DOUBLEAGENTD_PORT (28 + HOST_MAX_SPECIAL_KERNEL_PORT) -#define HOST_MAX_SPECIAL_PORT HOST_MEMORY_ERROR_PORT +#define HOST_MAX_SPECIAL_PORT HOST_DOUBLEAGENTD_PORT /* MAX = last since rdar://59872249 */ /* obsolete name */ @@ -288,6 +290,18 @@ #define host_set_memory_error_port(host, port) \ (host_set_special_port((host), HOST_MEMORY_ERROR_PORT, (port))) +#define host_get_managedappdistd_port(host, port) \ + (host_get_special_port((host), \ + HOST_LOCAL_NODE, HOST_MANAGEDAPPDISTD_PORT, (port))) +#define host_set_managedappdistd_port(host, port) \ + (host_set_special_port((host), HOST_MANAGEDAPPDISTD_PORT, (port))) + +#define host_get_doubleagentd_port(host, port) \ + (host_get_special_port((host), \ + HOST_LOCAL_NODE, HOST_DOUBLEAGENTD_PORT, (port))) +#define host_set_doubleagentd_port(host, port) \ + (host_set_special_port((host), HOST_DOUBLEAGENTD_PORT, (port))) + /* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences. * All lookups go through send_resource_violation() */ diff --git a/lib/libc/include/any-macos-any/mach/i386/thread_status.h b/lib/libc/include/any-macos-any/mach/i386/thread_status.h index 6500bdbb0215..32ff4e7a7411 100644 --- a/lib/libc/include/any-macos-any/mach/i386/thread_status.h +++ b/lib/libc/include/any-macos-any/mach/i386/thread_status.h @@ -125,6 +125,7 @@ #define x86_THREAD_FULL_STATE64 23 #define x86_INSTRUCTION_STATE 24 #define x86_LAST_BRANCH_STATE 25 +#define THREAD_STATE_FLAVORS 26 /* This must be updated to 1 more than the highest numerical state flavor */ /* * Largest state on this machine: diff --git a/lib/libc/include/any-macos-any/mach/machine.h b/lib/libc/include/any-macos-any/mach/machine.h index 8db950c15757..755d7fd0b167 100644 --- a/lib/libc/include/any-macos-any/mach/machine.h +++ b/lib/libc/include/any-macos-any/mach/machine.h @@ -118,10 +118,11 @@ 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 */ +/* skip ((cpu_type_t) 20) */ +/* skip ((cpu_type_t) 21) */ +/* skip ((cpu_type_t) 22) */ +/* skip ((cpu_type_t) 23) */ +/* skip ((cpu_type_t) 24) */ /* * Machine subtypes (these are defined here, instead of in a machine @@ -349,6 +350,7 @@ typedef integer_t cpu_threadtype_t; #define CPU_SUBTYPE_ARM64_32_ALL ((cpu_subtype_t) 0) #define CPU_SUBTYPE_ARM64_32_V8 ((cpu_subtype_t) 1) + #endif /* !__ASSEMBLER__ */ /* @@ -396,7 +398,13 @@ typedef integer_t cpu_threadtype_t; #define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3 #define CPUFAMILY_ARM_BLIZZARD_AVALANCHE 0xda33d83d #define CPUFAMILY_ARM_EVEREST_SAWTOOTH 0x8765edea +#define CPUFAMILY_ARM_IBIZA 0xfa33415e +#define CPUFAMILY_ARM_PALMA 0x72015832 #define CPUFAMILY_ARM_COLL 0x2876f5b5 +#define CPUFAMILY_ARM_LOBOS 0x5f4dea93 +#define CPUFAMILY_ARM_DONAN 0x6f5129ac +#define CPUFAMILY_ARM_TAHITI 0x75d4acb9 +#define CPUFAMILY_ARM_TUPAI 0x204526d0 /* Described in rdar://64125549 */ #define CPUSUBFAMILY_UNKNOWN 0 diff --git a/lib/libc/include/any-macos-any/mach/memory_object_types.h b/lib/libc/include/any-macos-any/mach/memory_object_types.h index a6bc3ceff82f..1a9f7b3627f7 100644 --- a/lib/libc/include/any-macos-any/mach/memory_object_types.h +++ b/lib/libc/include/any-macos-any/mach/memory_object_types.h @@ -279,6 +279,7 @@ typedef struct memory_object_attr_info memory_object_attr_info_data_t; & 0xFF000000) | ((flags) & 0xFFFFFF)); /* leave room for vm_prot bits (0xFF ?) */ +#define MAP_MEM_PROT_MASK 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 */ diff --git a/lib/libc/include/any-macos-any/mach/message.h b/lib/libc/include/any-macos-any/mach/message.h index fcc99c075ecc..78d98c0d8b6c 100644 --- a/lib/libc/include/any-macos-any/mach/message.h +++ b/lib/libc/include/any-macos-any/mach/message.h @@ -71,8 +71,10 @@ #ifndef _MACH_MESSAGE_H_ #define _MACH_MESSAGE_H_ +#include #include #include +#include /* user_addr_t */ #include #include #include @@ -81,6 +83,9 @@ #include #include #include +#if __has_feature(ptrauth_calls) +#include +#endif /* * The timeout mechanism uses mach_msg_timeout_t values, @@ -281,6 +286,8 @@ typedef unsigned int mach_msg_descriptor_type_t; #define MACH_MSG_DESCRIPTOR_MAX MACH_MSG_GUARDED_PORT_DESCRIPTOR +#define __ipc_desc_sign(d) + #pragma pack(push, 4) typedef struct { @@ -292,7 +299,6 @@ 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; unsigned int pad2 : 16; mach_msg_type_name_t disposition : 8; @@ -319,7 +325,7 @@ typedef struct { } mach_msg_ool_descriptor64_t; typedef struct { - void* address; + void *address; #if !defined(__LP64__) mach_msg_size_t size; #endif @@ -351,7 +357,7 @@ typedef struct { } mach_msg_ool_ports_descriptor64_t; typedef struct { - void* address; + void *address; #if !defined(__LP64__) mach_msg_size_t count; #endif @@ -398,7 +404,7 @@ typedef struct { * appropriate in LP64 mode because not all descriptors * are of the same size in that environment. */ -typedef union{ +typedef union { mach_msg_port_descriptor_t port; mach_msg_ool_descriptor_t out_of_line; mach_msg_ool_ports_descriptor_t ool_ports; @@ -667,6 +673,10 @@ typedef natural_t mach_msg_type_number_t; (((x) >= MACH_MSG_TYPE_MOVE_SEND) && \ ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE)) +#define MACH_MSG_TYPE_PORT_ANY_SEND_ONCE(x) \ + (((x) == MACH_MSG_TYPE_MOVE_SEND_ONCE) || \ + ((x) == MACH_MSG_TYPE_MAKE_SEND_ONCE)) + #define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \ (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \ ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE)) diff --git a/lib/libc/include/any-macos-any/mach/port.h b/lib/libc/include/any-macos-any/mach/port.h index 891f5933608b..b96ff9d3b68d 100644 --- a/lib/libc/include/any-macos-any/mach/port.h +++ b/lib/libc/include/any-macos-any/mach/port.h @@ -195,40 +195,37 @@ typedef natural_t mach_port_right_t; #define MACH_PORT_RIGHT_LABELH ((mach_port_right_t) 5) /* obsolete right */ #define MACH_PORT_RIGHT_NUMBER ((mach_port_right_t) 6) /* right not implemented */ +#define MACH_PORT_TYPE(right) \ + ((mach_port_type_t)(((mach_port_type_t) 1) \ + << ((right) + ((mach_port_right_t) 16)))) typedef natural_t mach_port_type_t; typedef mach_port_type_t *mach_port_type_array_t; -#define MACH_PORT_TYPE(right) \ - ((mach_port_type_t)(((mach_port_type_t) 1) \ - << ((right) + ((mach_port_right_t) 16)))) -#define MACH_PORT_TYPE_NONE ((mach_port_type_t) 0L) -#define MACH_PORT_TYPE_SEND MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND) -#define MACH_PORT_TYPE_RECEIVE MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE) -#define MACH_PORT_TYPE_SEND_ONCE MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE) -#define MACH_PORT_TYPE_PORT_SET MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET) -#define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME) -#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */ - +#define MACH_PORT_TYPE_NONE ((mach_port_type_t) 0L) +#define MACH_PORT_TYPE_SEND MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND) +#define MACH_PORT_TYPE_RECEIVE MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE) +#define MACH_PORT_TYPE_SEND_ONCE MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE) +#define MACH_PORT_TYPE_PORT_SET MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET) +#define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME) +#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */ +/* Dummy type bits that mach_port_type/mach_port_names can return. */ +#define MACH_PORT_TYPE_DNREQUEST 0x80000000 +#define MACH_PORT_TYPE_SPREQUEST 0x40000000 +#define MACH_PORT_TYPE_SPREQUEST_DELAYED 0x20000000 /* Convenient combinations. */ #define MACH_PORT_TYPE_SEND_RECEIVE \ - (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE) + (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE) #define MACH_PORT_TYPE_SEND_RIGHTS \ - (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE) + (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE) #define MACH_PORT_TYPE_PORT_RIGHTS \ - (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE) + (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE) #define MACH_PORT_TYPE_PORT_OR_DEAD \ - (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME) + (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME) #define MACH_PORT_TYPE_ALL_RIGHTS \ - (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET) - -/* Dummy type bits that mach_port_type/mach_port_names can return. */ - -#define MACH_PORT_TYPE_DNREQUEST 0x80000000 -#define MACH_PORT_TYPE_SPREQUEST 0x40000000 -#define MACH_PORT_TYPE_SPREQUEST_DELAYED 0x20000000 + (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET) /* User-references for capabilities. */ @@ -368,7 +365,7 @@ typedef struct mach_service_port_info * mach_service_port_info_t; #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. */ -#define MPO_PROVISIONAL_ID_PROT_OPTOUT 0x8000 /* Opted out of EXCEPTION_IDENTITY_PROTECTED violation for now */ +#define MPO_EXCEPTION_PORT 0x8000 /* Used for hardened exceptions - immovable */ /* @@ -404,6 +401,7 @@ enum mach_port_guard_exception_codes { kGUARD_EXC_INVALID_OPTIONS = 3, kGUARD_EXC_SET_CONTEXT = 4, kGUARD_EXC_THREAD_SET_STATE = 5, + kGUARD_EXC_EXCEPTION_BEHAVIOR_ENFORCE= 6, kGUARD_EXC_UNGUARDED = 1u << 3, kGUARD_EXC_INCORRECT_GUARD = 1u << 4, kGUARD_EXC_IMMOVABLE = 1u << 5, @@ -427,7 +425,6 @@ enum mach_port_guard_exception_codes { kGUARD_EXC_MOD_REFS_NON_FATAL = 1u << 21, kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22, kGUARD_EXC_REQUIRE_REPLY_PORT_SEMANTICS = 1u << 23, - kGUARD_EXC_EXCEPTION_BEHAVIOR_ENFORCE = 1u << 24, }; #define MAX_FATAL_kGUARD_EXC_CODE (1u << 7) diff --git a/lib/libc/include/any-macos-any/mach/task.h b/lib/libc/include/any-macos-any/mach/task.h index c19010e44207..222b9a97e23d 100644 --- a/lib/libc/include/any-macos-any/mach/task.h +++ b/lib/libc/include/any-macos-any/mach/task.h @@ -52,7 +52,7 @@ typedef function_table_entry *function_table_t; #endif /* AUTOTEST */ #ifndef task_MSG_COUNT -#define task_MSG_COUNT 65 +#define task_MSG_COUNT 66 #endif /* task_MSG_COUNT */ #include @@ -933,6 +933,23 @@ kern_return_t task_map_kcdata_object_64 mach_vm_size_t *kcd_size ); +/* Routine task_register_hardened_exception_handler */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +__TVOS_PROHIBITED __WATCHOS_PROHIBITED +kern_return_t task_register_hardened_exception_handler +( + task_t task, + uint32_t signed_pc_key, + exception_mask_t exceptions_allowed, + exception_behavior_t behaviors_allowed, + thread_state_flavor_t flavors_allowed, + mach_port_t new_exception_port +); + __END_DECLS /********************** Caution **************************/ @@ -1035,7 +1052,7 @@ __END_DECLS NDR_record_t NDR; task_flavor_t flavor; mach_msg_type_number_t task_info_inCnt; - integer_t task_info_in[90]; + integer_t task_info_in[94]; } __Request__task_set_info_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -1773,6 +1790,25 @@ __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 new_exception_port; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32_t signed_pc_key; + exception_mask_t exceptions_allowed; + exception_behavior_t behaviors_allowed; + thread_state_flavor_t flavors_allowed; + } __Request__task_register_hardened_exception_handler_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Request__task_subsystem__defined */ /* union of all requests */ @@ -1843,6 +1879,7 @@ union __RequestUnion__task_subsystem { __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; + __Request__task_register_hardened_exception_handler_t Request_task_register_hardened_exception_handler; }; #endif /* !__RequestUnion__task_subsystem__defined */ /* typedefs for all replies */ @@ -1928,7 +1965,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[90]; + integer_t task_info_out[94]; } __Reply__task_info_t __attribute__((unused)); #ifdef __MigPackStructs #pragma pack(pop) @@ -2692,6 +2729,18 @@ union __RequestUnion__task_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; + } __Reply__task_register_hardened_exception_handler_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Reply__task_subsystem__defined */ /* union of all replies */ @@ -2762,6 +2811,7 @@ union __ReplyUnion__task_subsystem { __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; + __Reply__task_register_hardened_exception_handler_t Reply_task_register_hardened_exception_handler; }; #endif /* !__RequestUnion__task_subsystem__defined */ @@ -2829,7 +2879,8 @@ union __ReplyUnion__task_subsystem { { "task_test_sync_upcall", 3461 },\ { "task_set_corpse_forking_behavior", 3462 },\ { "task_test_async_upcall_propagation", 3463 },\ - { "task_map_kcdata_object_64", 3464 } + { "task_map_kcdata_object_64", 3464 },\ + { "task_register_hardened_exception_handler", 3465 } #endif #ifdef __AfterMigUserHeader diff --git a/lib/libc/include/any-macos-any/mach/task_info.h b/lib/libc/include/any-macos-any/mach/task_info.h index cca73f5a6f8c..dce85831891b 100644 --- a/lib/libc/include/any-macos-any/mach/task_info.h +++ b/lib/libc/include/any-macos-any/mach/task_info.h @@ -403,12 +403,21 @@ struct task_vm_info { /* added for rev6 */ int64_t ledger_swapins; + + /* added for rev7 */ + int64_t ledger_tag_neural_nofootprint_total; + int64_t ledger_tag_neural_nofootprint_peak; }; 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_REV6_COUNT TASK_VM_INFO_COUNT +/* + * The capacity of task_info_t in mach_types.defs also needs to be adjusted + */ +#define TASK_VM_INFO_REV7_COUNT TASK_VM_INFO_COUNT +#define TASK_VM_INFO_REV6_COUNT /* doesn't include neural total and peak */ \ + ((mach_msg_type_number_t) (TASK_VM_INFO_REV7_COUNT - 4)) #define TASK_VM_INFO_REV5_COUNT /* doesn't include ledger swapins */ \ ((mach_msg_type_number_t) (TASK_VM_INFO_REV6_COUNT - 2)) #define TASK_VM_INFO_REV4_COUNT /* doesn't include decompressions */ \ diff --git a/lib/libc/include/any-macos-any/mach/thread_act.h b/lib/libc/include/any-macos-any/mach/thread_act.h index b06b656b1af9..a82e568143ec 100644 --- a/lib/libc/include/any-macos-any/mach/thread_act.h +++ b/lib/libc/include/any-macos-any/mach/thread_act.h @@ -52,7 +52,7 @@ typedef function_table_entry *function_table_t; #endif /* AUTOTEST */ #ifndef thread_act_MSG_COUNT -#define thread_act_MSG_COUNT 31 +#define thread_act_MSG_COUNT 32 #endif /* thread_act_MSG_COUNT */ #include @@ -493,6 +493,22 @@ kern_return_t thread_get_exception_ports_info exception_flavor_array_t old_flavors ); +/* Routine thread_adopt_exception_handler */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +__TVOS_PROHIBITED __WATCHOS_PROHIBITED +kern_return_t thread_adopt_exception_handler +( + thread_t thread, + mach_port_t exc_port, + exception_mask_t exc_mask, + exception_behavior_t behavior_mask, + thread_state_flavor_t flavor_mask +); + __END_DECLS /********************** Caution **************************/ @@ -905,6 +921,24 @@ __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 exc_port; + /* end of the kernel processed data */ + NDR_record_t NDR; + exception_mask_t exc_mask; + exception_behavior_t behavior_mask; + thread_state_flavor_t flavor_mask; + } __Request__thread_adopt_exception_handler_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Request__thread_act_subsystem__defined */ /* union of all requests */ @@ -942,6 +976,7 @@ union __RequestUnion__thread_act_subsystem { __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; + __Request__thread_adopt_exception_handler_t Request_thread_adopt_exception_handler; }; #endif /* !__RequestUnion__thread_act_subsystem__defined */ /* typedefs for all replies */ @@ -1346,6 +1381,18 @@ 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; + } __Reply__thread_adopt_exception_handler_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack(pop) +#endif #endif /* !__Reply__thread_act_subsystem__defined */ /* union of all replies */ @@ -1383,6 +1430,7 @@ union __ReplyUnion__thread_act_subsystem { __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; + __Reply__thread_adopt_exception_handler_t Reply_thread_adopt_exception_handler; }; #endif /* !__RequestUnion__thread_act_subsystem__defined */ @@ -1417,7 +1465,8 @@ union __ReplyUnion__thread_act_subsystem { { "thread_set_mach_voucher", 3626 },\ { "thread_swap_mach_voucher", 3627 },\ { "thread_convert_thread_state", 3628 },\ - { "thread_get_exception_ports_info", 3630 } + { "thread_get_exception_ports_info", 3630 },\ + { "thread_adopt_exception_handler", 3631 } #endif #ifdef __AfterMigUserHeader diff --git a/lib/libc/include/any-macos-any/mach/vm_behavior.h b/lib/libc/include/any-macos-any/mach/vm_behavior.h index 727980d51e30..1c1cd1f8e352 100644 --- a/lib/libc/include/any-macos-any/mach/vm_behavior.h +++ b/lib/libc/include/any-macos-any/mach/vm_behavior.h @@ -75,5 +75,6 @@ typedef int vm_behavior_t; #define VM_BEHAVIOR_REUSE ((vm_behavior_t) 9) #define VM_BEHAVIOR_CAN_REUSE ((vm_behavior_t) 10) #define VM_BEHAVIOR_PAGEOUT ((vm_behavior_t) 11) +#define VM_BEHAVIOR_ZERO ((vm_behavior_t) 12) /* zero pages without faulting in additional pages */ #endif /*_MACH_VM_BEHAVIOR_H_*/ diff --git a/lib/libc/include/any-macos-any/mach/vm_region.h b/lib/libc/include/any-macos-any/mach/vm_region.h index f6f371fa4435..db2148445662 100644 --- a/lib/libc/include/any-macos-any/mach/vm_region.h +++ b/lib/libc/include/any-macos-any/mach/vm_region.h @@ -71,6 +71,7 @@ typedef int *vm_region_recurse_info_64_t; typedef int vm_region_flavor_t; typedef int vm_region_info_data_t[VM_REGION_INFO_MAX]; + #define VM_REGION_BASIC_INFO_64 9 struct vm_region_basic_info_64 { vm_prot_t protection; diff --git a/lib/libc/include/any-macos-any/mach/vm_statistics.h b/lib/libc/include/any-macos-any/mach/vm_statistics.h index b87b811c5308..a3080233031f 100644 --- a/lib/libc/include/any-macos-any/mach/vm_statistics.h +++ b/lib/libc/include/any-macos-any/mach/vm_statistics.h @@ -352,10 +352,12 @@ enum virtual_memory_guard_exception_codes { #define VM_LEDGER_TAG_UNCHANGED ((int)-1) /* individual bits: */ -#define VM_LEDGER_FLAG_NO_FOOTPRINT (1 << 0) +#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_LEDGER_FLAG_FROM_KERNEL (1 << 2) +#define VM_LEDGER_FLAGS_USER (VM_LEDGER_FLAG_NO_FOOTPRINT | VM_LEDGER_FLAG_NO_FOOTPRINT_FOR_DEBUG) +#define VM_LEDGER_FLAGS_ALL (VM_LEDGER_FLAGS_USER | VM_LEDGER_FLAG_FROM_KERNEL) #define VM_MEMORY_MALLOC 1 #define VM_MEMORY_MALLOC_SMALL 2 diff --git a/lib/libc/include/any-macos-any/machine/_endian.h b/lib/libc/include/any-macos-any/machine/_endian.h new file mode 100644 index 000000000000..9be39e11d7d1 --- /dev/null +++ b/lib/libc/include/any-macos-any/machine/_endian.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2000-2023 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 +#elif defined (__arm__) || defined (__arm64__) +#include +#else +#error architecture not supported +#endif + +#endif /* _BSD_MACHINE__ENDIAN_H_ */ diff --git a/lib/libc/include/any-macos-any/malloc/_malloc.h b/lib/libc/include/any-macos-any/malloc/_malloc.h index e4d15ef472fd..4389be04d14c 100644 --- a/lib/libc/include/any-macos-any/malloc/_malloc.h +++ b/lib/libc/include/any-macos-any/malloc/_malloc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2018-2023 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -32,29 +32,40 @@ #include #include -#include <_types.h> +#if __has_include() #include +#else +#define __need_size_t +#include +#undef __need_size_t +#endif + #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #include #else #define _MALLOC_TYPED(override, type_param_pos) #endif +#include +__ptrcheck_abi_assume_single() + __BEGIN_DECLS -void *malloc(size_t __size) __result_use_check __alloc_size(1) _MALLOC_TYPED(malloc_type_malloc, 1); -void *calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2) _MALLOC_TYPED(malloc_type_calloc, 2); -void free(void *); -void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2) _MALLOC_TYPED(malloc_type_realloc, 2); +void * __sized_by_or_null(__size) malloc(size_t __size) __result_use_check __alloc_size(1) _MALLOC_TYPED(malloc_type_malloc, 1); +void * __sized_by_or_null(__count * __size) calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2) _MALLOC_TYPED(malloc_type_calloc, 2); +void free(void * __unsafe_indexable); +void * __sized_by_or_null(__size) realloc(void * __unsafe_indexable __ptr, size_t __size) __result_use_check __alloc_size(2) _MALLOC_TYPED(malloc_type_realloc, 2); +void * __sized_by_or_null(__size) reallocf(void * __unsafe_indexable __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) _MALLOC_TYPED(malloc_type_valloc, 1); +void * __sized_by_or_null(__size) valloc(size_t __size) __result_use_check __alloc_size(1) _MALLOC_TYPED(malloc_type_valloc, 1); #endif /* !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ -#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) || \ +#if (defined(__DARWIN_C_LEVEL) && defined(__DARWIN_C_FULL) && __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) _MALLOC_TYPED(malloc_type_aligned_alloc, 2) __OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0); +void * __sized_by_or_null(__size) aligned_alloc(size_t __alignment, size_t __size) __result_use_check __alloc_align(1) __alloc_size(2) _MALLOC_TYPED(malloc_type_aligned_alloc, 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) /*__alloc_size(3)*/ _MALLOC_TYPED(malloc_type_posix_memalign, 3) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); +/* rdar://120689514 */ +int posix_memalign(void * __unsafe_indexable *__memptr, size_t __alignment, size_t __size) _MALLOC_TYPED(malloc_type_posix_memalign, 3) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); __END_DECLS diff --git a/lib/libc/include/any-macos-any/malloc/_malloc_type.h b/lib/libc/include/any-macos-any/malloc/_malloc_type.h index 206ed8bb5fd2..666fda5c5919 100644 --- a/lib/libc/include/any-macos-any/malloc/_malloc_type.h +++ b/lib/libc/include/any-macos-any/malloc/_malloc_type.h @@ -24,55 +24,59 @@ #ifndef _MALLOC_UNDERSCORE_MALLOC_TYPE_H_ #define _MALLOC_UNDERSCORE_MALLOC_TYPE_H_ -/* !!!!!!!!!!!!!!!!!!!!! WARNING WARNING WARNING WARNING !!!!!!!!!!!!!!!!!!!!! - * Typed Memory Operations and malloc_type_* functions constitute a private, - * unstable interface. Don't use it, don't depend on it. - * !!!!!!!!!!!!!!!!!!!!! WARNING WARNING WARNING WARNING !!!!!!!!!!!!!!!!!!!!! - */ +#include +__ptrcheck_abi_assume_single() + +typedef unsigned long long malloc_type_id_t; #if defined(__LP64__) /* MALLOC_TARGET_64BIT */ -/* Included from so carefully manage what we include here. */ +// Included from so carefully manage what we include here. #include /* __SPI_AVAILABLE */ -#include /* size_t */ +#if __has_include() +#include +#else +#define __need_size_t +#include +#undef __need_size_t +#endif #include /* __BEGIN_DECLS */ -#define _MALLOC_TYPE_AVAILABILITY __API_UNAVAILABLE(macos, ios, tvos, watchos, visionos) +#define _MALLOC_TYPE_AVAILABILITY __API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0), watchos(10.0), visionos(1.0), driverkit(23.0)) __BEGIN_DECLS /* */ -typedef unsigned long long malloc_type_id_t; - -_MALLOC_TYPE_AVAILABILITY void *malloc_type_malloc(size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(1); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_calloc(size_t count, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(1,2); -_MALLOC_TYPE_AVAILABILITY void malloc_type_free(void *ptr, malloc_type_id_t type_id); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_realloc(void *ptr, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_valloc(size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(1); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_aligned_alloc(size_t alignment, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); -_MALLOC_TYPE_AVAILABILITY int malloc_type_posix_memalign(void **memptr, size_t alignment, size_t size, malloc_type_id_t type_id) /*__alloc_size(3)*/; +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(size) malloc_type_malloc(size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(1); +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(count * size) malloc_type_calloc(size_t count, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(1,2); +_MALLOC_TYPE_AVAILABILITY void malloc_type_free(void * __unsafe_indexable ptr, malloc_type_id_t type_id); +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(size) malloc_type_realloc(void * __unsafe_indexable ptr, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(size) malloc_type_valloc(size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(1); +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(size) malloc_type_aligned_alloc(size_t alignment, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); +/* rdar://120689514 */ +_MALLOC_TYPE_AVAILABILITY int malloc_type_posix_memalign(void * __unsafe_indexable *memptr, size_t alignment, size_t size, malloc_type_id_t type_id) /*__alloc_size(3)*/; /* */ typedef struct _malloc_zone_t malloc_zone_t; -_MALLOC_TYPE_AVAILABILITY void *malloc_type_zone_malloc(malloc_zone_t *zone, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_zone_calloc(malloc_zone_t *zone, size_t count, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2,3); -_MALLOC_TYPE_AVAILABILITY void malloc_type_zone_free(malloc_zone_t *zone, void *ptr, malloc_type_id_t type_id); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_zone_realloc(malloc_zone_t *zone, void *ptr, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(3); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_zone_valloc(malloc_zone_t *zone, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); -_MALLOC_TYPE_AVAILABILITY void *malloc_type_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(3); +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(size) malloc_type_zone_malloc(malloc_zone_t *zone, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(count * size) malloc_type_zone_calloc(malloc_zone_t *zone, size_t count, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2,3); +_MALLOC_TYPE_AVAILABILITY void malloc_type_zone_free(malloc_zone_t *zone, void * __unsafe_indexable ptr, malloc_type_id_t type_id); +_MALLOC_TYPE_AVAILABILITY void * __sized_by_or_null(size) malloc_type_zone_realloc(malloc_zone_t *zone, void * __unsafe_indexable ptr, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(3); +_MALLOC_TYPE_AVAILABILITY void *__sized_by_or_null(size) malloc_type_zone_valloc(malloc_zone_t *zone, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(2); +_MALLOC_TYPE_AVAILABILITY void *__sized_by_or_null(size) malloc_type_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size, malloc_type_id_t type_id) __result_use_check __alloc_size(3); __END_DECLS /* Rewrite enablement */ #if defined(__has_feature) && __has_feature(typed_memory_operations) -#if __has_builtin(__is_target_os) && __is_target_os(ios) +#if __has_builtin(__is_target_os) && (__is_target_os(ios) || __is_target_os(driverkit) || __is_target_os(macos) || (__has_builtin(__is_target_environment) && (__is_target_environment(exclavekit) || __is_target_environment(exclavecore)))) #define _MALLOC_TYPED(override, type_param_pos) __attribute__((typed_memory_operation(override, type_param_pos))) #define _MALLOC_TYPE_ENABLED 1 -#endif +#endif #endif /* defined(__has_feature) && __has_feature(typed_memory_operations) */ #endif /* MALLOC_TARGET_64BIT */ diff --git a/lib/libc/include/any-macos-any/malloc/_platform.h b/lib/libc/include/any-macos-any/malloc/_platform.h new file mode 100644 index 000000000000..98fccd9975dd --- /dev/null +++ b/lib/libc/include/any-macos-any/malloc/_platform.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2023 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 _MALLOC_UNDERSCORE_PLATFORM_H +#define _MALLOC_UNDERSCORE_PLATFORM_H + +#include +__ptrcheck_abi_assume_single() + +#include +#include +#include + +#include +#ifndef __DARWIN_EXTSN +#define __DARWIN_EXTSN(x) +#endif /* __DARWIN_EXTSN */ + +#if __has_include() +#include +#else +typedef int boolean_t; +#endif /* __has_include() */ + +#if __has_include() +#include +#else +typedef int kern_return_t; +#endif /* __has_include() */ + +#if __has_include() +#include +#else +typedef void * __single mach_port_t; +#endif /* __has_include() */ + +#if __has_include() +#include +#else +typedef mach_port_t task_t; +#endif /* __has_include() */ + +#if __has_include() +#include +#else +typedef uint64_t mach_vm_address_t; +typedef uint64_t mach_vm_offset_t; +typedef uint64_t mach_vm_size_t; +typedef uintptr_t vm_offset_t; +typedef vm_offset_t vm_address_t; +typedef uintptr_t vm_size_t; +#endif /* __has_include() */ + +#if __has_include() && !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +#include +#else +#define _MALLOC_TYPED(override, type_param_pos) +#endif + +#endif /* _MALLOC_UNDERSCORE_PLATFORM_H */ diff --git a/lib/libc/include/any-macos-any/malloc/_ptrcheck.h b/lib/libc/include/any-macos-any/malloc/_ptrcheck.h new file mode 100644 index 000000000000..4d001db906d9 --- /dev/null +++ b/lib/libc/include/any-macos-any/malloc/_ptrcheck.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 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_PTRCHECK_H_ +#define _MALLOC_UNDERSCORE_PTRCHECK_H_ + +#if __has_include() +#include +#else +#define __has_ptrcheck 0 +#define __single +#define __unsafe_indexable +#define __counted_by(N) +#define __counted_by_or_null(N) +#define __sized_by(N) +#define __sized_by_or_null(N) +#define __ended_by(E) +#define __terminated_by(T) +#define __null_terminated +#define __ptrcheck_abi_assume_single() +#endif + +#endif /* _MALLOC_UNDERSCORE_PTRCHECK_H_ */ diff --git a/lib/libc/include/any-macos-any/malloc/malloc.h b/lib/libc/include/any-macos-any/malloc/malloc.h index fad36c7ab6cb..477a0022bacc 100644 --- a/lib/libc/include/any-macos-any/malloc/malloc.h +++ b/lib/libc/include/any-macos-any/malloc/malloc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * Copyright (c) 1999-2023 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -24,15 +24,13 @@ #ifndef _MALLOC_MALLOC_H_ #define _MALLOC_MALLOC_H_ -#include -#include -#include +#include +#include #include -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -#include -#else -#define _MALLOC_TYPED(override, type_param_pos) -#endif +#include + +#include +__ptrcheck_abi_assume_single() #if __has_feature(ptrauth_calls) #include @@ -41,19 +39,19 @@ // the zone can be copied). Process-independent because the zone structure may // be in the shared library cache. #define MALLOC_ZONE_FN_PTR(fn) __ptrauth(ptrauth_key_process_independent_code, \ - FALSE, ptrauth_string_discriminator("malloc_zone_fn." #fn)) fn + 0, ptrauth_string_discriminator("malloc_zone_fn." #fn)) fn // Introspection function pointer, address- and type-diversified. // Process-independent because the malloc_introspection_t structure that contains // these pointers may be in the shared library cache. #define MALLOC_INTROSPECT_FN_PTR(fn) __ptrauth(ptrauth_key_process_independent_code, \ - TRUE, ptrauth_string_discriminator("malloc_introspect_fn." #fn)) fn + 1, ptrauth_string_discriminator("malloc_introspect_fn." #fn)) fn // Pointer to the introspection pointer table, type-diversified but not // address-diversified (because the zone can be copied). // Process-independent because the table pointer may be in the shared library cache. #define MALLOC_INTROSPECT_TBL_PTR(ptr) __ptrauth(ptrauth_key_process_independent_data,\ - FALSE, ptrauth_string_discriminator("malloc_introspect_tbl")) ptr + 0, ptrauth_string_discriminator("malloc_introspect_tbl")) ptr #endif // __has_feature(ptrauth_calls) @@ -66,155 +64,393 @@ __BEGIN_DECLS /********* Type definitions ************/ +/* + * Only zone implementors should depend on the layout of this structure; + * Regular callers should use the access functions below + */ typedef struct _malloc_zone_t { - /* Only zone implementors should depend on the layout of this structure; - Regular callers should use the access functions below */ - void *reserved1; /* RESERVED FOR CFAllocator DO NOT USE */ - void *reserved2; /* RESERVED FOR CFAllocator DO NOT USE */ - size_t (* MALLOC_ZONE_FN_PTR(size))(struct _malloc_zone_t *zone, const void *ptr); /* returns the size of a block or 0 if not in this zone; must be fast, especially for negative answers */ - void *(* MALLOC_ZONE_FN_PTR(malloc))(struct _malloc_zone_t *zone, size_t size); - void *(* MALLOC_ZONE_FN_PTR(calloc))(struct _malloc_zone_t *zone, size_t num_items, size_t size); /* same as malloc, but block returned is set to zero */ - void *(* MALLOC_ZONE_FN_PTR(valloc))(struct _malloc_zone_t *zone, size_t size); /* same as malloc, but block returned is set to zero and is guaranteed to be page aligned */ - void (* MALLOC_ZONE_FN_PTR(free))(struct _malloc_zone_t *zone, void *ptr); - void *(* MALLOC_ZONE_FN_PTR(realloc))(struct _malloc_zone_t *zone, void *ptr, size_t size); - void (* MALLOC_ZONE_FN_PTR(destroy))(struct _malloc_zone_t *zone); /* zone is destroyed and all memory reclaimed */ - const char *zone_name; - - /* Optional batch callbacks; these may be NULL */ - unsigned (* MALLOC_ZONE_FN_PTR(batch_malloc))(struct _malloc_zone_t *zone, size_t size, void **results, unsigned num_requested); /* given a size, returns pointers capable of holding that size; returns the number of pointers allocated (maybe 0 or less than num_requested) */ - void (* MALLOC_ZONE_FN_PTR(batch_free))(struct _malloc_zone_t *zone, void **to_be_freed, unsigned num_to_be_freed); /* frees all the pointers in to_be_freed; note that to_be_freed may be overwritten during the process */ - - struct malloc_introspection_t * MALLOC_INTROSPECT_TBL_PTR(introspect); - unsigned version; - - /* aligned memory allocation. The callback may be NULL. Present in version >= 5. */ - void *(* MALLOC_ZONE_FN_PTR(memalign))(struct _malloc_zone_t *zone, size_t alignment, size_t size); - - /* free a pointer known to be in zone and known to have the given size. The callback may be NULL. Present in version >= 6.*/ - void (* MALLOC_ZONE_FN_PTR(free_definite_size))(struct _malloc_zone_t *zone, void *ptr, size_t size); - - /* Empty out caches in the face of memory pressure. The callback may be NULL. Present in version >= 8. */ - size_t (* MALLOC_ZONE_FN_PTR(pressure_relief))(struct _malloc_zone_t *zone, size_t goal); + void *reserved1; /* RESERVED FOR CFAllocator DO NOT USE */ + void *reserved2; /* RESERVED FOR CFAllocator DO NOT USE */ + + /* + * Returns the size of a block or 0 if not in this zone; must be fast, + * especially for negative answers. + */ + size_t (* MALLOC_ZONE_FN_PTR(size))(struct _malloc_zone_t *zone, + const void * __unsafe_indexable ptr); + + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(malloc))( + struct _malloc_zone_t *zone, size_t size); + + /* Same as malloc, but block returned is set to zero */ + void * __sized_by_or_null(num_items * size) (* MALLOC_ZONE_FN_PTR(calloc))( + struct _malloc_zone_t *zone, size_t num_items, size_t size); + + /* Same as malloc, but block returned is guaranteed to be page-aligned */ + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(valloc))( + struct _malloc_zone_t *zone, size_t size); + + void (* MALLOC_ZONE_FN_PTR(free))(struct _malloc_zone_t *zone, + void * __unsafe_indexable ptr); + + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(realloc))( + struct _malloc_zone_t *zone, void * __unsafe_indexable ptr, + size_t size); + + /* Zone is destroyed and all memory reclaimed */ + void (* MALLOC_ZONE_FN_PTR(destroy))(struct _malloc_zone_t *zone); + + const char * __null_terminated zone_name; + + /* Optional batch callbacks; these may be NULL */ /* - * Checks whether an address might belong to the zone. May be NULL. Present in version >= 10. - * False positives are allowed (e.g. the pointer was freed, or it's in zone space that has - * not yet been allocated. False negatives are not allowed. + * Given a size, returns pointers capable of holding that size; returns the + * number of pointers allocated (maybe 0 or less than num_requested) */ - boolean_t (* MALLOC_ZONE_FN_PTR(claimed_address))(struct _malloc_zone_t *zone, void *ptr); + unsigned (* MALLOC_ZONE_FN_PTR(batch_malloc))(struct _malloc_zone_t *zone, + size_t size, + void * __unsafe_indexable * __counted_by(num_requested) results, + unsigned num_requested); + + /* + * Frees all the pointers in to_be_freed; note that to_be_freed may be + * overwritten during the process + */ + void (* MALLOC_ZONE_FN_PTR(batch_free))(struct _malloc_zone_t *zone, + void * __unsafe_indexable * __counted_by(num_to_be_freed) to_be_freed, + unsigned num_to_be_freed); + + struct malloc_introspection_t * MALLOC_INTROSPECT_TBL_PTR(introspect); + unsigned version; + + /* Aligned memory allocation. May be NULL. Present in version >= 5. */ + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(memalign))( + struct _malloc_zone_t *zone, size_t alignment, size_t size); + + /* + * Free a pointer known to be in zone and known to have the given size. + * May be NULL. Present in version >= 6. + */ + void (* MALLOC_ZONE_FN_PTR(free_definite_size))(struct _malloc_zone_t *zone, + void * __sized_by(size) ptr, size_t size); + + /* + * Empty out caches in the face of memory pressure. May be NULL. + * Present in version >= 8. + */ + size_t (* MALLOC_ZONE_FN_PTR(pressure_relief))(struct _malloc_zone_t *zone, + size_t goal); + + /* + * Checks whether an address might belong to the zone. May be NULL. Present + * in version >= 10. False positives are allowed (e.g. the pointer was + * freed, or it's in zone space that has not yet been allocated. False + * negatives are not allowed. + */ + boolean_t (* MALLOC_ZONE_FN_PTR(claimed_address))( + struct _malloc_zone_t *zone, void * __unsafe_indexable ptr); + + /* + * For libmalloc-internal zone 0 implementations only: try to free ptr, + * promising to call find_zone_and_free if it turns out not to belong to us. + * May be present in version >= 13. + */ + void (* MALLOC_ZONE_FN_PTR(try_free_default))(struct _malloc_zone_t *zone, + void * __unsafe_indexable ptr); + + /* + * Memory allocation with an extensible binary flags option. Currently for + * libmalloc-internal zone implementations only - should be NULL otherwise. + * Added in version >= 15. + */ + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(malloc_with_options))( + struct _malloc_zone_t *zone, size_t align, size_t size, + uint64_t options); + + /* + * Typed Memory Operations versions of zone functions. Present in + * version >= 16. + */ + + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(malloc_type_malloc))( + struct _malloc_zone_t *zone, size_t size, malloc_type_id_t type_id); - /* 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); + void * __sized_by_or_null(count * size) (* MALLOC_ZONE_FN_PTR(malloc_type_calloc))( + struct _malloc_zone_t *zone, size_t count, size_t size, + malloc_type_id_t type_id); + + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(malloc_type_realloc))( + struct _malloc_zone_t *zone, void * __unsafe_indexable ptr, + size_t size, malloc_type_id_t type_id); + + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(malloc_type_memalign))( + struct _malloc_zone_t *zone, size_t alignment, size_t size, + malloc_type_id_t type_id); + + /* Must be NULL for non-libmalloc zone implementations */ + void * __sized_by_or_null(size) (* MALLOC_ZONE_FN_PTR(malloc_type_malloc_with_options))( + struct _malloc_zone_t *zone, size_t align, size_t size, uint64_t options, + malloc_type_id_t type_id); } malloc_zone_t; +/*! + * @enum malloc_type_callsite_flags_v0_t + * + * Information about where and how malloc was called + * + * @constant MALLOC_TYPE_CALLSITE_FLAGS_V0_FIXED_SIZE + * Set in malloc_type_summary_v0_t if the call to malloc was called with a fixed + * size. Note that, at present, this bit is set in all callsites where the + * compiler rewrites a call to malloc + * + * @constant MALLOC_TYPE_CALLSITE_FLAGS_V0_ARRAY + * Set in malloc_type_summary_v0_t if the type being allocated is an array, e.g. + * allocated via new[] or calloc(count, size) + */ +typedef enum { + MALLOC_TYPE_CALLSITE_FLAGS_V0_NONE = 0, + MALLOC_TYPE_CALLSITE_FLAGS_V0_FIXED_SIZE = 1 << 0, + MALLOC_TYPE_CALLSITE_FLAGS_V0_ARRAY = 1 << 1, +} malloc_type_callsite_flags_v0_t; + +/*! + * @enum malloc_type_kind_v0_t + * + * @constant MALLOC_TYPE_KIND_V0_OTHER + * Default allocation type, used for most calls to malloc + * + * @constant MALLOC_TYPE_KIND_V0_OBJC + * Marks a type allocated by libobjc + * + * @constant MALLOC_TYPE_KIND_V0_SWIFT + * Marks a type allocated by the Swift runtime + * + * @constant MALLOC_TYPE_KIND_V0_CXX + * Marks a type allocated by the C++ runtime's operator new + */ +typedef enum { + MALLOC_TYPE_KIND_V0_OTHER = 0, + MALLOC_TYPE_KIND_V0_OBJC = 1, + MALLOC_TYPE_KIND_V0_SWIFT = 2, + MALLOC_TYPE_KIND_V0_CXX = 3 +} malloc_type_kind_v0_t; + +/*! + * @struct malloc_type_layout_semantics_v0_t + * + * @field contains_data_pointer + * True if the allocated type or any of its fields is a pointer + * to a data type (i.e. the pointee contains no pointers) + * + * @field contains_struct_pointer + * True if the allocated type or any of its fields is a pointer + * to a struct or union + * + * @field contains_immutable_pointer + * True if the allocated type or any of its fields is a const pointer + * + * @field contains_anonymous_pointer + * True if the allocated type or any of its fields is a pointer + * to something other than a struct or data type + * + * @field is_reference_counted + * True if the allocated type is reference counted + * + * @field contains_generic_data + * True if the allocated type or any of its fields are not pointers + */ +typedef struct { + bool contains_data_pointer : 1; + bool contains_struct_pointer : 1; + bool contains_immutable_pointer : 1; + bool contains_anonymous_pointer : 1; + bool is_reference_counted : 1; + uint16_t reserved_0 : 3; + bool contains_generic_data : 1; + uint16_t reserved_1 : 7; +} malloc_type_layout_semantics_v0_t; + +/*! + * @struct malloc_type_summary_v0_t + * + * @field version + * Versioning field of the type summary. Set to 0 for the current verison. New + * fields can be added where the reserved fields currently are without + * incrementing the version, as long as they are non-breaking. + * + * @field callsite_flags + * Details from the callsite of malloc inferred by the compiler + * + * @field type_kind + * Details about the runtime making the allocation + * + * @field layout_semantics + * Details about what kinds of data are contained in the type being allocated + * + * @discussion + * The reserved fields should not be read from or written to, and may be + * used for additional fields and information in future versions + */ +typedef struct { + uint32_t version : 4; + uint32_t reserved_0 : 2; + malloc_type_callsite_flags_v0_t callsite_flags : 4; + malloc_type_kind_v0_t type_kind : 2; + uint32_t reserved_1 : 4; + malloc_type_layout_semantics_v0_t layout_semantics; +} malloc_type_summary_v0_t; + +/*! + * @union malloc_type_descriptor_v0_t + * + * @field hash + * Hash of the type layout of the allocated type, or if type inference failed, + * the hash of the callsite's file, line and column. The hash allows the + * allocator to disambiguate between different types with the same summary, e.g. + * types that have the same fields in different orders. + * + * @field summary + * Details of the type being allocated + * + * @field type_id + * opaque type used for punning + * + * @discussion + * Use malloc_type_descriptor_v0_t to decode the opaque malloc_type_id_t with + * version == 0 into a malloc_type_summary_v0_t: + * + * + * malloc_type_descriptor_v0_t desc = (malloc_type_descriptor_v0_t){ .type_id = id }; + * + * + * See LLVM documentation for more details + */ +typedef union { + struct { + uint32_t hash; + malloc_type_summary_v0_t summary; + }; + malloc_type_id_t type_id; +} malloc_type_descriptor_v0_t; + /********* Creation and destruction ************/ extern malloc_zone_t *malloc_default_zone(void); - /* The initial zone */ + /* The initial zone */ +#if !0 && !0 extern malloc_zone_t *malloc_create_zone(vm_size_t start_size, unsigned flags); - /* Creates a new zone with default behavior and registers it */ + /* Creates a new zone with default behavior and registers it */ extern void malloc_destroy_zone(malloc_zone_t *zone); - /* Destroys zone and everything it allocated */ + /* Destroys zone and everything it allocated */ +#endif /********* Block creation and manipulation ************/ -extern void *malloc_zone_malloc(malloc_zone_t *zone, size_t size) __alloc_size(2) _MALLOC_TYPED(malloc_type_zone_malloc, 2); - /* Allocates a new pointer of size size; zone must be non-NULL */ +extern void * __sized_by_or_null(size) malloc_zone_malloc(malloc_zone_t *zone, size_t size) __alloc_size(2) _MALLOC_TYPED(malloc_type_zone_malloc, 2); + /* Allocates a new pointer of size size; zone must be non-NULL */ -extern void *malloc_zone_calloc(malloc_zone_t *zone, size_t num_items, size_t size) __alloc_size(2,3) _MALLOC_TYPED(malloc_type_zone_calloc, 3); - /* Allocates a new pointer of size num_items * size; block is cleared; zone must be non-NULL */ +extern void * __sized_by_or_null(num_items * size) malloc_zone_calloc(malloc_zone_t *zone, size_t num_items, size_t size) __alloc_size(2,3) _MALLOC_TYPED(malloc_type_zone_calloc, 3); + /* Allocates a new pointer of size num_items * size; block is cleared; zone must be non-NULL */ -extern void *malloc_zone_valloc(malloc_zone_t *zone, size_t size) __alloc_size(2) _MALLOC_TYPED(malloc_type_zone_valloc, 2); - /* Allocates a new pointer of size size; zone must be non-NULL; Pointer is guaranteed to be page-aligned and block is cleared */ +extern void * __sized_by_or_null(size) malloc_zone_valloc(malloc_zone_t *zone, size_t size) __alloc_size(2) _MALLOC_TYPED(malloc_type_zone_valloc, 2); + /* Allocates a new pointer of size size; zone must be non-NULL; Pointer is guaranteed to be page-aligned and block is cleared */ -extern void malloc_zone_free(malloc_zone_t *zone, void *ptr); - /* Frees pointer in zone; zone must be non-NULL */ +extern void malloc_zone_free(malloc_zone_t *zone, void * __unsafe_indexable ptr); + /* Frees pointer in zone; zone must be non-NULL */ -extern void *malloc_zone_realloc(malloc_zone_t *zone, void *ptr, size_t size) __alloc_size(3) _MALLOC_TYPED(malloc_type_zone_realloc, 3); - /* Enlarges block if necessary; zone must be non-NULL */ +extern void * __sized_by_or_null(size) malloc_zone_realloc(malloc_zone_t *zone, void * __unsafe_indexable ptr, size_t size) __alloc_size(3) _MALLOC_TYPED(malloc_type_zone_realloc, 3); + /* Enlarges block if necessary; zone must be non-NULL */ -extern malloc_zone_t *malloc_zone_from_ptr(const void *ptr); - /* Returns the zone for a pointer, or NULL if not in any zone. - The ptr must have been returned from a malloc or realloc call. */ +extern malloc_zone_t *malloc_zone_from_ptr(const void * __unsafe_indexable ptr); + /* Returns the zone for a pointer, or NULL if not in any zone. + The ptr must have been returned from a malloc or realloc call. */ -extern size_t malloc_size(const void *ptr); - /* Returns size of given ptr, including any padding inserted by the allocator */ +extern size_t malloc_size(const void * __unsafe_indexable ptr); + /* Returns size of given ptr, including any padding inserted by the allocator */ extern size_t malloc_good_size(size_t size); - /* Returns number of bytes greater than or equal to size that can be allocated without padding */ + /* Returns number of bytes greater than or equal to size that can be allocated without padding */ -extern void *malloc_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size) __alloc_size(3) _MALLOC_TYPED(malloc_type_zone_memalign, 3) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); - /* - * Allocates a new pointer of size size whose address is an exact multiple of alignment. - * alignment must be a power of two and at least as large as sizeof(void *). - * zone must be non-NULL. - */ +extern void * __sized_by_or_null(size) malloc_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size) __alloc_align(2) __alloc_size(3) _MALLOC_TYPED(malloc_type_zone_memalign, 3) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); + /* + * Allocates a new pointer of size size whose address is an exact multiple of alignment. + * alignment must be a power of two and at least as large as sizeof(void *). + * zone must be non-NULL. + */ /********* Batch methods ************/ -extern unsigned malloc_zone_batch_malloc(malloc_zone_t *zone, size_t size, void **results, unsigned num_requested); - /* Allocates num blocks of the same size; Returns the number truly allocated (may be 0) */ +#if !0 && !0 +extern unsigned malloc_zone_batch_malloc(malloc_zone_t *zone, size_t size, void * __unsafe_indexable * __counted_by(num_requested) results, unsigned num_requested); + /* Allocates num blocks of the same size; Returns the number truly allocated (may be 0) */ -extern void malloc_zone_batch_free(malloc_zone_t *zone, void **to_be_freed, unsigned num); - /* frees all the pointers in to_be_freed; note that to_be_freed may be overwritten during the process; This function will always free even if the zone has no batch callback */ +extern void malloc_zone_batch_free(malloc_zone_t *zone, void * __unsafe_indexable * __counted_by(num) to_be_freed, unsigned num); + /* frees all the pointers in to_be_freed; note that to_be_freed may be overwritten during the process; This function will always free even if the zone has no batch callback */ +#endif /********* Functions for libcache ************/ +#if !0 && !0 extern malloc_zone_t *malloc_default_purgeable_zone(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); - /* Returns a pointer to the default purgeable_zone. */ + /* Returns a pointer to the default purgeable_zone. */ -extern void malloc_make_purgeable(void *ptr) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); - /* Make an allocation from the purgeable zone purgeable if possible. */ +extern void malloc_make_purgeable(void * __unsafe_indexable ptr) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); + /* Make an allocation from the purgeable zone purgeable if possible. */ -extern int malloc_make_nonpurgeable(void *ptr) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); - /* Makes an allocation from the purgeable zone nonpurgeable. - * Returns zero if the contents were not purged since the last - * call to malloc_make_purgeable, else returns non-zero. */ +extern int malloc_make_nonpurgeable(void * __unsafe_indexable ptr) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); + /* Makes an allocation from the purgeable zone nonpurgeable. + * Returns zero if the contents were not purged since the last + * call to malloc_make_purgeable, else returns non-zero. */ +#endif /********* Functions for zone implementors ************/ +#if !0 && !0 extern void malloc_zone_register(malloc_zone_t *zone); - /* Registers a custom malloc zone; Should typically be called after a - * malloc_zone_t has been filled in with custom methods by a client. See - * malloc_create_zone for creating additional malloc zones with the - * default allocation and free behavior. */ + /* Registers a custom malloc zone; Should typically be called after a + * malloc_zone_t has been filled in with custom methods by a client. See + * malloc_create_zone for creating additional malloc zones with the + * default allocation and free behavior. */ extern void malloc_zone_unregister(malloc_zone_t *zone); - /* De-registers a zone - Should typically be called before calling the zone destruction routine */ + /* De-registers a zone + Should typically be called before calling the zone destruction routine */ +#endif -extern void malloc_set_zone_name(malloc_zone_t *zone, const char *name); - /* Sets the name of a zone */ +extern void malloc_set_zone_name(malloc_zone_t *zone, const char * __null_terminated name); + /* Sets the name of a zone */ extern const char *malloc_get_zone_name(malloc_zone_t *zone); - /* Returns the name of a zone */ + /* Returns the name of a zone */ +#if !0 && !0 size_t malloc_zone_pressure_relief(malloc_zone_t *zone, size_t goal) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); - /* malloc_zone_pressure_relief() advises the malloc subsystem that the process is under memory pressure and - * that the subsystem should make its best effort towards releasing (i.e. munmap()-ing) "goal" bytes from "zone". - * If "goal" is passed as zero, the malloc subsystem will attempt to achieve maximal pressure relief in "zone". - * If "zone" is passed as NULL, all zones are examined for pressure relief opportunities. - * malloc_zone_pressure_relief() returns the number of bytes released. - */ + /* malloc_zone_pressure_relief() advises the malloc subsystem that the process is under memory pressure and + * that the subsystem should make its best effort towards releasing (i.e. munmap()-ing) "goal" bytes from "zone". + * If "goal" is passed as zero, the malloc subsystem will attempt to achieve maximal pressure relief in "zone". + * If "zone" is passed as NULL, all zones are examined for pressure relief opportunities. + * malloc_zone_pressure_relief() returns the number of bytes released. + */ +#endif typedef struct { - vm_address_t address; - vm_size_t size; + vm_address_t address; + vm_size_t size; } vm_range_t; typedef struct malloc_statistics_t { - unsigned blocks_in_use; - size_t size_in_use; - size_t max_size_in_use; /* high water mark of touched memory */ - size_t size_allocated; /* reserved in memory */ + unsigned blocks_in_use; + size_t size_in_use; + size_t max_size_in_use; /* high water mark of touched memory */ + size_t size_allocated; /* reserved in memory */ } malloc_statistics_t; -typedef kern_return_t memory_reader_t(task_t remote_task, vm_address_t remote_address, vm_size_t size, void **local_memory); - /* given a task, "reads" the memory at the given address and size -local_memory: set to a contiguous chunk of memory; validity of local_memory is assumed to be limited (until next call) */ +typedef kern_return_t memory_reader_t(task_t remote_task, vm_address_t remote_address, vm_size_t size, void * __sized_by(size) *local_memory); + /* given a task, "reads" the memory at the given address and size + local_memory: set to a contiguous chunk of memory; validity of local_memory is assumed to be limited (until next call) */ #define MALLOC_PTR_IN_USE_RANGE_TYPE 1 /* for allocated pointers */ #define MALLOC_PTR_REGION_RANGE_TYPE 2 /* for region containing pointers */ @@ -222,102 +458,112 @@ local_memory: set to a contiguous chunk of memory; validity of local_memory is a #define MALLOC_ZONE_SPECIFIC_FLAGS 0xff00 /* bits reserved for zone-specific purposes */ typedef void vm_range_recorder_t(task_t, void *, unsigned type, vm_range_t *, unsigned); - /* given a task and context, "records" the specified addresses */ +/* 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, ...) __printflike(1,2); +typedef void print_task_printer_t(const char * __null_terminated 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 */ size_t (* MALLOC_INTROSPECT_FN_PTR(good_size))(malloc_zone_t *zone, size_t size); boolean_t (* MALLOC_INTROSPECT_FN_PTR(check))(malloc_zone_t *zone); /* Consistency checker */ - void (* MALLOC_INTROSPECT_FN_PTR(print))(malloc_zone_t *zone, boolean_t verbose); /* Prints zone */ - void (* MALLOC_INTROSPECT_FN_PTR(log))(malloc_zone_t *zone, void *address); /* Enables logging of activity */ + void (* MALLOC_INTROSPECT_FN_PTR(print))(malloc_zone_t *zone, boolean_t verbose); /* Prints zone */ + void (* MALLOC_INTROSPECT_FN_PTR(log))(malloc_zone_t *zone, void * __unsafe_indexable address); /* Enables logging of activity */ void (* MALLOC_INTROSPECT_FN_PTR(force_lock))(malloc_zone_t *zone); /* Forces locking zone */ void (* MALLOC_INTROSPECT_FN_PTR(force_unlock))(malloc_zone_t *zone); /* Forces unlocking zone */ void (* MALLOC_INTROSPECT_FN_PTR(statistics))(malloc_zone_t *zone, malloc_statistics_t *stats); /* Fills statistics */ - boolean_t (* MALLOC_INTROSPECT_FN_PTR(zone_locked))(malloc_zone_t *zone); /* Are any zone locks held */ + boolean_t (* MALLOC_INTROSPECT_FN_PTR(zone_locked))(malloc_zone_t *zone); /* Are any zone locks held */ - /* Discharge checking. Present in version >= 7. */ + /* Discharge checking. Present in version >= 7. */ boolean_t (* MALLOC_INTROSPECT_FN_PTR(enable_discharge_checking))(malloc_zone_t *zone); void (* MALLOC_INTROSPECT_FN_PTR(disable_discharge_checking))(malloc_zone_t *zone); - void (* MALLOC_INTROSPECT_FN_PTR(discharge))(malloc_zone_t *zone, void *memory); + void (* MALLOC_INTROSPECT_FN_PTR(discharge))(malloc_zone_t *zone, void * __unsafe_indexable memory); #ifdef __BLOCKS__ - void (* MALLOC_INTROSPECT_FN_PTR(enumerate_discharged_pointers))(malloc_zone_t *zone, void (^report_discharged)(void *memory, void *info)); + void (* MALLOC_INTROSPECT_FN_PTR(enumerate_discharged_pointers))(malloc_zone_t *zone, void (^report_discharged)(void *memory, void *info)); #else - void *enumerate_unavailable_without_blocks; + void *enumerate_unavailable_without_blocks; #endif /* __BLOCKS__ */ void (* MALLOC_INTROSPECT_FN_PTR(reinit_lock))(malloc_zone_t *zone); /* Reinitialize zone locks, called only from atfork_child handler. Present in version >= 9. */ void (* MALLOC_INTROSPECT_FN_PTR(print_task))(task_t task, unsigned level, vm_address_t zone_address, memory_reader_t reader, print_task_printer_t printer); /* debug print for another process. Present in version >= 11. */ void (* MALLOC_INTROSPECT_FN_PTR(task_statistics))(task_t task, vm_address_t zone_address, memory_reader_t reader, malloc_statistics_t *stats); /* Present in version >= 12. */ - unsigned zone_type; /* Identifies the zone type. 0 means unknown/undefined zone type. Present in version >= 14. */ + unsigned zone_type; /* Identifies the zone type. 0 means unknown/undefined zone type. Present in version >= 14. */ } malloc_introspection_t; // The value of "level" when passed to print_task() that corresponds to // verbose passed to print() #define MALLOC_VERBOSE_PRINT_LEVEL 2 -extern void malloc_printf(const char *format, ...); - /* Convenience for logging errors and warnings; - No allocation is performed during execution of this function; - Only understands usual %p %d %s formats, and %y that expresses a number of bytes (5b,10KB,1MB...) - */ +#if !0 && !0 +extern void malloc_printf(const char * __null_terminated format, ...) __printflike(1,2); + /* Convenience for logging errors and warnings; + No allocation is performed during execution of this function; + Only understands usual %p %d %s formats, and %y that expresses a number of bytes (5b,10KB,1MB...) + */ +#endif /********* Functions for performance tools ************/ -extern kern_return_t malloc_get_all_zones(task_t task, memory_reader_t reader, vm_address_t **addresses, unsigned *count); - /* Fills addresses and count with the addresses of the zones in task; - Note that the validity of the addresses returned correspond to the validity of the memory returned by reader */ +#if !0 && !0 +extern kern_return_t malloc_get_all_zones(task_t task, memory_reader_t reader, vm_address_t * __single * __counted_by(*count) addresses, unsigned *count); + /* Fills addresses and count with the addresses of the zones in task; + Note that the validity of the addresses returned correspond to the validity reader */ +#endif /********* Debug helpers ************/ -extern void malloc_zone_print_ptr_info(void *ptr); - /* print to stdout if this pointer is in the malloc heap, free status, and size */ +extern void malloc_zone_print_ptr_info(void * __unsafe_indexable ptr); + /* print to stdout if this pointer is in the malloc heap, free status, and size */ extern boolean_t malloc_zone_check(malloc_zone_t *zone); - /* Checks zone is well formed; if !zone, checks all zones */ + /* Checks zone is well formed; if !zone, checks all zones */ extern void malloc_zone_print(malloc_zone_t *zone, boolean_t verbose); - /* Prints summary on zone; if !zone, prints all zones */ + /* Prints summary on zone; if !zone, prints all zones */ +#if !0 && !0 extern void malloc_zone_statistics(malloc_zone_t *zone, malloc_statistics_t *stats); - /* Fills statistics for zone; if !zone, sums up all zones */ + /* Fills statistics for zone; if !zone, sums up all zones */ -extern void malloc_zone_log(malloc_zone_t *zone, void *address); - /* Controls logging of all activity; if !zone, for all zones; - If address==0 nothing is logged; - If address==-1 all activity is logged; - Else only the activity regarding address is logged */ +extern void malloc_zone_log(malloc_zone_t *zone, void * __unsafe_indexable address); + /* Controls logging of all activity; if !zone, for all zones; + If address==0 nothing is logged; + If address==-1 all activity is logged; + Else only the activity regarding address is logged */ +#endif struct mstats { - size_t bytes_total; - size_t chunks_used; - size_t bytes_used; - size_t chunks_free; - size_t bytes_free; + size_t bytes_total; + size_t chunks_used; + size_t bytes_used; + size_t chunks_free; + size_t bytes_free; }; +#if !0 && !0 extern struct mstats mstats(void); extern boolean_t malloc_zone_enable_discharge_checking(malloc_zone_t *zone) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -/* Increment the discharge checking enabled counter for a zone. Returns true if the zone supports checking, false if it does not. */ + /* Increment the discharge checking enabled counter for a zone. Returns true if the zone supports checking, false if it does not. */ extern void malloc_zone_disable_discharge_checking(malloc_zone_t *zone) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); /* Decrement the discharge checking enabled counter for a zone. */ -extern void malloc_zone_discharge(malloc_zone_t *zone, void *memory) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -/* Register memory that the programmer expects to be freed soon. - zone may be NULL in which case the zone is determined using malloc_zone_from_ptr(). - If discharge checking is off for the zone this function is a no-op. */ - +extern void malloc_zone_discharge(malloc_zone_t *zone, void * __unsafe_indexable memory) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + /* Register memory that the programmer expects to be freed soon. + zone may be NULL in which case the zone is determined using malloc_zone_from_ptr(). + If discharge checking is off for the zone this function is a no-op. */ +#endif + +#if !0 && !0 #ifdef __BLOCKS__ extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void (^report_discharged)(void *memory, void *info)) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -/* Calls report_discharged for each block that was registered using malloc_zone_discharge() but has not yet been freed. - info is used to provide zone defined information about the memory block. - If zone is NULL then the enumeration covers all zones. */ + /* Calls report_discharged for each block that was registered using malloc_zone_discharge() but has not yet been freed. + info is used to provide zone defined information about the memory block. + If zone is NULL then the enumeration covers all zones. */ #else extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); #endif /* __BLOCKS__ */ +#endif /********* Zone version summary ************/ // Version 0, but optional: @@ -347,6 +593,14 @@ extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void // - malloc_zone_t::try_free_default // Version 14: // malloc_introspection_t::zone_type +// Version 15: +// malloc_zone_t::malloc_with_options +// Version 16: +// malloc_zone_t::malloc_type_malloc +// malloc_zone_t::malloc_type_calloc +// malloc_zone_t::malloc_type_realloc +// malloc_zone_t::malloc_type_memalign +// malloc_zone_t::malloc_type_malloc_with_options // These functions are optional and calling them requires two checks: // * Check zone version to ensure zone struct is large enough to include the member. diff --git a/lib/libc/include/any-macos-any/math.h b/lib/libc/include/any-macos-any/math.h index 67bb1f8ef187..804c8199a8c9 100644 --- a/lib/libc/include/any-macos-any/math.h +++ b/lib/libc/include/any-macos-any/math.h @@ -79,7 +79,7 @@ __BEGIN_DECLS #define FP_SUBNORMAL 5 #define FP_SUPERNORMAL 6 /* legacy PowerPC support; this is otherwise unused */ -#if defined __arm64__ || defined __ARM_VFPV4__ +#if defined __arm64__ || defined __aarch64__ || 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 @@ -564,12 +564,12 @@ __API_DEPRECATED("use `NAN` instead", macos(10.0, 10.14)) __API_UNAVAILABLE(ios, * Reentrant variants of lgamma[fl] * ******************************************************************************/ -#ifdef _REENTRANT +#if defined(_REENTRANT) || defined(__swift__) /* 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 */ +#endif /* _REENTRANT || __swift__ */ /****************************************************************************** * Apple extensions to the C standard * @@ -610,6 +610,21 @@ 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)); +/* half precision math functions */ +extern _Float16 __fabsf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __hypotf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __sqrtf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __ceilf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __floorf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __rintf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __roundf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __truncf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __copysignf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __nextafterf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __fmaxf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __fminf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)); +extern _Float16 __fmaf16(_Float16, _Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.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 diff --git a/lib/libc/include/any-macos-any/monetary.h b/lib/libc/include/any-macos-any/monetary.h index a32f404d0e60..c7b2b4d69c74 100644 --- a/lib/libc/include/any-macos-any/monetary.h +++ b/lib/libc/include/any-macos-any/monetary.h @@ -26,20 +26,8 @@ * $FreeBSD: /repoman/r/ncvs/src/include/monetary.h,v 1.7 2002/09/20 08:22:48 mike Exp $ */ -#ifndef _MONETARY_H_ -#define _MONETARY_H_ - -#include -#include <_types.h> -#include -#include - -__BEGIN_DECLS -ssize_t strfmon(char *, size_t, const char *, ...); -__END_DECLS +#include <_monetary.h> #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* !_MONETARY_H_ */ diff --git a/lib/libc/include/any-macos-any/net/if.h b/lib/libc/include/any-macos-any/net/if.h index 23c4e0cfcb8d..d1b9a1e1c530 100644 --- a/lib/libc/include/any-macos-any/net/if.h +++ b/lib/libc/include/any-macos-any/net/if.h @@ -72,6 +72,9 @@ #include #include +#if __has_ptrcheck +#include +#endif #include #include @@ -139,6 +142,7 @@ struct if_clonereq { #define IFCAP_SW_TIMESTAMP 0x01000 /* Time stamping in software */ #define IFCAP_CSUM_PARTIAL 0x02000 /* can offload partial checksum */ #define IFCAP_CSUM_ZERO_INVERT 0x04000 /* can invert 0 to -0 (0xffff) */ +#define IFCAP_LRO_NUM_SEG 0x08000 /* NIC & driver can set the num of segments a LRO-packet is built of */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) @@ -315,6 +319,7 @@ struct ifreq { u_int32_t ifru_route_refcnt; int ifru_cap[2]; u_int32_t ifru_functional_type; + u_int32_t ifru_peer_egress_functional_type; #define IFRTYPE_FUNCTIONAL_UNKNOWN 0 #define IFRTYPE_FUNCTIONAL_LOOPBACK 1 #define IFRTYPE_FUNCTIONAL_WIRED 2 @@ -325,6 +330,8 @@ struct ifreq { #define IFRTYPE_FUNCTIONAL_COMPANIONLINK 7 #define IFRTYPE_FUNCTIONAL_MANAGEMENT 8 #define IFRTYPE_FUNCTIONAL_LAST 8 + u_int8_t ifru_is_directlink; + u_int8_t ifru_is_vpn; } ifr_ifru; #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ diff --git a/lib/libc/include/any-macos-any/net/if_dl.h b/lib/libc/include/any-macos-any/net/if_dl.h index b4701e61e89b..a26369cd65f6 100644 --- a/lib/libc/include/any-macos-any/net/if_dl.h +++ b/lib/libc/include/any-macos-any/net/if_dl.h @@ -65,6 +65,7 @@ #define _NET_IF_DL_H_ #include +#include /* __offsetof() */ #include @@ -89,12 +90,6 @@ /* * Structure of a Link-Level sockaddr: */ -#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 */ @@ -103,7 +98,7 @@ struct sockaddr_dl { 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]; + char sdl_data[12]; /* minimum work area, can be larger; * contains both if name and ll address */ #ifndef __APPLE__ @@ -113,7 +108,7 @@ struct sockaddr_dl { #endif }; -#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) +#define LLADDR(s) ((caddr_t)(s) + __offsetof(struct sockaddr_dl, sdl_data) + (s)->sdl_nlen) diff --git a/lib/libc/include/any-macos-any/net/route.h b/lib/libc/include/any-macos-any/net/route.h index 8476df899aff..af048fec870a 100644 --- a/lib/libc/include/any-macos-any/net/route.h +++ b/lib/libc/include/any-macos-any/net/route.h @@ -83,8 +83,7 @@ struct rt_metrics { u_int32_t rmx_rtt; /* estimated round trip time */ 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 TCP's peer-MSS cache */ + u_int32_t rmx_filler[4]; /* will be used for TCP's peer-MSS cache */ }; /* @@ -102,9 +101,7 @@ struct rt_metrics { #define RTF_DELCLONE 0x80 /* delete cloned route */ #define RTF_CLONING 0x100 /* generate new routes on use */ #define RTF_XRESOLVE 0x200 /* external daemon resolves name */ -#define RTF_LLINFO 0x400 /* DEPRECATED - exists ONLY for backward - * compatibility */ -#define RTF_LLDATA 0x400 /* used by apps to add/del L2 entries */ +#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */ #define RTF_STATIC 0x800 /* manually added */ #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ #define RTF_NOIFREF 0x2000 /* not eligible for RTF_IFREF */ @@ -129,12 +126,6 @@ struct rt_metrics { /* 0x80000000 unassigned */ #define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ -#define RTF_BITS \ - "\020\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE" \ - "\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \ - "\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \ - "\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \ - "\33IFREF\34PROXY\35ROUTER\37GLOBAL" #define IS_DIRECT_HOSTROUTE(rt) \ (((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST) @@ -143,10 +134,16 @@ struct rt_metrics { (((rt)->rt_flags & (RTF_CLONING | RTF_PRCLONING | RTF_HOST | RTF_LLINFO |\ RTF_WASCLONED | RTF_GATEWAY)) ==\ (RTF_HOST | RTF_LLINFO | RTF_WASCLONED)) + +#define IS_LOCALNET_ROUTE(rt) \ + (!((rt)->rt_flags & RTF_LOCAL) && \ + ((((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST) || \ + ((rt)->rt_flags & (RTF_MULTICAST | RTF_BROADCAST)))) + /* * Routing statistics. */ -struct rtstat { +struct rtstat { short rts_badredirect; /* bogus redirect calls */ short rts_dynamic; /* routes created by redirects */ short rts_newgateway; /* routes modified by redirects */ @@ -188,6 +185,10 @@ struct rt_msghdr2 { struct rt_metrics rtm_rmx; /* metrics themselves */ }; +struct rt_msghdr_prelude { + u_short rtm_msglen; /* to skip over non-understood messages */ +}; + #define RTM_VERSION 5 /* Up the ante and ignore older versions */ /* diff --git a/lib/libc/include/any-macos-any/objc/NSObjCRuntime.h b/lib/libc/include/any-macos-any/objc/NSObjCRuntime.h index f8cf08cc6a9a..12976ab7314d 100644 --- a/lib/libc/include/any-macos-any/objc/NSObjCRuntime.h +++ b/lib/libc/include/any-macos-any/objc/NSObjCRuntime.h @@ -6,6 +6,7 @@ #define _OBJC_NSOBJCRUNTIME_H_ #include +#include #include #if __LP64__ || NS_BUILD_32_LIKE_64 diff --git a/lib/libc/include/any-macos-any/objc/objc-api.h b/lib/libc/include/any-macos-any/objc/objc-api.h index c0d6430cc278..fecba99ee284 100644 --- a/lib/libc/include/any-macos-any/objc/objc-api.h +++ b/lib/libc/include/any-macos-any/objc/objc-api.h @@ -301,4 +301,10 @@ # endif #endif +#if __has_attribute(not_tail_called) +# define OBJC_NOT_TAIL_CALLED __attribute__((not_tail_called)) +#else +# define OBJC_NOT_TAIL_CALLED +#endif + #endif diff --git a/lib/libc/include/any-macos-any/objc/objc.h b/lib/libc/include/any-macos-any/objc/objc.h index 7a28afd62316..be232ae2220e 100644 --- a/lib/libc/include/any-macos-any/objc/objc.h +++ b/lib/libc/include/any-macos-any/objc/objc.h @@ -46,6 +46,13 @@ struct objc_object { typedef struct objc_object *id; #endif +/// An opaque type that represents an Objective-C protocol. +#ifdef __OBJC__ +@class Protocol; +#else +typedef struct objc_object Protocol; +#endif + /// An opaque type that represents a method selector. typedef struct objc_selector *SEL; diff --git a/lib/libc/include/any-macos-any/objc/runtime.h b/lib/libc/include/any-macos-any/objc/runtime.h index b5d74e804246..4fe6d1c47f7e 100644 --- a/lib/libc/include/any-macos-any/objc/runtime.h +++ b/lib/libc/include/any-macos-any/objc/runtime.h @@ -54,12 +54,6 @@ typedef struct objc_property *objc_property_t; #endif -#ifdef __OBJC__ -@class Protocol; -#else -typedef struct objc_object Protocol; -#endif - /// Defines a method struct objc_method_description { SEL _Nullable name; /**< The name of the method */ @@ -367,6 +361,7 @@ objc_copyClassList(unsigned int * _Nullable outCount) * */ #define OBJC_DYNAMIC_CLASSES ((const void *)-1) +#ifdef __BLOCKS__ OBJC_EXPORT void objc_enumerateClasses(const void * _Nullable image, const char * _Nullable namePrefix, @@ -375,7 +370,9 @@ objc_enumerateClasses(const void * _Nullable image, 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; + OBJC_REFINED_FOR_SWIFT + OBJC_NOT_TAIL_CALLED; +#endif /* Working with Classes */ @@ -1480,34 +1477,6 @@ objc_copyClassNamesForImage(const char * _Nonnull image, /* Working with Selectors */ -/** - * 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 a Boolean value that indicates whether two selectors are equal. * diff --git a/lib/libc/include/any-macos-any/os/availability.h b/lib/libc/include/any-macos-any/os/availability.h index e91b155ba8a1..8b5682140812 100644 --- a/lib/libc/include/any-macos-any/os/availability.h +++ b/lib/libc/include/any-macos-any/os/availability.h @@ -65,11 +65,19 @@ #define API_TO_BE_DEPRECATED_DRIVERKIT 100000 #endif -#ifndef API_TO_BE_DEPRECATED_XROS -#define API_TO_BE_DEPRECATED_XROS 100000 +#ifndef API_TO_BE_DEPRECATEDC_VISIONOS +#define API_TO_BE_DEPRECATED_VISIONOS 100000 #endif +#ifndef __OPEN_SOURCE__ + +#endif /* __OPEN_SOURCE__ */ + #include +#include +#if __has_include() + #include +#endif @@ -90,8 +98,8 @@ * API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0)) */ - #define API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE7,__API_AVAILABLE6,__API_AVAILABLE5,__API_AVAILABLE4,__API_AVAILABLE3,__API_AVAILABLE2,__API_AVAILABLE1,__API_AVAILABLE0,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,__API_AVAILABLE_BEGIN0,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,__API_AVAILABLE0,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,__API_AVAILABLE_BEGIN0,0)(__VA_ARGS__) #define API_AVAILABLE_END _Pragma("clang attribute pop") /* @@ -111,13 +119,13 @@ * 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_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1,__API_DEPRECATED_MSG0,0,0)(__VA_ARGS__) - #define API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1,__API_DEPRECATED_REP0,0,0)(__VA_ARGS__) + #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,__API_DEPRECATED_MSG0,0,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,__API_DEPRECATED_REP0,0,0)(__VA_ARGS__) - #define API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN7,__API_DEPRECATED_BEGIN6,__API_DEPRECATED_BEGIN5,__API_DEPRECATED_BEGIN4,__API_DEPRECATED_BEGIN3,__API_DEPRECATED_BEGIN2,__API_DEPRECATED_BEGIN1,__API_DEPRECATED_BEGIN0,0,0)(__VA_ARGS__) + #define API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN8,__API_DEPRECATED_BEGIN7,__API_DEPRECATED_BEGIN6,__API_DEPRECATED_BEGIN5,__API_DEPRECATED_BEGIN4,__API_DEPRECATED_BEGIN3,__API_DEPRECATED_BEGIN2,__API_DEPRECATED_BEGIN1,__API_DEPRECATED_BEGIN0,0,0)(__VA_ARGS__) #define API_DEPRECATED_END _Pragma("clang attribute pop") - #define API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_WITH_REPLACEMENT_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN7,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN6,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN5,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN4,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN3,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN2,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN1,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN0,0,0)(__VA_ARGS__) + #define API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_WITH_REPLACEMENT_BEGIN_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN8,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN7,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN6,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN5,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN4,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN3,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN2,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN1,__API_DEPRECATED_WITH_REPLACEMENT_BEGIN0,0,0)(__VA_ARGS__) #define API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop") /* @@ -129,9 +137,9 @@ * 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,__API_UNAVAILABLE0,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,__API_UNAVAILABLE0,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,__API_UNAVAILABLE_BEGIN0,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,__API_UNAVAILABLE_BEGIN0,0)(__VA_ARGS__) #define API_UNAVAILABLE_END _Pragma("clang attribute pop") #endif /* __has_attribute(availability) */ #endif /* #if defined(__has_feature) && defined(__has_attribute) */ @@ -200,6 +208,14 @@ #define SPI_AVAILABLE(...) #endif +#ifndef SPI_AVAILABLE_BEGIN + #define SPI_AVAILABLE_BEGIN(...) +#endif + +#ifndef SPI_AVAILABLE_END + #define SPI_AVAILABLE_END(...) +#endif + #ifndef SPI_DEPRECATED #define SPI_DEPRECATED(...) #endif diff --git a/lib/libc/include/any-macos-any/os/base.h b/lib/libc/include/any-macos-any/os/base.h index 9f473980c3e7..ee47074b7a56 100644 --- a/lib/libc/include/any-macos-any/os/base.h +++ b/lib/libc/include/any-macos-any/os/base.h @@ -246,8 +246,12 @@ #if __has_attribute(__swift_attr__) #define OS_SWIFT_UNAVAILABLE_FROM_ASYNC(msg) \ __attribute__((__swift_attr__("@_unavailableFromAsync(message: \"" msg "\")"))) +#define OS_SWIFT_NONISOLATED __attribute__((__swift_attr__("nonisolated"))) +#define OS_SWIFT_NONISOLATED_UNSAFE __attribute__((__swift_attr__("nonisolated(unsafe)"))) #else #define OS_SWIFT_UNAVAILABLE_FROM_ASYNC(msg) +#define OS_SWIFT_NONISOLATED +#define OS_SWIFT_NONISOLATED_UNSAFE #endif #if __has_attribute(swift_private) diff --git a/lib/libc/include/any-macos-any/os/lock.h b/lib/libc/include/any-macos-any/os/lock.h index 5490a5526ff3..1a26a5f4d294 100644 --- a/lib/libc/include/any-macos-any/os/lock.h +++ b/lib/libc/include/any-macos-any/os/lock.h @@ -195,6 +195,47 @@ OS_UNFAIR_LOCK_AVAILABILITY OS_EXPORT OS_NOTHROW OS_NONNULL_ALL void os_unfair_lock_assert_not_owner(const os_unfair_lock *lock); +/*! + * @typedef os_unfair_lock_flags_t + * + * @const OS_UNFAIR_LOCK_FLAG_ADAPTIVE_SPIN + * This flag allows the caller of os_unfair_lock_lock_with_flags API to spin + * temporarily before blocking, particularly useful when the holder of the + * lock is on core. This should only be used for locks where the protected + * critical section is always extremely short. + */ +OS_REFINED_FOR_SWIFT +OS_OPTIONS(os_unfair_lock_flags, uint32_t, + OS_UNFAIR_LOCK_FLAG_NONE + __API_AVAILABLE(macos(15.0), ios(18.0), + tvos(18.0), watchos(11.0), visionos(2.0)) + OS_SWIFT_UNAVAILABLE("Use OSAllocatedUnfairLock APIs that do not require flags.") + = 0x00000000, + OS_UNFAIR_LOCK_FLAG_ADAPTIVE_SPIN + __API_AVAILABLE(macos(15.0), ios(18.0), + tvos(18.0), watchos(11.0), visionos(2.0)) + OS_SWIFT_UNAVAILABLE("Use OSAllocatedUnfairLockFlags.AdaptiveSpin") + = 0x00040000, +); + +/*! + * @function os_unfair_lock_lock_with_flags + * + * @abstract + * Locks an os_unfair_lock. + * + * @param lock + * Pointer to an os_unfair_lock. + * + * @param flags + * Flags to alter the behavior of the lock. See os_unfair_lock_flags_t. + */ +__API_AVAILABLE(macos(15.0), ios(18.0), tvos(18.0), watchos(11.0), visionos(2.0)) +OS_EXPORT OS_NOTHROW OS_NONNULL_ALL +OS_SWIFT_UNAVAILABLE_FROM_ASYNC("Use OSAllocatedUnfairLock for async-safe scoped locking") +void os_unfair_lock_lock_with_flags(os_unfair_lock_t lock, + os_unfair_lock_flags_t flags); + __END_DECLS OS_ASSUME_NONNULL_END diff --git a/lib/libc/include/any-macos-any/pthread.h b/lib/libc/include/any-macos-any/pthread.h index fa02f41ccbe1..8a15eb8a11bd 100644 --- a/lib/libc/include/any-macos-any/pthread.h +++ b/lib/libc/include/any-macos-any/pthread.h @@ -587,8 +587,8 @@ __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) +__API_AVAILABLE(macos(11.0), ios(17.4)) +__API_UNAVAILABLE(tvos, watchos, driverkit, visionos) int pthread_jit_write_protect_supported_np(void); /*! @@ -691,8 +691,8 @@ typedef int (*pthread_jit_write_callback_t)(void * _Nullable ctx); * 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) +__API_AVAILABLE(macos(11.4), ios(17.4)) +__API_UNAVAILABLE(tvos, watchos, driverkit, visionos) __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); @@ -722,8 +722,8 @@ int pthread_jit_write_with_callback_np( * 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) +__API_AVAILABLE(macos(12.1), ios(17.4)) +__API_UNAVAILABLE(tvos, watchos, driverkit, visionos) void pthread_jit_write_freeze_callbacks_np(void); /*! diff --git a/lib/libc/include/any-macos-any/regex.h b/lib/libc/include/any-macos-any/regex.h index 11f592b3fb6e..799da6b66405 100644 --- a/lib/libc/include/any-macos-any/regex.h +++ b/lib/libc/include/any-macos-any/regex.h @@ -86,132 +86,8 @@ * @(#)regex.h 8.2 (Berkeley) 1/3/94 */ -#ifndef _REGEX_H_ -#define _REGEX_H_ - #include <_regex.h> -/*******************/ -/* regcomp() flags */ -/*******************/ -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define REG_BASIC 0000 /* Basic regular expressions (synonym for 0) */ -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -#define REG_EXTENDED 0001 /* Extended regular expressions */ -#define REG_ICASE 0002 /* Compile ignoring upper/lower case */ -#define REG_NOSUB 0004 /* Compile only reporting success/failure */ -#define REG_NEWLINE 0010 /* Compile for newline-sensitive matching */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define REG_NOSPEC 0020 /* Compile turning off all special characters */ - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ - || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) -#define REG_LITERAL REG_NOSPEC -#endif - -#define REG_PEND 0040 /* Use re_endp as end pointer */ - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ - || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) -#define REG_MINIMAL 0100 /* Compile using minimal repetition */ -#define REG_UNGREEDY REG_MINIMAL -#endif - -#define REG_DUMP 0200 /* Unused */ - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ - || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) -#define REG_ENHANCED 0400 /* Additional (non-POSIX) features */ -#endif -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -/********************/ -/* regerror() flags */ -/********************/ -#define REG_ENOSYS (-1) /* Reserved */ -#define REG_NOMATCH 1 /* regexec() function failed to match */ -#define REG_BADPAT 2 /* invalid regular expression */ -#define REG_ECOLLATE 3 /* invalid collating element */ -#define REG_ECTYPE 4 /* invalid character class */ -#define REG_EESCAPE 5 /* trailing backslash (\) */ -#define REG_ESUBREG 6 /* invalid backreference number */ -#define REG_EBRACK 7 /* brackets ([ ]) not balanced */ -#define REG_EPAREN 8 /* parentheses not balanced */ -#define REG_EBRACE 9 /* braces not balanced */ -#define REG_BADBR 10 /* invalid repetition count(s) */ -#define REG_ERANGE 11 /* invalid character range */ -#define REG_ESPACE 12 /* out of memory */ -#define REG_BADRPT 13 /* repetition-operator operand invalid */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define REG_EMPTY 14 /* Unused */ -#define REG_ASSERT 15 /* Unused */ -#define REG_INVARG 16 /* invalid argument to regex routine */ -#define REG_ILLSEQ 17 /* illegal byte sequence */ - -#define REG_ATOI 255 /* convert name to number (!) */ -#define REG_ITOA 0400 /* convert number to name (!) */ -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -/*******************/ -/* regexec() flags */ -/*******************/ -#define REG_NOTBOL 00001 /* First character not at beginning of line */ -#define REG_NOTEOL 00002 /* Last character not at end of line */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#define REG_STARTEND 00004 /* String start/end in pmatch[0] */ -#define REG_TRACE 00400 /* Unused */ -#define REG_LARGE 01000 /* Unused */ -#define REG_BACKR 02000 /* force use of backref code */ - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \ - || defined(__DRIVERKIT_VERSION_MIN_REQUIRED) -#define REG_BACKTRACKING_MATCHER REG_BACKR -#endif -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -__BEGIN_DECLS -int regcomp(regex_t * __restrict, const char * __restrict, int) __DARWIN_ALIAS(regcomp); -size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t) __cold; -/* - * gcc under c99 mode won't compile "[ __restrict]" by itself. As a workaround, - * a dummy argument name is added. - */ -int regexec(const regex_t * __restrict, const char * __restrict, size_t, - regmatch_t __pmatch[ __restrict], int); -void regfree(regex_t *); - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL - -/* Darwin extensions */ -int regncomp(regex_t * __restrict, const char * __restrict, size_t, int) - __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); -int regnexec(const regex_t * __restrict, const char * __restrict, size_t, - size_t, regmatch_t __pmatch[ __restrict], int) - __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); -int regwcomp(regex_t * __restrict, const wchar_t * __restrict, int) - __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); -int regwexec(const regex_t * __restrict, const wchar_t * __restrict, size_t, - regmatch_t __pmatch[ __restrict], int) - __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); -int regwncomp(regex_t * __restrict, const wchar_t * __restrict, size_t, int) - __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); -int regwnexec(const regex_t * __restrict, const wchar_t * __restrict, - size_t, size_t, regmatch_t __pmatch[ __restrict], int) - __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0); - -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ -__END_DECLS - #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* !_REGEX_H_ */ diff --git a/lib/libc/include/any-macos-any/runetype.h b/lib/libc/include/any-macos-any/runetype.h index b3dcce26fd90..c4fc0a5ff086 100644 --- a/lib/libc/include/any-macos-any/runetype.h +++ b/lib/libc/include/any-macos-any/runetype.h @@ -80,7 +80,7 @@ typedef struct { __darwin_rune_t (*__sgetrune)(const char *, __darwin_size_t, char const **); int (*__sputrune)(__darwin_rune_t, char *, __darwin_size_t, char **); - __darwin_rune_t __invalid_rune; + __darwin_rune_t __invalid_rune; /* Deprecated */ __uint32_t __runetype[_CACHED_RUNES]; __darwin_rune_t __maplower[_CACHED_RUNES]; diff --git a/lib/libc/include/any-macos-any/secure/_common.h b/lib/libc/include/any-macos-any/secure/_common.h index a7acfaa0de44..03181dd30ced 100644 --- a/lib/libc/include/any-macos-any/secure/_common.h +++ b/lib/libc/include/any-macos-any/secure/_common.h @@ -24,6 +24,8 @@ #ifndef _SECURE__COMMON_H_ #define _SECURE__COMMON_H_ +#include <_types.h> + #undef _USE_FORTIFY_LEVEL #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 # if _FORTIFY_SOURCE > 1 diff --git a/lib/libc/include/any-macos-any/secure/_stdio.h b/lib/libc/include/any-macos-any/secure/_stdio.h index c4dc7b23439a..f19e22c628f0 100644 --- a/lib/libc/include/any-macos-any/secure/_stdio.h +++ b/lib/libc/include/any-macos-any/secure/_stdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010 Apple Inc. All rights reserved. + * Copyright (c) 2007, 2010, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * diff --git a/lib/libc/include/any-macos-any/secure/_string.h b/lib/libc/include/any-macos-any/secure/_string.h index f101c134c966..f023af32a165 100644 --- a/lib/libc/include/any-macos-any/secure/_string.h +++ b/lib/libc/include/any-macos-any/secure/_string.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007,2017 Apple Inc. All rights reserved. + * Copyright (c) 2007,2017,2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * diff --git a/lib/libc/include/any-macos-any/secure/_strings.h b/lib/libc/include/any-macos-any/secure/_strings.h index 9069e595914d..384c5068a64a 100644 --- a/lib/libc/include/any-macos-any/secure/_strings.h +++ b/lib/libc/include/any-macos-any/secure/_strings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Apple Inc. All rights reserved. + * Copyright (c) 2017, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -21,7 +21,7 @@ * @APPLE_LICENSE_HEADER_END@ */ -#ifndef _STRINGS_H_ +#ifndef __STRINGS_H_ # error "Never use directly; include instead." #endif diff --git a/lib/libc/include/any-macos-any/simd/base.h b/lib/libc/include/any-macos-any/simd/base.h index 41b0bd271754..7ef1c079fa51 100644 --- a/lib/libc/include/any-macos-any/simd/base.h +++ b/lib/libc/include/any-macos-any/simd/base.h @@ -32,6 +32,7 @@ # endif # if SIMD_COMPILER_HAS_REQUIRED_FEATURES +# define SIMD_CURRENT_LIBRARY_VERSION 6 # if __has_include() && __has_include() # include # include @@ -43,19 +44,27 @@ * do not work; these functions are simply unavailable when targeting older * versions of the library. */ # if TARGET_OS_RTKIT -# define SIMD_LIBRARY_VERSION 5 +# define SIMD_LIBRARY_VERSION SIMD_CURRENT_LIBRARY_VERSION +# elif __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_15_0 || \ + __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_18_0 || \ + __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_11_0 || \ + __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_18_0 || \ + __XR_OS_VERSION_MIN_REQUIRED >= __XROS_2_0 || \ + __BRIDGE_OS_VERSION_MIN_REQUIRED >= __BRIDGEOS_9_0 || \ + __DRIVERKIT_VERSION_MIN_REQUIRED >= __DRIVERKIT_24_0 +# define SIMD_LIBRARY_VERSION 6 # elif __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 || \ + __BRIDGE_OS_VERSION_MIN_REQUIRED >= __BRIDGEOS_7_0 || \ __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 || \ + __BRIDGE_OS_VERSION_MIN_REQUIRED >= __BRIDGEOS_6_0 || \ __DRIVERKIT_VERSION_MIN_REQUIRED >= __DRIVERKIT_21_0 # define SIMD_LIBRARY_VERSION 4 # elif __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_13 || \ @@ -76,14 +85,14 @@ # define SIMD_LIBRARY_VERSION 0 # endif # else /* !__has_include() && __has_include() */ -# define SIMD_LIBRARY_VERSION 5 +# define SIMD_LIBRARY_VERSION SIMD_CURRENT_LIBRARY_VERSION # define __API_AVAILABLE(...) /* Nothing */ # endif /* The simd types interoperate with the native simd intrinsic types for each * architecture; the headers that define those types and operations are * automatically included with simd.h */ -# if defined __ARM_NEON__ +# if defined __ARM_NEON # include # elif defined __i386__ || defined __x86_64__ # include diff --git a/lib/libc/include/any-macos-any/simd/common.h b/lib/libc/include/any-macos-any/simd/common.h index cb2f6503cbb7..e593d0c62dee 100644 --- a/lib/libc/include/any-macos-any/simd/common.h +++ b/lib/libc/include/any-macos-any/simd/common.h @@ -158,6 +158,18 @@ 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_half2 simd_abs(simd_half2 x); +/*! @abstract The elementwise absolute value of x. */ +static inline SIMD_CFUNC simd_half3 simd_abs(simd_half3 x); +/*! @abstract The elementwise absolute value of x. */ +static inline SIMD_CFUNC simd_half4 simd_abs(simd_half4 x); +/*! @abstract The elementwise absolute value of x. */ +static inline SIMD_CFUNC simd_half8 simd_abs(simd_half8 x); +/*! @abstract The elementwise absolute value of x. */ +static inline SIMD_CFUNC simd_half16 simd_abs(simd_half16 x); +/*! @abstract The elementwise absolute value of x. */ +static inline SIMD_CFUNC simd_half32 simd_abs(simd_half32 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); @@ -250,6 +262,20 @@ 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 _Float16 simd_max(_Float16 x, _Float16 y); +/*! @abstract The elementwise maximum of x and y. */ +static inline SIMD_CFUNC simd_half2 simd_max(simd_half2 x, simd_half2 y); +/*! @abstract The elementwise maximum of x and y. */ +static inline SIMD_CFUNC simd_half3 simd_max(simd_half3 x, simd_half3 y); +/*! @abstract The elementwise maximum of x and y. */ +static inline SIMD_CFUNC simd_half4 simd_max(simd_half4 x, simd_half4 y); +/*! @abstract The elementwise maximum of x and y. */ +static inline SIMD_CFUNC simd_half8 simd_max(simd_half8 x, simd_half8 y); +/*! @abstract The elementwise maximum of x and y. */ +static inline SIMD_CFUNC simd_half16 simd_max(simd_half16 x, simd_half16 y); +/*! @abstract The elementwise maximum of x and y. */ +static inline SIMD_CFUNC simd_half32 simd_max(simd_half32 x, simd_half32 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); @@ -364,6 +390,20 @@ 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 _Float16 simd_min(_Float16 x, _Float16 y); +/*! @abstract The elementwise minimum of x and y. */ +static inline SIMD_CFUNC simd_half2 simd_min(simd_half2 x, simd_half2 y); +/*! @abstract The elementwise minimum of x and y. */ +static inline SIMD_CFUNC simd_half3 simd_min(simd_half3 x, simd_half3 y); +/*! @abstract The elementwise minimum of x and y. */ +static inline SIMD_CFUNC simd_half4 simd_min(simd_half4 x, simd_half4 y); +/*! @abstract The elementwise minimum of x and y. */ +static inline SIMD_CFUNC simd_half8 simd_min(simd_half8 x, simd_half8 y); +/*! @abstract The elementwise minimum of x and y. */ +static inline SIMD_CFUNC simd_half16 simd_min(simd_half16 x, simd_half16 y); +/*! @abstract The elementwise minimum of x and y. */ +static inline SIMD_CFUNC simd_half32 simd_min(simd_half32 x, simd_half32 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); @@ -530,6 +570,34 @@ static inline SIMD_CFUNC simd_ushort16 simd_clamp(simd_ushort16 x, simd_ushort16 * @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 _Float16 simd_clamp(_Float16 x, _Float16 min, _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_half2 simd_clamp(simd_half2 x, simd_half2 min, simd_half2 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_half3 simd_clamp(simd_half3 x, simd_half3 min, simd_half3 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_half4 simd_clamp(simd_half4 x, simd_half4 min, simd_half4 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_half8 simd_clamp(simd_half8 x, simd_half8 min, simd_half8 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_half16 simd_clamp(simd_half16 x, simd_half16 min, simd_half16 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_half32 simd_clamp(simd_half32 x, simd_half32 min, simd_half32 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. */ @@ -650,6 +718,20 @@ static inline SIMD_CFUNC simd_double8 simd_clamp(simd_double8 x, simd_double8 mi * @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 _Float16 simd_sign(_Float16 x); +/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ +static inline SIMD_CFUNC simd_half2 simd_sign(simd_half2 x); +/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ +static inline SIMD_CFUNC simd_half3 simd_sign(simd_half3 x); +/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ +static inline SIMD_CFUNC simd_half4 simd_sign(simd_half4 x); +/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ +static inline SIMD_CFUNC simd_half8 simd_sign(simd_half8 x); +/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ +static inline SIMD_CFUNC simd_half16 simd_sign(simd_half16 x); +/*! @abstract -1 if x is negative, +1 if x is positive, and 0 otherwise. */ +static inline SIMD_CFUNC simd_half32 simd_sign(simd_half32 x); /*! @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. */ @@ -676,6 +758,27 @@ static inline SIMD_CFUNC simd_double8 simd_sign(simd_double8 x); * @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 _Float16 simd_mix(_Float16 x, _Float16 y, _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 simd_half2 simd_mix(simd_half2 x, simd_half2 y, simd_half2 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_half3 simd_mix(simd_half3 x, simd_half3 y, simd_half3 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_half4 simd_mix(simd_half4 x, simd_half4 y, simd_half4 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_half8 simd_mix(simd_half8 x, simd_half8 y, simd_half8 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_half16 simd_mix(simd_half16 x, simd_half16 y, simd_half16 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_half32 simd_mix(simd_half32 x, simd_half32 y, simd_half32 t); /*! @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); @@ -715,6 +818,41 @@ static inline SIMD_CFUNC simd_double8 simd_mix(simd_double8 x, simd_double8 y, s #define vector_mix simd_mix #define simd_lerp 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 _Float16 simd_precise_recip(_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 simd_half2 simd_precise_recip(simd_half2 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_half3 simd_precise_recip(simd_half3 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_half4 simd_precise_recip(simd_half4 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_half8 simd_precise_recip(simd_half8 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_half16 simd_precise_recip(simd_half16 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_half32 simd_precise_recip(simd_half32 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 @@ -774,6 +912,41 @@ static inline SIMD_CFUNC simd_double8 simd_precise_recip(simd_double8 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 _Float16 simd_fast_recip(_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 simd_half2 simd_fast_recip(simd_half2 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_half3 simd_fast_recip(simd_half3 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_half4 simd_fast_recip(simd_half4 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_half8 simd_fast_recip(simd_half8 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_half16 simd_fast_recip(simd_half16 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_half32 simd_fast_recip(simd_half32 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 @@ -833,6 +1006,48 @@ static inline SIMD_CFUNC simd_double8 simd_fast_recip(simd_double8 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 _Float16 simd_recip(_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 simd_half2 simd_recip(simd_half2 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_half3 simd_recip(simd_half3 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_half4 simd_recip(simd_half4 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_half8 simd_recip(simd_half8 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_half16 simd_recip(simd_half16 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_half32 simd_recip(simd_half32 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 @@ -903,6 +1118,34 @@ static inline SIMD_CFUNC simd_double8 simd_recip(simd_double8 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 _Float16 simd_precise_rsqrt(_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 simd_half2 simd_precise_rsqrt(simd_half2 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_half3 simd_precise_rsqrt(simd_half3 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_half4 simd_precise_rsqrt(simd_half4 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_half8 simd_precise_rsqrt(simd_half8 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_half16 simd_precise_rsqrt(simd_half16 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_half32 simd_precise_rsqrt(simd_half32 x); /*! @abstract A good approximation to 1/sqrt(x). * @discussion This function is accurate to a few units in the last place * (ULPs). */ @@ -951,6 +1194,34 @@ static inline SIMD_CFUNC simd_double8 simd_precise_rsqrt(simd_double8 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 _Float16 simd_fast_rsqrt(_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 simd_half2 simd_fast_rsqrt(simd_half2 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_half3 simd_fast_rsqrt(simd_half3 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_half4 simd_fast_rsqrt(simd_half4 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_half8 simd_fast_rsqrt(simd_half8 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_half16 simd_fast_rsqrt(simd_half16 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_half32 simd_fast_rsqrt(simd_half32 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. */ @@ -999,6 +1270,34 @@ static inline SIMD_CFUNC simd_double8 simd_fast_rsqrt(simd_double8 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 _Float16 simd_rsqrt(_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 simd_half2 simd_rsqrt(simd_half2 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_half3 simd_rsqrt(simd_half3 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_half4 simd_rsqrt(simd_half4 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_half8 simd_rsqrt(simd_half8 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_half16 simd_rsqrt(simd_half16 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_half32 simd_rsqrt(simd_half32 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. */ @@ -1047,6 +1346,34 @@ static inline SIMD_CFUNC simd_double8 simd_rsqrt(simd_double8 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 _Float16 simd_fract(_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 simd_half2 simd_fract(simd_half2 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_half3 simd_fract(simd_half3 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_half4 simd_fract(simd_half4 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_half8 simd_fract(simd_half8 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_half16 simd_fract(simd_half16 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_half32 simd_fract(simd_half32 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. */ @@ -1095,6 +1422,34 @@ static inline SIMD_CFUNC simd_double8 simd_fract(simd_double8 x); * @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 _Float16 simd_step(_Float16 edge, _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 simd_half2 simd_step(simd_half2 edge, simd_half2 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_half3 simd_step(simd_half3 edge, simd_half3 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_half4 simd_step(simd_half4 edge, simd_half4 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_half8 simd_step(simd_half8 edge, simd_half8 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_half16 simd_step(simd_half16 edge, simd_half16 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_half32 simd_step(simd_half32 edge, simd_half32 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. */ @@ -1143,6 +1498,34 @@ static inline SIMD_CFUNC simd_double8 simd_step(simd_double8 edge, simd_double8 * @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 _Float16 simd_smoothstep(_Float16 edge0, _Float16 edge1, _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 simd_half2 simd_smoothstep(simd_half2 edge0, simd_half2 edge1, simd_half2 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_half3 simd_smoothstep(simd_half3 edge0, simd_half3 edge1, simd_half3 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_half4 simd_smoothstep(simd_half4 edge0, simd_half4 edge1, simd_half4 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_half8 simd_smoothstep(simd_half8 edge0, simd_half8 edge1, simd_half8 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_half16 simd_smoothstep(simd_half16 edge0, simd_half16 edge1, simd_half16 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_half32 simd_smoothstep(simd_half32 edge0, simd_half32 edge1, simd_half32 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. */ @@ -1295,6 +1678,30 @@ static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort16 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 _Float16 simd_reduce_add(simd_half2 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 _Float16 simd_reduce_add(simd_half3 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 _Float16 simd_reduce_add(simd_half4 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 _Float16 simd_reduce_add(simd_half8 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 _Float16 simd_reduce_add(simd_half16 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 _Float16 simd_reduce_add(simd_half32 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. */ @@ -1460,6 +1867,18 @@ 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 _Float16 simd_reduce_min(simd_half2 x); +/*! @abstract Minimum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half3 x); +/*! @abstract Minimum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half4 x); +/*! @abstract Minimum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half8 x); +/*! @abstract Minimum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half16 x); +/*! @abstract Minimum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half32 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); @@ -1570,6 +1989,18 @@ 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 _Float16 simd_reduce_max(simd_half2 x); +/*! @abstract Maximum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half3 x); +/*! @abstract Maximum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half4 x); +/*! @abstract Maximum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half8 x); +/*! @abstract Maximum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half16 x); +/*! @abstract Maximum of elements in x. */ +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half32 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); @@ -1757,6 +2188,36 @@ static inline SIMD_CFUNC simd_bool simd_equal(simd_ushort16 x, simd_ushort16 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_half2 x, simd_half2 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_half3 x, simd_half3 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_half4 x, simd_half4 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_half8 x, simd_half8 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_half16 x, simd_half16 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_half32 x, simd_half32 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) { @@ -1969,7 +2430,7 @@ static inline SIMD_CFUNC simd_char4 simd_abs(simd_char4 x) { } static inline SIMD_CFUNC simd_char8 simd_abs(simd_char8 x) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vabs_s8(x); #else return simd_make_char8(simd_abs(simd_make_char16_undef(x))); @@ -1977,7 +2438,7 @@ static inline SIMD_CFUNC simd_char8 simd_abs(simd_char8 x) { } static inline SIMD_CFUNC simd_char16 simd_abs(simd_char16 x) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vabsq_s8(x); #elif defined __SSE4_1__ return (simd_char16) _mm_abs_epi8((__m128i)x); @@ -2011,7 +2472,7 @@ static inline SIMD_CFUNC simd_short3 simd_abs(simd_short3 x) { } static inline SIMD_CFUNC simd_short4 simd_abs(simd_short4 x) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vabs_s16(x); #else return simd_make_short4(simd_abs(simd_make_short8_undef(x))); @@ -2019,7 +2480,7 @@ static inline SIMD_CFUNC simd_short4 simd_abs(simd_short4 x) { } static inline SIMD_CFUNC simd_short8 simd_abs(simd_short8 x) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vabsq_s16(x); #elif defined __SSE4_1__ return (simd_short8) _mm_abs_epi16((__m128i)x); @@ -2044,8 +2505,32 @@ static inline SIMD_CFUNC simd_short32 simd_abs(simd_short32 x) { #endif } +static inline SIMD_CFUNC simd_half2 simd_abs(simd_half2 x) { + return __tg_fabs(x); +} + +static inline SIMD_CFUNC simd_half3 simd_abs(simd_half3 x) { + return __tg_fabs(x); +} + +static inline SIMD_CFUNC simd_half4 simd_abs(simd_half4 x) { + return __tg_fabs(x); +} + +static inline SIMD_CFUNC simd_half8 simd_abs(simd_half8 x) { + return __tg_fabs(x); +} + +static inline SIMD_CFUNC simd_half16 simd_abs(simd_half16 x) { + return __tg_fabs(x); +} + +static inline SIMD_CFUNC simd_half32 simd_abs(simd_half32 x) { + return __tg_fabs(x); +} + static inline SIMD_CFUNC simd_int2 simd_abs(simd_int2 x) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vabs_s32(x); #else return simd_make_int2(simd_abs(simd_make_int4_undef(x))); @@ -2057,7 +2542,7 @@ static inline SIMD_CFUNC simd_int3 simd_abs(simd_int3 x) { } static inline SIMD_CFUNC simd_int4 simd_abs(simd_int4 x) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vabsq_s32(x); #elif defined __SSE4_1__ return (simd_int4) _mm_abs_epi32((__m128i)x); @@ -2103,7 +2588,7 @@ static inline SIMD_CFUNC simd_float16 simd_abs(simd_float16 x) { } static inline SIMD_CFUNC simd_long2 simd_abs(simd_long2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vabsq_s64(x); #elif defined __AVX512VL__ return (simd_long2) _mm_abs_epi64((__m128i)x); @@ -2161,7 +2646,7 @@ static inline SIMD_CFUNC simd_char4 simd_min(simd_char4 x, simd_char4 y) { } static inline SIMD_CFUNC simd_char8 simd_min(simd_char8 x, simd_char8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmin_s8(x, y); #else return simd_make_char8(simd_min(simd_make_char16_undef(x), simd_make_char16_undef(y))); @@ -2170,7 +2655,7 @@ static inline SIMD_CFUNC simd_char8 simd_min(simd_char8 x, simd_char8 y) { } static inline SIMD_CFUNC simd_char16 simd_min(simd_char16 x, simd_char16 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vminq_s8(x, y); #elif defined __SSE4_1__ return (simd_char16) _mm_min_epi8((__m128i)x, (__m128i)y); @@ -2208,7 +2693,7 @@ static inline SIMD_CFUNC simd_uchar4 simd_min(simd_uchar4 x, simd_uchar4 y) { } static inline SIMD_CFUNC simd_uchar8 simd_min(simd_uchar8 x, simd_uchar8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmin_u8(x, y); #else return simd_make_uchar8(simd_min(simd_make_uchar16_undef(x), simd_make_uchar16_undef(y))); @@ -2217,7 +2702,7 @@ static inline SIMD_CFUNC simd_uchar8 simd_min(simd_uchar8 x, simd_uchar8 y) { } static inline SIMD_CFUNC simd_uchar16 simd_min(simd_uchar16 x, simd_uchar16 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vminq_u8(x, y); #elif defined __SSE4_1__ return (simd_uchar16) _mm_min_epu8((__m128i)x, (__m128i)y); @@ -2251,7 +2736,7 @@ static inline SIMD_CFUNC simd_short3 simd_min(simd_short3 x, simd_short3 y) { } static inline SIMD_CFUNC simd_short4 simd_min(simd_short4 x, simd_short4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmin_s16(x, y); #else return simd_make_short4(simd_min(simd_make_short8_undef(x), simd_make_short8_undef(y))); @@ -2260,7 +2745,7 @@ static inline SIMD_CFUNC simd_short4 simd_min(simd_short4 x, simd_short4 y) { } static inline SIMD_CFUNC simd_short8 simd_min(simd_short8 x, simd_short8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vminq_s16(x, y); #elif defined __SSE4_1__ return (simd_short8) _mm_min_epi16((__m128i)x, (__m128i)y); @@ -2294,7 +2779,7 @@ static inline SIMD_CFUNC simd_ushort3 simd_min(simd_ushort3 x, simd_ushort3 y) { } static inline SIMD_CFUNC simd_ushort4 simd_min(simd_ushort4 x, simd_ushort4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmin_u16(x, y); #else return simd_make_ushort4(simd_min(simd_make_ushort8_undef(x), simd_make_ushort8_undef(y))); @@ -2303,7 +2788,7 @@ static inline SIMD_CFUNC simd_ushort4 simd_min(simd_ushort4 x, simd_ushort4 y) { } static inline SIMD_CFUNC simd_ushort8 simd_min(simd_ushort8 x, simd_ushort8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vminq_u16(x, y); #elif defined __SSE4_1__ return (simd_ushort8) _mm_min_epu16((__m128i)x, (__m128i)y); @@ -2328,8 +2813,36 @@ static inline SIMD_CFUNC simd_ushort32 simd_min(simd_ushort32 x, simd_ushort32 y #endif } +static inline SIMD_CFUNC _Float16 simd_min(_Float16 x, _Float16 y) { + return __fminf16(x,y); +} + +static inline SIMD_CFUNC simd_half2 simd_min(simd_half2 x, simd_half2 y) { + return __tg_fmin(x,y); +} + +static inline SIMD_CFUNC simd_half3 simd_min(simd_half3 x, simd_half3 y) { + return __tg_fmin(x,y); +} + +static inline SIMD_CFUNC simd_half4 simd_min(simd_half4 x, simd_half4 y) { + return __tg_fmin(x,y); +} + +static inline SIMD_CFUNC simd_half8 simd_min(simd_half8 x, simd_half8 y) { + return __tg_fmin(x,y); +} + +static inline SIMD_CFUNC simd_half16 simd_min(simd_half16 x, simd_half16 y) { + return __tg_fmin(x,y); +} + +static inline SIMD_CFUNC simd_half32 simd_min(simd_half32 x, simd_half32 y) { + return __tg_fmin(x,y); +} + static inline SIMD_CFUNC simd_int2 simd_min(simd_int2 x, simd_int2 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmin_s32(x, y); #else return simd_make_int2(simd_min(simd_make_int4_undef(x), simd_make_int4_undef(y))); @@ -2342,7 +2855,7 @@ static inline SIMD_CFUNC simd_int3 simd_min(simd_int3 x, simd_int3 y) { } static inline SIMD_CFUNC simd_int4 simd_min(simd_int4 x, simd_int4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vminq_s32(x, y); #elif defined __SSE4_1__ return (simd_int4) _mm_min_epi32((__m128i)x, (__m128i)y); @@ -2368,7 +2881,7 @@ static inline SIMD_CFUNC simd_int16 simd_min(simd_int16 x, simd_int16 y) { } static inline SIMD_CFUNC simd_uint2 simd_min(simd_uint2 x, simd_uint2 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmin_u32(x, y); #else return simd_make_uint2(simd_min(simd_make_uint4_undef(x), simd_make_uint4_undef(y))); @@ -2381,7 +2894,7 @@ static inline SIMD_CFUNC simd_uint3 simd_min(simd_uint3 x, simd_uint3 y) { } static inline SIMD_CFUNC simd_uint4 simd_min(simd_uint4 x, simd_uint4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vminq_u32(x, y); #elif defined __SSE4_1__ return (simd_uint4) _mm_min_epu32((__m128i)x, (__m128i)y); @@ -2519,7 +3032,7 @@ static inline SIMD_CFUNC simd_char4 simd_max(simd_char4 x, simd_char4 y) { } static inline SIMD_CFUNC simd_char8 simd_max(simd_char8 x, simd_char8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmax_s8(x, y); #else return simd_make_char8(simd_max(simd_make_char16_undef(x), simd_make_char16_undef(y))); @@ -2528,7 +3041,7 @@ static inline SIMD_CFUNC simd_char8 simd_max(simd_char8 x, simd_char8 y) { } static inline SIMD_CFUNC simd_char16 simd_max(simd_char16 x, simd_char16 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmaxq_s8(x, y); #elif defined __SSE4_1__ return (simd_char16) _mm_max_epi8((__m128i)x, (__m128i)y); @@ -2566,7 +3079,7 @@ static inline SIMD_CFUNC simd_uchar4 simd_max(simd_uchar4 x, simd_uchar4 y) { } static inline SIMD_CFUNC simd_uchar8 simd_max(simd_uchar8 x, simd_uchar8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmax_u8(x, y); #else return simd_make_uchar8(simd_max(simd_make_uchar16_undef(x), simd_make_uchar16_undef(y))); @@ -2575,7 +3088,7 @@ static inline SIMD_CFUNC simd_uchar8 simd_max(simd_uchar8 x, simd_uchar8 y) { } static inline SIMD_CFUNC simd_uchar16 simd_max(simd_uchar16 x, simd_uchar16 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmaxq_u8(x, y); #elif defined __SSE4_1__ return (simd_uchar16) _mm_max_epu8((__m128i)x, (__m128i)y); @@ -2609,7 +3122,7 @@ static inline SIMD_CFUNC simd_short3 simd_max(simd_short3 x, simd_short3 y) { } static inline SIMD_CFUNC simd_short4 simd_max(simd_short4 x, simd_short4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmax_s16(x, y); #else return simd_make_short4(simd_max(simd_make_short8_undef(x), simd_make_short8_undef(y))); @@ -2618,7 +3131,7 @@ static inline SIMD_CFUNC simd_short4 simd_max(simd_short4 x, simd_short4 y) { } static inline SIMD_CFUNC simd_short8 simd_max(simd_short8 x, simd_short8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmaxq_s16(x, y); #elif defined __SSE4_1__ return (simd_short8) _mm_max_epi16((__m128i)x, (__m128i)y); @@ -2652,7 +3165,7 @@ static inline SIMD_CFUNC simd_ushort3 simd_max(simd_ushort3 x, simd_ushort3 y) { } static inline SIMD_CFUNC simd_ushort4 simd_max(simd_ushort4 x, simd_ushort4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmax_u16(x, y); #else return simd_make_ushort4(simd_max(simd_make_ushort8_undef(x), simd_make_ushort8_undef(y))); @@ -2661,7 +3174,7 @@ static inline SIMD_CFUNC simd_ushort4 simd_max(simd_ushort4 x, simd_ushort4 y) { } static inline SIMD_CFUNC simd_ushort8 simd_max(simd_ushort8 x, simd_ushort8 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmaxq_u16(x, y); #elif defined __SSE4_1__ return (simd_ushort8) _mm_max_epu16((__m128i)x, (__m128i)y); @@ -2686,8 +3199,36 @@ static inline SIMD_CFUNC simd_ushort32 simd_max(simd_ushort32 x, simd_ushort32 y #endif } +static inline SIMD_CFUNC _Float16 simd_max(_Float16 x, _Float16 y) { + return __fmaxf16(x,y); +} + +static inline SIMD_CFUNC simd_half2 simd_max(simd_half2 x, simd_half2 y) { + return __tg_fmax(x,y); +} + +static inline SIMD_CFUNC simd_half3 simd_max(simd_half3 x, simd_half3 y) { + return __tg_fmax(x,y); +} + +static inline SIMD_CFUNC simd_half4 simd_max(simd_half4 x, simd_half4 y) { + return __tg_fmax(x,y); +} + +static inline SIMD_CFUNC simd_half8 simd_max(simd_half8 x, simd_half8 y) { + return __tg_fmax(x,y); +} + +static inline SIMD_CFUNC simd_half16 simd_max(simd_half16 x, simd_half16 y) { + return __tg_fmax(x,y); +} + +static inline SIMD_CFUNC simd_half32 simd_max(simd_half32 x, simd_half32 y) { + return __tg_fmax(x,y); +} + static inline SIMD_CFUNC simd_int2 simd_max(simd_int2 x, simd_int2 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmax_s32(x, y); #else return simd_make_int2(simd_max(simd_make_int4_undef(x), simd_make_int4_undef(y))); @@ -2700,7 +3241,7 @@ static inline SIMD_CFUNC simd_int3 simd_max(simd_int3 x, simd_int3 y) { } static inline SIMD_CFUNC simd_int4 simd_max(simd_int4 x, simd_int4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmaxq_s32(x, y); #elif defined __SSE4_1__ return (simd_int4) _mm_max_epi32((__m128i)x, (__m128i)y); @@ -2726,7 +3267,7 @@ static inline SIMD_CFUNC simd_int16 simd_max(simd_int16 x, simd_int16 y) { } static inline SIMD_CFUNC simd_uint2 simd_max(simd_uint2 x, simd_uint2 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmax_u32(x, y); #else return simd_make_uint2(simd_max(simd_make_uint4_undef(x), simd_make_uint4_undef(y))); @@ -2739,7 +3280,7 @@ static inline SIMD_CFUNC simd_uint3 simd_max(simd_uint3 x, simd_uint3 y) { } static inline SIMD_CFUNC simd_uint4 simd_max(simd_uint4 x, simd_uint4 y) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return vmaxq_u32(x, y); #elif defined __SSE4_1__ return (simd_uint4) _mm_max_epu32((__m128i)x, (__m128i)y); @@ -2968,6 +3509,34 @@ static inline SIMD_CFUNC simd_ushort32 simd_clamp(simd_ushort32 x, simd_ushort32 return simd_min(simd_max(x, min), max); } +static inline SIMD_CFUNC _Float16 simd_clamp(_Float16 x, _Float16 min, _Float16 max) { + return simd_min(simd_max(x, min), max); +} + +static inline SIMD_CFUNC simd_half2 simd_clamp(simd_half2 x, simd_half2 min, simd_half2 max) { + return simd_min(simd_max(x, min), max); +} + +static inline SIMD_CFUNC simd_half3 simd_clamp(simd_half3 x, simd_half3 min, simd_half3 max) { + return simd_min(simd_max(x, min), max); +} + +static inline SIMD_CFUNC simd_half4 simd_clamp(simd_half4 x, simd_half4 min, simd_half4 max) { + return simd_min(simd_max(x, min), max); +} + +static inline SIMD_CFUNC simd_half8 simd_clamp(simd_half8 x, simd_half8 min, simd_half8 max) { + return simd_min(simd_max(x, min), max); +} + +static inline SIMD_CFUNC simd_half16 simd_clamp(simd_half16 x, simd_half16 min, simd_half16 max) { + return simd_min(simd_max(x, min), max); +} + +static inline SIMD_CFUNC simd_half32 simd_clamp(simd_half32 x, simd_half32 min, simd_half32 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); } @@ -3084,9 +3653,37 @@ static inline SIMD_CFUNC simd_double8 simd_clamp(simd_double8 x, simd_double8 mi return simd_min(simd_max(x, min), max); } - + +static inline SIMD_CFUNC _Float16 simd_sign(_Float16 x) { + return (x == 0 | x != x) ? 0 : __copysignf16(1,x); +} + +static inline SIMD_CFUNC simd_half2 simd_sign(simd_half2 x) { + return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); +} + +static inline SIMD_CFUNC simd_half3 simd_sign(simd_half3 x) { + return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); +} + +static inline SIMD_CFUNC simd_half4 simd_sign(simd_half4 x) { + return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); +} + +static inline SIMD_CFUNC simd_half8 simd_sign(simd_half8 x) { + return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); +} + +static inline SIMD_CFUNC simd_half16 simd_sign(simd_half16 x) { + return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); +} + +static inline SIMD_CFUNC simd_half32 simd_sign(simd_half32 x) { + return simd_bitselect(__tg_copysign(1,x), 0, x == 0 | x != x); +} + static inline SIMD_CFUNC float simd_sign(float x) { - return (x == 0 | x != x) ? 0 : copysign(1,x); + return (x == 0 | x != x) ? 0 : copysignf(1,x); } static inline SIMD_CFUNC simd_float2 simd_sign(simd_float2 x) { @@ -3129,6 +3726,34 @@ 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 _Float16 simd_mix(_Float16 x, _Float16 y, _Float16 t) { + return x + t*(y - x); +} + +static inline SIMD_CFUNC simd_half2 simd_mix(simd_half2 x, simd_half2 y, simd_half2 t) { + return x + t*(y - x); +} + +static inline SIMD_CFUNC simd_half3 simd_mix(simd_half3 x, simd_half3 y, simd_half3 t) { + return x + t*(y - x); +} + +static inline SIMD_CFUNC simd_half4 simd_mix(simd_half4 x, simd_half4 y, simd_half4 t) { + return x + t*(y - x); +} + +static inline SIMD_CFUNC simd_half8 simd_mix(simd_half8 x, simd_half8 y, simd_half8 t) { + return x + t*(y - x); +} + +static inline SIMD_CFUNC simd_half16 simd_mix(simd_half16 x, simd_half16 y, simd_half16 t) { + return x + t*(y - x); +} + +static inline SIMD_CFUNC simd_half32 simd_mix(simd_half32 x, simd_half32 y, simd_half32 t) { + return x + t*(y - x); +} + static inline SIMD_CFUNC float simd_mix(float x, float y, float t) { return x + t*(y - x); } @@ -3168,11 +3793,67 @@ static inline SIMD_CFUNC simd_double3 simd_mix(simd_double3 x, simd_double3 y, s 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 simd_double8 simd_mix(simd_double8 x, simd_double8 y, simd_double8 t) { + return x + t*(y - x); +} + +static inline SIMD_CFUNC _Float16 simd_recip(_Float16 x) { +#if __FAST_MATH__ + return simd_fast_recip(x); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half2 simd_recip(simd_half2 x) { +#if __FAST_MATH__ + return simd_fast_recip(x); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half3 simd_recip(simd_half3 x) { +#if __FAST_MATH__ + return simd_fast_recip(x); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half4 simd_recip(simd_half4 x) { +#if __FAST_MATH__ + return simd_fast_recip(x); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half8 simd_recip(simd_half8 x) { +#if __FAST_MATH__ + return simd_fast_recip(x); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half16 simd_recip(simd_half16 x) { +#if __FAST_MATH__ + return simd_fast_recip(x); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half32 simd_recip(simd_half32 x) { +#if __FAST_MATH__ + return simd_fast_recip(x); +#else + return simd_precise_recip(x); +#endif } - + static inline SIMD_CFUNC float simd_recip(float x) { #if __FAST_MATH__ return simd_fast_recip(x); @@ -3261,13 +3942,55 @@ static inline SIMD_CFUNC simd_double8 simd_recip(simd_double8 x) { #endif } +static inline SIMD_CFUNC _Float16 simd_fast_recip(_Float16 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return simd_fast_recip(simd_make_half4_undef(x)).x; +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half2 simd_fast_recip(simd_half2 x) { + return simd_fast_recip(simd_make_half4_undef(x)).lo; +} + +static inline SIMD_CFUNC simd_half3 simd_fast_recip(simd_half3 x) { + return simd_make_half3(simd_fast_recip(simd_make_half4_undef(x))); +} + +static inline SIMD_CFUNC simd_half4 simd_fast_recip(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half4 r = vrecpe_f16(x); + return r * vrecps_f16(x, r); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half8 simd_fast_recip(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half8 r = vrecpeq_f16(x); + return r * vrecpsq_f16(x, r); +#else + return simd_precise_recip(x); +#endif +} + +static inline SIMD_CFUNC simd_half16 simd_fast_recip(simd_half16 x) { + return simd_make_half16(simd_fast_recip(x.lo), simd_fast_recip(x.hi)); +} + +static inline SIMD_CFUNC simd_half32 simd_fast_recip(simd_half32 x) { + return simd_make_half32(simd_fast_recip(x.lo), simd_fast_recip(x.hi)); +} + 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__ +#elif defined __ARM_NEON return simd_fast_recip(simd_make_float2_undef(x)).x; #else return simd_precise_recip(x); @@ -3277,7 +4000,7 @@ static inline SIMD_CFUNC float simd_fast_recip(float x) { 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__ +#elif defined __ARM_NEON simd_float2 r = vrecpe_f32(x); return r * vrecps_f32(x, r); #else @@ -3294,7 +4017,7 @@ static inline SIMD_CFUNC simd_float4 simd_fast_recip(simd_float4 x) { return _mm_rcp14_ps(x); #elif defined __SSE__ return _mm_rcp_ps(x); -#elif defined __ARM_NEON__ +#elif defined __ARM_NEON simd_float4 r = vrecpeq_f32(x); return r * vrecpsq_f32(x, r); #else @@ -3340,11 +4063,53 @@ static inline SIMD_CFUNC simd_double8 simd_fast_recip(simd_double8 x) { return simd_precise_recip(x); } +static inline SIMD_CFUNC _Float16 simd_precise_recip(_Float16 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return simd_precise_recip(simd_make_half4_undef(x)).x; +#else + return 1/x; +#endif +} + +static inline SIMD_CFUNC simd_half2 simd_precise_recip(simd_half2 x) { + return simd_precise_recip(simd_make_half4_undef(x)).lo; +} + +static inline SIMD_CFUNC simd_half3 simd_precise_recip(simd_half3 x) { + return simd_make_half3(simd_precise_recip(simd_make_half4_undef(x))); +} + +static inline SIMD_CFUNC simd_half4 simd_precise_recip(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half4 r = simd_fast_recip(x); + return r*vrecps_f16(x, r); +#else + return 1/x; +#endif +} + +static inline SIMD_CFUNC simd_half8 simd_precise_recip(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half8 r = simd_fast_recip(x); + return r*vrecpsq_f16(x, r); +#else + return 1/x; +#endif +} + +static inline SIMD_CFUNC simd_half16 simd_precise_recip(simd_half16 x) { + return simd_make_half16(simd_precise_recip(x.lo), simd_precise_recip(x.hi)); +} + +static inline SIMD_CFUNC simd_half32 simd_precise_recip(simd_half32 x) { + return simd_make_half32(simd_precise_recip(x.lo), simd_precise_recip(x.hi)); +} + 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__ +#elif defined __ARM_NEON return simd_precise_recip(simd_make_float2_undef(x)).x; #else return 1/x; @@ -3354,7 +4119,7 @@ static inline SIMD_CFUNC float simd_precise_recip(float x) { 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__ +#elif defined __ARM_NEON simd_float2 r = simd_fast_recip(x); return r*vrecps_f32(x, r); #else @@ -3370,7 +4135,7 @@ 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__ +#elif defined __ARM_NEON simd_float4 r = simd_fast_recip(x); return r*vrecpsq_f32(x, r); #else @@ -3416,6 +4181,62 @@ static inline SIMD_CFUNC simd_double8 simd_precise_recip(simd_double8 x) { return 1/x; } +static inline SIMD_CFUNC _Float16 simd_rsqrt(_Float16 x) { +#if __FAST_MATH__ + return simd_fast_rsqrt(x); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half2 simd_rsqrt(simd_half2 x) { +#if __FAST_MATH__ + return simd_fast_rsqrt(x); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half3 simd_rsqrt(simd_half3 x) { +#if __FAST_MATH__ + return simd_fast_rsqrt(x); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half4 simd_rsqrt(simd_half4 x) { +#if __FAST_MATH__ + return simd_fast_rsqrt(x); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half8 simd_rsqrt(simd_half8 x) { +#if __FAST_MATH__ + return simd_fast_rsqrt(x); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half16 simd_rsqrt(simd_half16 x) { +#if __FAST_MATH__ + return simd_fast_rsqrt(x); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half32 simd_rsqrt(simd_half32 x) { +#if __FAST_MATH__ + return simd_fast_rsqrt(x); +#else + return simd_precise_rsqrt(x); +#endif +} + static inline SIMD_CFUNC float simd_rsqrt(float x) { #if __FAST_MATH__ return simd_fast_rsqrt(x); @@ -3504,13 +4325,55 @@ static inline SIMD_CFUNC simd_double8 simd_rsqrt(simd_double8 x) { #endif } +static inline SIMD_CFUNC _Float16 simd_fast_rsqrt(_Float16 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return simd_fast_rsqrt(simd_make_half4_undef(x)).x; +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half2 simd_fast_rsqrt(simd_half2 x) { + return simd_fast_rsqrt(simd_make_half4_undef(x)).lo; +} + +static inline SIMD_CFUNC simd_half3 simd_fast_rsqrt(simd_half3 x) { + return simd_make_half3(simd_fast_rsqrt(simd_make_half4_undef(x))); +} + +static inline SIMD_CFUNC simd_half4 simd_fast_rsqrt(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half4 r = vrsqrte_f16(x); + return r * vrsqrts_f16(x, r*r); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half8 simd_fast_rsqrt(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half8 r = vrsqrteq_f16(x); + return r * vrsqrtsq_f16(x, r*r); +#else + return simd_precise_rsqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half16 simd_fast_rsqrt(simd_half16 x) { + return simd_make_half16(simd_fast_rsqrt(x.lo), simd_fast_rsqrt(x.hi)); +} + +static inline SIMD_CFUNC simd_half32 simd_fast_rsqrt(simd_half32 x) { + return simd_make_half32(simd_fast_rsqrt(x.lo), simd_fast_rsqrt(x.hi)); +} + 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__ +#elif defined __ARM_NEON return simd_fast_rsqrt(simd_make_float2_undef(x)).x; #else return simd_precise_rsqrt(x); @@ -3520,7 +4383,7 @@ static inline SIMD_CFUNC float simd_fast_rsqrt(float x) { 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__ +#elif defined __ARM_NEON simd_float2 r = vrsqrte_f32(x); return r * vrsqrts_f32(x, r*r); #else @@ -3537,7 +4400,7 @@ static inline SIMD_CFUNC simd_float4 simd_fast_rsqrt(simd_float4 x) { return _mm_rsqrt14_ps(x); #elif defined __SSE__ return _mm_rsqrt_ps(x); -#elif defined __ARM_NEON__ +#elif defined __ARM_NEON simd_float4 r = vrsqrteq_f32(x); return r * vrsqrtsq_f32(x, r*r); #else @@ -3583,21 +4446,63 @@ static inline SIMD_CFUNC simd_double8 simd_fast_rsqrt(simd_double8 x) { return simd_precise_rsqrt(x); } +static inline SIMD_CFUNC _Float16 simd_precise_rsqrt(_Float16 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return simd_precise_rsqrt(simd_make_half4_undef(x)).x; +#else + return 1/__sqrtf16(x); +#endif +} + +static inline SIMD_CFUNC simd_half2 simd_precise_rsqrt(simd_half2 x) { + return simd_precise_rsqrt(simd_make_half4_undef(x)).lo; +} + +static inline SIMD_CFUNC simd_half3 simd_precise_rsqrt(simd_half3 x) { + return simd_make_half3(simd_precise_rsqrt(simd_make_half4_undef(x))); +} + +static inline SIMD_CFUNC simd_half4 simd_precise_rsqrt(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half4 r = simd_fast_rsqrt(x); + return r*vrsqrts_f16(x, r*r); +#else + return 1/__tg_sqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half8 simd_precise_rsqrt(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + simd_half8 r = simd_fast_rsqrt(x); + return r*vrsqrtsq_f16(x, r*r); +#else + return 1/__tg_sqrt(x); +#endif +} + +static inline SIMD_CFUNC simd_half16 simd_precise_rsqrt(simd_half16 x) { + return simd_make_half16(simd_precise_rsqrt(x.lo), simd_precise_rsqrt(x.hi)); +} + +static inline SIMD_CFUNC simd_half32 simd_precise_rsqrt(simd_half32 x) { + return simd_make_half32(simd_precise_rsqrt(x.lo), simd_precise_rsqrt(x.hi)); +} + 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__ +#elif defined __ARM_NEON return simd_precise_rsqrt(simd_make_float2_undef(x)).x; #else - return 1/sqrt(x); + return 1/sqrtf(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__ +#elif defined __ARM_NEON simd_float2 r = simd_fast_rsqrt(x); return r*vrsqrts_f32(x, r*r); #else @@ -3613,7 +4518,7 @@ 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__ +#elif defined __ARM_NEON simd_float4 r = simd_fast_rsqrt(x); return r*vrsqrtsq_f32(x, r*r); #else @@ -3659,8 +4564,36 @@ static inline SIMD_CFUNC simd_double8 simd_precise_rsqrt(simd_double8 x) { return 1/__tg_sqrt(x); } +static inline SIMD_CFUNC _Float16 simd_fract(_Float16 x) { + return __fminf16(x - __floorf16(x), 0x1.ffcp-1f16); +} + +static inline SIMD_CFUNC simd_half2 simd_fract(simd_half2 x) { + return __tg_fmin(x - __tg_floor(x), 0x1.ffcp-1f16); +} + +static inline SIMD_CFUNC simd_half3 simd_fract(simd_half3 x) { + return __tg_fmin(x - __tg_floor(x), 0x1.ffcp-1f16); +} + +static inline SIMD_CFUNC simd_half4 simd_fract(simd_half4 x) { + return __tg_fmin(x - __tg_floor(x), 0x1.ffcp-1f16); +} + +static inline SIMD_CFUNC simd_half8 simd_fract(simd_half8 x) { + return __tg_fmin(x - __tg_floor(x), 0x1.ffcp-1f16); +} + +static inline SIMD_CFUNC simd_half16 simd_fract(simd_half16 x) { + return __tg_fmin(x - __tg_floor(x), 0x1.ffcp-1f16); +} + +static inline SIMD_CFUNC simd_half32 simd_fract(simd_half32 x) { + return __tg_fmin(x - __tg_floor(x), 0x1.ffcp-1f16); +} + static inline SIMD_CFUNC float simd_fract(float x) { - return fmin(x - floor(x), 0x1.fffffep-1f); + return fminf(x - floorf(x), 0x1.fffffep-1f); } static inline SIMD_CFUNC simd_float2 simd_fract(simd_float2 x) { @@ -3703,6 +4636,34 @@ 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 _Float16 simd_step(_Float16 edge, _Float16 x) { + return !(x < edge); +} + +static inline SIMD_CFUNC simd_half2 simd_step(simd_half2 edge, simd_half2 x) { + return simd_bitselect((simd_half2)1, 0, x < edge); +} + +static inline SIMD_CFUNC simd_half3 simd_step(simd_half3 edge, simd_half3 x) { + return simd_bitselect((simd_half3)1, 0, x < edge); +} + +static inline SIMD_CFUNC simd_half4 simd_step(simd_half4 edge, simd_half4 x) { + return simd_bitselect((simd_half4)1, 0, x < edge); +} + +static inline SIMD_CFUNC simd_half8 simd_step(simd_half8 edge, simd_half8 x) { + return simd_bitselect((simd_half8)1, 0, x < edge); +} + +static inline SIMD_CFUNC simd_half16 simd_step(simd_half16 edge, simd_half16 x) { + return simd_bitselect((simd_half16)1, 0, x < edge); +} + +static inline SIMD_CFUNC simd_half32 simd_step(simd_half32 edge, simd_half32 x) { + return simd_bitselect((simd_half32)1, 0, x < edge); +} + static inline SIMD_CFUNC float simd_step(float edge, float x) { return !(x < edge); } @@ -3747,6 +4708,41 @@ static inline SIMD_CFUNC simd_double8 simd_step(simd_double8 edge, simd_double8 return simd_bitselect((simd_double8)1, 0, x < edge); } +static inline SIMD_CFUNC _Float16 simd_smoothstep(_Float16 edge0, _Float16 edge1, _Float16 x) { + _Float16 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); + return t*t*(3 - 2*t); +} + +static inline SIMD_CFUNC simd_half2 simd_smoothstep(simd_half2 edge0, simd_half2 edge1, simd_half2 x) { + simd_half2 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); + return t*t*(3 - 2*t); +} + +static inline SIMD_CFUNC simd_half3 simd_smoothstep(simd_half3 edge0, simd_half3 edge1, simd_half3 x) { + simd_half3 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); + return t*t*(3 - 2*t); +} + +static inline SIMD_CFUNC simd_half4 simd_smoothstep(simd_half4 edge0, simd_half4 edge1, simd_half4 x) { + simd_half4 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); + return t*t*(3 - 2*t); +} + +static inline SIMD_CFUNC simd_half8 simd_smoothstep(simd_half8 edge0, simd_half8 edge1, simd_half8 x) { + simd_half8 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); + return t*t*(3 - 2*t); +} + +static inline SIMD_CFUNC simd_half16 simd_smoothstep(simd_half16 edge0, simd_half16 edge1, simd_half16 x) { + simd_half16 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); + return t*t*(3 - 2*t); +} + +static inline SIMD_CFUNC simd_half32 simd_smoothstep(simd_half32 edge0, simd_half32 edge1, simd_half32 x) { + simd_half32 t = simd_clamp((x - edge0)/(edge1 - edge0), 0, 1); + return t*t*(3 - 2*t); +} + 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); @@ -3906,6 +4902,30 @@ static inline SIMD_CFUNC unsigned short simd_reduce_add(simd_ushort32 x) { return simd_reduce_add(x.lo + x.hi); } +static inline SIMD_CFUNC _Float16 simd_reduce_add(simd_half2 x) { + return x.x + x.y; +} + +static inline SIMD_CFUNC _Float16 simd_reduce_add(simd_half3 x) { + return x.x + x.y + x.z; +} + +static inline SIMD_CFUNC _Float16 simd_reduce_add(simd_half4 x) { + return simd_reduce_add(x.lo + x.hi); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_add(simd_half8 x) { + return simd_reduce_add(x.lo + x.hi); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_add(simd_half16 x) { + return simd_reduce_add(x.lo + x.hi); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_add(simd_half32 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; } @@ -4032,7 +5052,7 @@ static inline SIMD_CFUNC char simd_reduce_min(simd_char8 x) { } static inline SIMD_CFUNC char simd_reduce_min(simd_char16 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_s8(x); #else return simd_reduce_min(simd_min(x.lo, x.hi)); @@ -4065,7 +5085,7 @@ static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar8 x) { } static inline SIMD_CFUNC unsigned char simd_reduce_min(simd_uchar16 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_u8(x); #else return simd_reduce_min(simd_min(x.lo, x.hi)); @@ -4094,7 +5114,7 @@ static inline SIMD_CFUNC short simd_reduce_min(simd_short4 x) { } static inline SIMD_CFUNC short simd_reduce_min(simd_short8 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_s16(x); #else return simd_reduce_min(simd_min(x.lo, x.hi)); @@ -4123,7 +5143,7 @@ static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort4 x) { } static inline SIMD_CFUNC unsigned short simd_reduce_min(simd_ushort8 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_u16(x); #else return simd_reduce_min(simd_min(x.lo, x.hi)); @@ -4148,7 +5168,7 @@ static inline SIMD_CFUNC int simd_reduce_min(simd_int3 x) { } static inline SIMD_CFUNC int simd_reduce_min(simd_int4 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_s32(x); #else return simd_reduce_min(simd_min(x.lo, x.hi)); @@ -4173,7 +5193,7 @@ static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint3 x) { } static inline SIMD_CFUNC unsigned int simd_reduce_min(simd_uint4 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_u32(x); #else return simd_reduce_min(simd_min(x.lo, x.hi)); @@ -4222,6 +5242,30 @@ 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 _Float16 simd_reduce_min(simd_half2 x) { + return __fminf16(x.x, x.y); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half3 x) { + return __fminf16(__fminf16(x.x, x.z), x.y); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half4 x) { + return simd_reduce_min(simd_min(x.lo, x.hi)); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half8 x) { + return simd_reduce_min(simd_min(x.lo, x.hi)); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half16 x) { + return simd_reduce_min(simd_min(x.lo, x.hi)); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_min(simd_half32 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); } @@ -4231,7 +5275,7 @@ static inline SIMD_CFUNC float simd_reduce_min(simd_float3 x) { } static inline SIMD_CFUNC float simd_reduce_min(simd_float4 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_f32(x); #else return simd_reduce_min(simd_min(x.lo, x.hi)); @@ -4247,7 +5291,7 @@ static inline SIMD_CFUNC float simd_reduce_min(simd_float16 x) { } static inline SIMD_CFUNC double simd_reduce_min(simd_double2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vminvq_f64(x); #else return fmin(x.x, x.y); @@ -4284,7 +5328,7 @@ static inline SIMD_CFUNC char simd_reduce_max(simd_char8 x) { } static inline SIMD_CFUNC char simd_reduce_max(simd_char16 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_s8(x); #else return simd_reduce_max(simd_max(x.lo, x.hi)); @@ -4317,7 +5361,7 @@ static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar8 x) { } static inline SIMD_CFUNC unsigned char simd_reduce_max(simd_uchar16 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_u8(x); #else return simd_reduce_max(simd_max(x.lo, x.hi)); @@ -4346,7 +5390,7 @@ static inline SIMD_CFUNC short simd_reduce_max(simd_short4 x) { } static inline SIMD_CFUNC short simd_reduce_max(simd_short8 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_s16(x); #else return simd_reduce_max(simd_max(x.lo, x.hi)); @@ -4375,7 +5419,7 @@ static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort4 x) { } static inline SIMD_CFUNC unsigned short simd_reduce_max(simd_ushort8 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_u16(x); #else return simd_reduce_max(simd_max(x.lo, x.hi)); @@ -4400,7 +5444,7 @@ static inline SIMD_CFUNC int simd_reduce_max(simd_int3 x) { } static inline SIMD_CFUNC int simd_reduce_max(simd_int4 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_s32(x); #else return simd_reduce_max(simd_max(x.lo, x.hi)); @@ -4425,7 +5469,7 @@ static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint3 x) { } static inline SIMD_CFUNC unsigned int simd_reduce_max(simd_uint4 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_u32(x); #else return simd_reduce_max(simd_max(x.lo, x.hi)); @@ -4474,6 +5518,30 @@ 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 _Float16 simd_reduce_max(simd_half2 x) { + return __fmaxf16(x.x, x.y); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half3 x) { + return __fmaxf16(__fmaxf16(x.x, x.z), x.y); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half4 x) { + return simd_reduce_max(simd_max(x.lo, x.hi)); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half8 x) { + return simd_reduce_max(simd_max(x.lo, x.hi)); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half16 x) { + return simd_reduce_max(simd_max(x.lo, x.hi)); +} + +static inline SIMD_CFUNC _Float16 simd_reduce_max(simd_half32 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); } @@ -4483,7 +5551,7 @@ static inline SIMD_CFUNC float simd_reduce_max(simd_float3 x) { } static inline SIMD_CFUNC float simd_reduce_max(simd_float4 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_f32(x); #else return simd_reduce_max(simd_max(x.lo, x.hi)); @@ -4499,7 +5567,7 @@ static inline SIMD_CFUNC float simd_reduce_max(simd_float16 x) { } static inline SIMD_CFUNC double simd_reduce_max(simd_double2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vmaxvq_f64(x); #else return fmax(x.x, x.y); diff --git a/lib/libc/include/any-macos-any/simd/conversion.h b/lib/libc/include/any-macos-any/simd/conversion.h index 235a56b83600..79766a346308 100644 --- a/lib/libc/include/any-macos-any/simd/conversion.h +++ b/lib/libc/include/any-macos-any/simd/conversion.h @@ -18,6 +18,13 @@ * are guaranteed to wrap modulo 2^N (where N is the number of bits in an * element of the result type). * + * In C++ the conversion functions are templated in the simd:: namespace. + * + * C++ Function Equivalent C Function + * ------------------------------------------------------------------- + * simd::convert(x) simd_ScalarType(x) + * simd::convert_sat(x) simd_ScalarType_sat(x) + * * For integer vector types, saturating conversions are also available: * * simd_char_sat(x) simd_uchar_sat(x) @@ -28,12 +35,14 @@ * These conversions clamp x to the representable range of the result type * before converting. * - * In C++ the conversion functions are templated in the simd:: namespace. + * As well as round to nearest even conversions for same-width data types: * - * C++ Function Equivalent C Function - * ------------------------------------------------------------------- - * simd::convert(x) simd_ScalarType(x) - * simd::convert_sat(x) simd_ScalarType_sat(x) + * simd_short_rte(simd_half x) simd_ushort_rte(simd_half x) + * simd_int_rte(simd_float x) simd_uint_rte(simd_float x) + * simd_long_rte(simd_double x) simd_ulong_rte(simd_double x) + * + * Unlike most vector operations in , there are no abbreviated C++ + * names for these functions in the simd:: namespace. */ #ifndef __SIMD_CONVERSION_HEADER__ @@ -73,6 +82,12 @@ 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_half2 __x); +static simd_char3 SIMD_CFUNC simd_char(simd_half3 __x); +static simd_char4 SIMD_CFUNC simd_char(simd_half4 __x); +static simd_char8 SIMD_CFUNC simd_char(simd_half8 __x); +static simd_char16 SIMD_CFUNC simd_char(simd_half16 __x); +static simd_char32 SIMD_CFUNC simd_char(simd_half32 __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); @@ -112,6 +127,12 @@ 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_half2 __x); +static simd_char3 SIMD_CFUNC simd_char_sat(simd_half3 __x); +static simd_char4 SIMD_CFUNC simd_char_sat(simd_half4 __x); +static simd_char8 SIMD_CFUNC simd_char_sat(simd_half8 __x); +static simd_char16 SIMD_CFUNC simd_char_sat(simd_half16 __x); +static simd_char32 SIMD_CFUNC simd_char_sat(simd_half32 __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); @@ -178,6 +199,12 @@ 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_half2 __x); +static simd_uchar3 SIMD_CFUNC simd_uchar(simd_half3 __x); +static simd_uchar4 SIMD_CFUNC simd_uchar(simd_half4 __x); +static simd_uchar8 SIMD_CFUNC simd_uchar(simd_half8 __x); +static simd_uchar16 SIMD_CFUNC simd_uchar(simd_half16 __x); +static simd_uchar32 SIMD_CFUNC simd_uchar(simd_half32 __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); @@ -217,6 +244,12 @@ 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_half2 __x); +static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_half3 __x); +static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_half4 __x); +static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_half8 __x); +static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_half16 __x); +static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_half32 __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); @@ -283,6 +316,12 @@ 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_half2 __x); +static simd_short3 SIMD_CFUNC simd_short(simd_half3 __x); +static simd_short4 SIMD_CFUNC simd_short(simd_half4 __x); +static simd_short8 SIMD_CFUNC simd_short(simd_half8 __x); +static simd_short16 SIMD_CFUNC simd_short(simd_half16 __x); +static simd_short32 SIMD_CFUNC simd_short(simd_half32 __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); @@ -322,6 +361,12 @@ 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_half2 __x); +static simd_short3 SIMD_CFUNC simd_short_sat(simd_half3 __x); +static simd_short4 SIMD_CFUNC simd_short_sat(simd_half4 __x); +static simd_short8 SIMD_CFUNC simd_short_sat(simd_half8 __x); +static simd_short16 SIMD_CFUNC simd_short_sat(simd_half16 __x); +static simd_short32 SIMD_CFUNC simd_short_sat(simd_half32 __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); @@ -361,6 +406,12 @@ 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); +static simd_short2 SIMD_CFUNC simd_short_rte(simd_half2 __x); +static simd_short3 SIMD_CFUNC simd_short_rte(simd_half3 __x); +static simd_short4 SIMD_CFUNC simd_short_rte(simd_half4 __x); +static simd_short8 SIMD_CFUNC simd_short_rte(simd_half8 __x); +static simd_short16 SIMD_CFUNC simd_short_rte(simd_half16 __x); +static simd_short32 SIMD_CFUNC simd_short_rte(simd_half32 __x); #define vector_short simd_short #define vector_short_sat simd_short_sat @@ -388,6 +439,12 @@ 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_half2 __x); +static simd_ushort3 SIMD_CFUNC simd_ushort(simd_half3 __x); +static simd_ushort4 SIMD_CFUNC simd_ushort(simd_half4 __x); +static simd_ushort8 SIMD_CFUNC simd_ushort(simd_half8 __x); +static simd_ushort16 SIMD_CFUNC simd_ushort(simd_half16 __x); +static simd_ushort32 SIMD_CFUNC simd_ushort(simd_half32 __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); @@ -427,6 +484,12 @@ 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_half2 __x); +static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_half3 __x); +static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_half4 __x); +static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_half8 __x); +static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_half16 __x); +static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_half32 __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); @@ -466,9 +529,68 @@ 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); +static simd_ushort2 SIMD_CFUNC simd_ushort_rte(simd_half2 __x); +static simd_ushort3 SIMD_CFUNC simd_ushort_rte(simd_half3 __x); +static simd_ushort4 SIMD_CFUNC simd_ushort_rte(simd_half4 __x); +static simd_ushort8 SIMD_CFUNC simd_ushort_rte(simd_half8 __x); +static simd_ushort16 SIMD_CFUNC simd_ushort_rte(simd_half16 __x); +static simd_ushort32 SIMD_CFUNC simd_ushort_rte(simd_half32 __x); #define vector_ushort simd_ushort #define vector_ushort_sat simd_ushort_sat +static simd_half2 SIMD_CFUNC simd_half(simd_char2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_char3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_char4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_char8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_char16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_uchar2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_uchar3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_uchar4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_uchar8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_uchar16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_short2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_short3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_short4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_short8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_short16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_ushort2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_ushort3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_ushort4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_ushort8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_ushort16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_half2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_half3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_half4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_half8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_half16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_int2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_int3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_int4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_int8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_int16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_uint2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_uint3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_uint4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_uint8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_uint16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_float2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_float3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_float4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_float8 __x); +static simd_half16 SIMD_CFUNC simd_half(simd_float16 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_long2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_long3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_long4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_long8 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_ulong2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_ulong3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_ulong4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_ulong8 __x); +static simd_half2 SIMD_CFUNC simd_half(simd_double2 __x); +static simd_half3 SIMD_CFUNC simd_half(simd_double3 __x); +static simd_half4 SIMD_CFUNC simd_half(simd_double4 __x); +static simd_half8 SIMD_CFUNC simd_half(simd_double8 __x); + 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); @@ -489,6 +611,11 @@ 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_half2 __x); +static simd_int3 SIMD_CFUNC simd_int(simd_half3 __x); +static simd_int4 SIMD_CFUNC simd_int(simd_half4 __x); +static simd_int8 SIMD_CFUNC simd_int(simd_half8 __x); +static simd_int16 SIMD_CFUNC simd_int(simd_half16 __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); @@ -526,6 +653,11 @@ 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_half2 __x); +static simd_int3 SIMD_CFUNC simd_int_sat(simd_half3 __x); +static simd_int4 SIMD_CFUNC simd_int_sat(simd_half4 __x); +static simd_int8 SIMD_CFUNC simd_int_sat(simd_half8 __x); +static simd_int16 SIMD_CFUNC simd_int_sat(simd_half16 __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); @@ -591,6 +723,11 @@ 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_half2 __x); +static simd_uint3 SIMD_CFUNC simd_uint(simd_half3 __x); +static simd_uint4 SIMD_CFUNC simd_uint(simd_half4 __x); +static simd_uint8 SIMD_CFUNC simd_uint(simd_half8 __x); +static simd_uint16 SIMD_CFUNC simd_uint(simd_half16 __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); @@ -628,6 +765,11 @@ 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_half2 __x); +static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_half3 __x); +static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_half4 __x); +static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_half8 __x); +static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_half16 __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); @@ -665,6 +807,11 @@ 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); +static simd_uint2 SIMD_CFUNC simd_uint_rte(simd_float2 __x); +static simd_uint3 SIMD_CFUNC simd_uint_rte(simd_float3 __x); +static simd_uint4 SIMD_CFUNC simd_uint_rte(simd_float4 __x); +static simd_uint8 SIMD_CFUNC simd_uint_rte(simd_float8 __x); +static simd_uint16 SIMD_CFUNC simd_uint_rte(simd_float16 __x); #define vector_uint simd_uint #define vector_uint_sat simd_uint_sat @@ -688,6 +835,11 @@ 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_half2 __x); +static simd_float3 SIMD_CFUNC simd_float(simd_half3 __x); +static simd_float4 SIMD_CFUNC simd_float(simd_half4 __x); +static simd_float8 SIMD_CFUNC simd_float(simd_half8 __x); +static simd_float16 SIMD_CFUNC simd_float(simd_half16 __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); @@ -733,6 +885,10 @@ 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_half2 __x); +static simd_long3 SIMD_CFUNC simd_long(simd_half3 __x); +static simd_long4 SIMD_CFUNC simd_long(simd_half4 __x); +static simd_long8 SIMD_CFUNC simd_long(simd_half8 __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); @@ -765,6 +921,10 @@ 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_half2 __x); +static simd_long3 SIMD_CFUNC simd_long_sat(simd_half3 __x); +static simd_long4 SIMD_CFUNC simd_long_sat(simd_half4 __x); +static simd_long8 SIMD_CFUNC simd_long_sat(simd_half8 __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); @@ -820,6 +980,10 @@ 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_half2 __x); +static simd_ulong3 SIMD_CFUNC simd_ulong(simd_half3 __x); +static simd_ulong4 SIMD_CFUNC simd_ulong(simd_half4 __x); +static simd_ulong8 SIMD_CFUNC simd_ulong(simd_half8 __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); @@ -852,6 +1016,10 @@ 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_half2 __x); +static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_half3 __x); +static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_half4 __x); +static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_half8 __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); @@ -884,6 +1052,10 @@ 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); +static simd_ulong2 SIMD_CFUNC simd_ulong_rte(simd_double2 __x); +static simd_ulong3 SIMD_CFUNC simd_ulong_rte(simd_double3 __x); +static simd_ulong4 SIMD_CFUNC simd_ulong_rte(simd_double4 __x); +static simd_ulong8 SIMD_CFUNC simd_ulong_rte(simd_double8 __x); #define vector_ulong simd_ulong #define vector_ulong_sat simd_ulong_sat @@ -903,6 +1075,10 @@ 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_half2 __x); +static simd_double3 SIMD_CFUNC simd_double(simd_half3 __x); +static simd_double4 SIMD_CFUNC simd_double(simd_half4 __x); +static simd_double8 SIMD_CFUNC simd_double(simd_half8 __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); @@ -933,6 +1109,7 @@ static simd_char2 SIMD_CFUNC vector2(char __x, char __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_half2 SIMD_CFUNC vector2(_Float16 __x, _Float16 __y) { return ( simd_half2){__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}; } @@ -944,6 +1121,7 @@ static simd_char3 SIMD_CFUNC vector3(char __x, char __y, c 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_half3 SIMD_CFUNC vector3(_Float16 __x, _Float16 __y, _Float16 __z) { return ( simd_half3){__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}; } @@ -955,6 +1133,7 @@ static simd_char3 SIMD_CFUNC vector3(simd_char2 __xy, char __z) { 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_half3 SIMD_CFUNC vector3(simd_half2 __xy, _Float16 __z) { simd_half3 __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; } @@ -966,6 +1145,7 @@ static simd_char4 SIMD_CFUNC vector4(char __x, char __y, c 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_half4 SIMD_CFUNC vector4(_Float16 __x, _Float16 __y, _Float16 __z, _Float16 __w) { return ( simd_half4){__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}; } @@ -977,6 +1157,7 @@ static simd_char4 SIMD_CFUNC vector4(simd_char2 __xy, simd_char2 __zw) { s 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_half4 SIMD_CFUNC vector4(simd_half2 __xy, simd_half2 __zw) { simd_half4 __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; } @@ -988,6 +1169,7 @@ static simd_char4 SIMD_CFUNC vector4(simd_char3 __xyz, char __w) { 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_half4 SIMD_CFUNC vector4(simd_half3 __xyz, _Float16 __w) { simd_half4 __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; } @@ -999,6 +1181,7 @@ static simd_char8 SIMD_CFUNC vector8(simd_char4 __lo, simd_char4 __hi) { s 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_half8 SIMD_CFUNC vector8(simd_half4 __lo, simd_half4 __hi) { simd_half8 __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; } @@ -1010,6 +1193,7 @@ static simd_char16 SIMD_CFUNC vector16(simd_char8 __lo, simd_char8 __hi) { 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_half16 SIMD_CFUNC vector16(simd_half8 __lo, simd_half8 __hi) { simd_half16 __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; } @@ -1018,6 +1202,7 @@ static simd_char32 SIMD_CFUNC vector32(simd_char16 __lo, simd_char16 __hi) 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; } +static simd_half32 SIMD_CFUNC vector32(simd_half16 __lo, simd_half16 __hi) { simd_half32 __r; __r.lo = __lo; __r.hi = __hi; return __r; } #pragma mark - Implementation @@ -1045,6 +1230,12 @@ static simd_char4 SIMD_CFUNC simd_char(simd_ushort4 __x) { return simd_char(si 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_half2 __x) { return simd_char(simd_short(__x)); } +static simd_char3 SIMD_CFUNC simd_char(simd_half3 __x) { return simd_char(simd_short(__x)); } +static simd_char4 SIMD_CFUNC simd_char(simd_half4 __x) { return simd_char(simd_short(__x)); } +static simd_char8 SIMD_CFUNC simd_char(simd_half8 __x) { return simd_char(simd_short(__x)); } +static simd_char16 SIMD_CFUNC simd_char(simd_half16 __x) { return simd_char(simd_short(__x)); } +static simd_char32 SIMD_CFUNC simd_char(simd_half32 __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)); } @@ -1085,6 +1276,12 @@ static simd_char4 SIMD_CFUNC simd_char_sat(simd_short4 __x) { return simd_cha 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_half2 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } +static simd_char3 SIMD_CFUNC simd_char_sat(simd_half3 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } +static simd_char4 SIMD_CFUNC simd_char_sat(simd_half4 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } +static simd_char8 SIMD_CFUNC simd_char_sat(simd_half8 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } +static simd_char16 SIMD_CFUNC simd_char_sat(simd_half16 __x) { return simd_char(simd_clamp(__x,-0x80,0x7f)); } +static simd_char32 SIMD_CFUNC simd_char_sat(simd_half32 __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)); } @@ -1150,6 +1347,12 @@ static simd_uchar4 SIMD_CFUNC simd_uchar(simd_ushort4 __x) { return simd_uchar 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_half2 __x) { return simd_uchar(simd_char(__x)); } +static simd_uchar3 SIMD_CFUNC simd_uchar(simd_half3 __x) { return simd_uchar(simd_char(__x)); } +static simd_uchar4 SIMD_CFUNC simd_uchar(simd_half4 __x) { return simd_uchar(simd_char(__x)); } +static simd_uchar8 SIMD_CFUNC simd_uchar(simd_half8 __x) { return simd_uchar(simd_char(__x)); } +static simd_uchar16 SIMD_CFUNC simd_uchar(simd_half16 __x) { return simd_uchar(simd_char(__x)); } +static simd_uchar32 SIMD_CFUNC simd_uchar(simd_half32 __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)); } @@ -1190,6 +1393,12 @@ static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_short4 __x) { return simd_u 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_half2 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } +static simd_uchar3 SIMD_CFUNC simd_uchar_sat(simd_half3 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } +static simd_uchar4 SIMD_CFUNC simd_uchar_sat(simd_half4 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } +static simd_uchar8 SIMD_CFUNC simd_uchar_sat(simd_half8 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } +static simd_uchar16 SIMD_CFUNC simd_uchar_sat(simd_half16 __x) { return simd_uchar(simd_clamp(__x,0,0xff)); } +static simd_uchar32 SIMD_CFUNC simd_uchar_sat(simd_half32 __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)); } @@ -1255,6 +1464,12 @@ static simd_short4 SIMD_CFUNC simd_short(simd_ushort4 __x) { return (simd_shor 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_half2 __x) { return __builtin_convertvector(__x, simd_short2); } +static simd_short3 SIMD_CFUNC simd_short(simd_half3 __x) { return __builtin_convertvector(__x, simd_short3); } +static simd_short4 SIMD_CFUNC simd_short(simd_half4 __x) { return __builtin_convertvector(__x, simd_short4); } +static simd_short8 SIMD_CFUNC simd_short(simd_half8 __x) { return __builtin_convertvector(__x, simd_short8); } +static simd_short16 SIMD_CFUNC simd_short(simd_half16 __x) { return __builtin_convertvector(__x, simd_short16); } +static simd_short32 SIMD_CFUNC simd_short(simd_half32 __x) { return __builtin_convertvector(__x, simd_short32); } 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); } @@ -1295,6 +1510,12 @@ 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_half2 __x) { return simd_bitselect(simd_short(simd_max(__x,-0x1.0p15f16)), 0x7fff, __x >= 0x1.0p15f16); } +static simd_short3 SIMD_CFUNC simd_short_sat(simd_half3 __x) { return simd_bitselect(simd_short(simd_max(__x,-0x1.0p15f16)), 0x7fff, __x >= 0x1.0p15f16); } +static simd_short4 SIMD_CFUNC simd_short_sat(simd_half4 __x) { return simd_bitselect(simd_short(simd_max(__x,-0x1.0p15f16)), 0x7fff, __x >= 0x1.0p15f16); } +static simd_short8 SIMD_CFUNC simd_short_sat(simd_half8 __x) { return simd_bitselect(simd_short(simd_max(__x,-0x1.0p15f16)), 0x7fff, __x >= 0x1.0p15f16); } +static simd_short16 SIMD_CFUNC simd_short_sat(simd_half16 __x) { return simd_bitselect(simd_short(simd_max(__x,-0x1.0p15f16)), 0x7fff, __x >= 0x1.0p15f16); } +static simd_short32 SIMD_CFUNC simd_short_sat(simd_half32 __x) { return simd_bitselect(simd_short(simd_max(__x,-0x1.0p15f16)), 0x7fff, __x >= 0x1.0p15f16); } 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)); } @@ -1334,7 +1555,26 @@ static simd_short2 SIMD_CFUNC simd_short_sat(simd_ulong2 __x) { return simd_s 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_short2 SIMD_CFUNC simd_short_rte(simd_half2 __x) { return simd_make_short2(simd_short_rte(simd_make_half4_undef(__x))); } +static simd_short3 SIMD_CFUNC simd_short_rte(simd_half3 __x) { return simd_make_short3(simd_short_rte(simd_make_half4_undef(__x))); } +static simd_short4 SIMD_CFUNC simd_short_rte(simd_half4 __x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vcvtn_s16_f16(__x); +#else + return simd_make_short4(simd_short_rte(simd_make_half8_undef(__x))); +#endif +} +static simd_short8 SIMD_CFUNC simd_short_rte(simd_half8 __x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vcvtnq_s16_f16(__x); +#else + simd_half8 magic = __tg_copysign(0x1.0p10f16, __x); + simd_short8 x_is_small = __tg_fabs(__x) < 0x1.0p10f16; + return __builtin_convertvector(simd_bitselect(__x, (__x + magic) - magic, x_is_small & 0x7fff), simd_short8); +#endif +} +static simd_short16 SIMD_CFUNC simd_short_rte(simd_half16 __x) { return simd_make_short16(simd_short_rte(__x.lo), simd_short_rte(__x.hi)); } +static simd_short32 SIMD_CFUNC simd_short_rte(simd_half32 __x) { return simd_make_short32(simd_short_rte(__x.lo), simd_short_rte(__x.hi)); } 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)); } @@ -1360,6 +1600,12 @@ 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_half2 __x) { return __builtin_convertvector(__x, simd_ushort2); } +static simd_ushort3 SIMD_CFUNC simd_ushort(simd_half3 __x) { return __builtin_convertvector(__x, simd_ushort3); } +static simd_ushort4 SIMD_CFUNC simd_ushort(simd_half4 __x) { return __builtin_convertvector(__x, simd_ushort4); } +static simd_ushort8 SIMD_CFUNC simd_ushort(simd_half8 __x) { return __builtin_convertvector(__x, simd_ushort8); } +static simd_ushort16 SIMD_CFUNC simd_ushort(simd_half16 __x) { return __builtin_convertvector(__x, simd_ushort16); } +static simd_ushort32 SIMD_CFUNC simd_ushort(simd_half32 __x) { return __builtin_convertvector(__x, simd_ushort32); } 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)); } @@ -1400,6 +1646,12 @@ static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_short4 __x) { return simd 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_half2 __x) { return simd_bitselect(simd_ushort(simd_max(__x,0)), 0xffff, __x > 0x1.ffcp15f16); } +static simd_ushort3 SIMD_CFUNC simd_ushort_sat(simd_half3 __x) { return simd_bitselect(simd_ushort(simd_max(__x,0)), 0xffff, __x > 0x1.ffcp15f16); } +static simd_ushort4 SIMD_CFUNC simd_ushort_sat(simd_half4 __x) { return simd_bitselect(simd_ushort(simd_max(__x,0)), 0xffff, __x > 0x1.ffcp15f16); } +static simd_ushort8 SIMD_CFUNC simd_ushort_sat(simd_half8 __x) { return simd_bitselect(simd_ushort(simd_max(__x,0)), 0xffff, __x > 0x1.ffcp15f16); } +static simd_ushort16 SIMD_CFUNC simd_ushort_sat(simd_half16 __x) { return simd_bitselect(simd_ushort(simd_max(__x,0)), 0xffff, __x > 0x1.ffcp15f16); } +static simd_ushort32 SIMD_CFUNC simd_ushort_sat(simd_half32 __x) { return simd_bitselect(simd_ushort(simd_max(__x,0)), 0xffff, __x > 0x1.ffcp15f16); } 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)); } @@ -1439,7 +1691,78 @@ static simd_ushort2 SIMD_CFUNC simd_ushort_sat(simd_ulong2 __x) { return simd 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_ushort2 SIMD_CFUNC simd_ushort_rte(simd_half2 __x) { return simd_make_ushort2(simd_ushort_rte(simd_make_half4_undef(__x))); } +static simd_ushort3 SIMD_CFUNC simd_ushort_rte(simd_half3 __x) { return simd_make_ushort3(simd_ushort_rte(simd_make_half4_undef(__x))); } +static simd_ushort4 SIMD_CFUNC simd_ushort_rte(simd_half4 __x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vcvtn_u16_f16(__x); +#else + return simd_make_ushort4(simd_ushort_rte(simd_make_half8_undef(__x))); +#endif +} +static simd_ushort8 SIMD_CFUNC simd_ushort_rte(simd_half8 __x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vcvtnq_u16_f16(__x); +#else + simd_short8 __big = __x >= 0x1.0p15f16; + return simd_ushort(simd_short(__x - simd_bitselect((simd_half8) 0,0x1.0p15f16,__big))) + simd_bitselect((simd_ushort8) 0,0x8000,__big); +#endif +} +static simd_ushort16 SIMD_CFUNC simd_ushort_rte(simd_half16 __x) { return simd_make_ushort16(simd_ushort_rte(__x.lo), simd_ushort_rte(__x.hi)); } +static simd_ushort32 SIMD_CFUNC simd_ushort_rte(simd_half32 __x) { return simd_make_ushort32(simd_ushort_rte(__x.lo), simd_ushort_rte(__x.hi)); } + +static simd_half2 SIMD_CFUNC simd_half(simd_char2 __x) { return (simd_half2)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half3 SIMD_CFUNC simd_half(simd_char3 __x) { return (simd_half3)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half4 SIMD_CFUNC simd_half(simd_char4 __x) { return (simd_half4)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half8 SIMD_CFUNC simd_half(simd_char8 __x) { return (simd_half8)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half16 SIMD_CFUNC simd_half(simd_char16 __x) { return (simd_half16)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half2 SIMD_CFUNC simd_half(simd_uchar2 __x) { return (simd_half2)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half3 SIMD_CFUNC simd_half(simd_uchar3 __x) { return (simd_half3)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half4 SIMD_CFUNC simd_half(simd_uchar4 __x) { return (simd_half4)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half8 SIMD_CFUNC simd_half(simd_uchar8 __x) { return (simd_half8)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half16 SIMD_CFUNC simd_half(simd_uchar16 __x) { return (simd_half16)(simd_short(__x) + 0x6600) - 0x1.8p10f16; } +static simd_half2 SIMD_CFUNC simd_half(simd_short2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_short3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_short4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_short8 __x) { return __builtin_convertvector(__x,simd_half8); } +static simd_half16 SIMD_CFUNC simd_half(simd_short16 __x) { return __builtin_convertvector(__x,simd_half16); } +static simd_half2 SIMD_CFUNC simd_half(simd_ushort2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_ushort3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_ushort4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_ushort8 __x) { return __builtin_convertvector(__x,simd_half8); } +static simd_half16 SIMD_CFUNC simd_half(simd_ushort16 __x) { return __builtin_convertvector(__x,simd_half16); } +static simd_half2 SIMD_CFUNC simd_half(simd_half2 __x) { return __x; } +static simd_half3 SIMD_CFUNC simd_half(simd_half3 __x) { return __x; } +static simd_half4 SIMD_CFUNC simd_half(simd_half4 __x) { return __x; } +static simd_half8 SIMD_CFUNC simd_half(simd_half8 __x) { return __x; } +static simd_half16 SIMD_CFUNC simd_half(simd_half16 __x) { return __x; } +static simd_half2 SIMD_CFUNC simd_half(simd_int2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_int3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_int4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_int8 __x) { return __builtin_convertvector(__x,simd_half8); } +static simd_half16 SIMD_CFUNC simd_half(simd_int16 __x) { return __builtin_convertvector(__x,simd_half16); } +static simd_half2 SIMD_CFUNC simd_half(simd_uint2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_uint3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_uint4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_uint8 __x) { return __builtin_convertvector(__x,simd_half8); } +static simd_half16 SIMD_CFUNC simd_half(simd_uint16 __x) { return __builtin_convertvector(__x,simd_half16); } +static simd_half2 SIMD_CFUNC simd_half(simd_float2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_float3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_float4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_float8 __x) { return __builtin_convertvector(__x,simd_half8); } +static simd_half16 SIMD_CFUNC simd_half(simd_float16 __x) { return __builtin_convertvector(__x,simd_half16); } +static simd_half2 SIMD_CFUNC simd_half(simd_long2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_long3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_long4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_long8 __x) { return __builtin_convertvector(__x,simd_half8); } +static simd_half2 SIMD_CFUNC simd_half(simd_ulong2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_ulong3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_ulong4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_ulong8 __x) { return __builtin_convertvector(__x,simd_half8); } +static simd_half2 SIMD_CFUNC simd_half(simd_double2 __x) { return __builtin_convertvector(__x,simd_half2); } +static simd_half3 SIMD_CFUNC simd_half(simd_double3 __x) { return __builtin_convertvector(__x,simd_half3); } +static simd_half4 SIMD_CFUNC simd_half(simd_double4 __x) { return __builtin_convertvector(__x,simd_half4); } +static simd_half8 SIMD_CFUNC simd_half(simd_double8 __x) { return __builtin_convertvector(__x,simd_half8); } 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); } @@ -1461,6 +1784,11 @@ static simd_int3 SIMD_CFUNC simd_int(simd_ushort3 __x) { return __builtin_conv 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_half2 __x) { return __builtin_convertvector(__x, simd_int2); } +static simd_int3 SIMD_CFUNC simd_int(simd_half3 __x) { return __builtin_convertvector(__x, simd_int3); } +static simd_int4 SIMD_CFUNC simd_int(simd_half4 __x) { return __builtin_convertvector(__x, simd_int4); } +static simd_int8 SIMD_CFUNC simd_int(simd_half8 __x) { return __builtin_convertvector(__x, simd_int8); } +static simd_int16 SIMD_CFUNC simd_int(simd_half16 __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; } @@ -1499,6 +1827,11 @@ static simd_int3 SIMD_CFUNC simd_int_sat(simd_short3 __x) { return simd_int(_ 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_half2 __x) { return simd_int(__x); } +static simd_int3 SIMD_CFUNC simd_int_sat(simd_half3 __x) { return simd_int(__x); } +static simd_int4 SIMD_CFUNC simd_int_sat(simd_half4 __x) { return simd_int(__x); } +static simd_int8 SIMD_CFUNC simd_int_sat(simd_half8 __x) { return simd_int(__x); } +static simd_int16 SIMD_CFUNC simd_int_sat(simd_half16 __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; } @@ -1538,7 +1871,7 @@ static simd_int4 SIMD_CFUNC simd_int_sat(simd_ulong4 __x) { return simd_int(s static simd_int8 SIMD_CFUNC simd_int_sat(simd_ulong8 __x) { return simd_int(simd_min(__x,0x7fffffff)); } static simd_int2 SIMD_CFUNC simd_int_rte(simd_float2 __x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vcvtn_s32_f32(__x); #else return simd_make_int2(simd_int_rte(simd_make_float4_undef(__x))); @@ -1552,7 +1885,7 @@ static simd_int3 SIMD_CFUNC simd_int_rte(simd_float3 __x) { static simd_int4 SIMD_CFUNC simd_int_rte(simd_float4 __x) { #if defined __SSE2__ return _mm_cvtps_epi32(__x); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vcvtnq_s32_f32(__x); #else simd_float4 magic = __tg_copysign(0x1.0p23, __x); @@ -1571,7 +1904,7 @@ static simd_int8 SIMD_CFUNC simd_int_rte(simd_float8 __x) { static simd_int16 SIMD_CFUNC simd_int_rte(simd_float16 __x) { #if defined __AVX512F__ - return _mm512_cvt_roundps_epi32(__x, _MM_FROUND_RINT); + return _mm512_cvtps_epi32(__x); #else return simd_make_int16(simd_int_rte(__x.lo), simd_int_rte(__x.hi)); #endif @@ -1597,6 +1930,11 @@ static simd_uint3 SIMD_CFUNC simd_uint(simd_ushort3 __x) { return simd_uint(si 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_half2 __x) { return simd_uint(simd_int(__x)); } +static simd_uint3 SIMD_CFUNC simd_uint(simd_half3 __x) { return simd_uint(simd_int(__x)); } +static simd_uint4 SIMD_CFUNC simd_uint(simd_half4 __x) { return simd_uint(simd_int(__x)); } +static simd_uint8 SIMD_CFUNC simd_uint(simd_half8 __x) { return simd_uint(simd_int(__x)); } +static simd_uint16 SIMD_CFUNC simd_uint(simd_half16 __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; } @@ -1635,6 +1973,11 @@ static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_short3 __x) { return simd_uin 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_half2 __x) { return simd_uint(simd_max(__x,0)); } +static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_half3 __x) { return simd_uint(simd_max(__x,0)); } +static simd_uint4 SIMD_CFUNC simd_uint_sat(simd_half4 __x) { return simd_uint(simd_max(__x,0)); } +static simd_uint8 SIMD_CFUNC simd_uint_sat(simd_half8 __x) { return simd_uint(simd_max(__x,0)); } +static simd_uint16 SIMD_CFUNC simd_uint_sat(simd_half16 __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)); } @@ -1673,6 +2016,45 @@ static simd_uint3 SIMD_CFUNC simd_uint_sat(simd_ulong3 __x) { return simd_uin 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_uint2 SIMD_CFUNC simd_uint_rte(simd_float2 __x) { +#if defined __arm64__ + return vcvtn_u32_f32(__x); +#else + return simd_make_uint2(simd_uint_rte(simd_make_float4_undef(__x))); +#endif +} + +static simd_uint3 SIMD_CFUNC simd_uint_rte(simd_float3 __x) { + return simd_make_uint3(simd_uint_rte(simd_make_float4_undef(__x))); +} + +static simd_uint4 SIMD_CFUNC simd_uint_rte(simd_float4 __x) { +#if defined __AVX512F__ + return _mm_cvtps_epu32(__x); +#elif defined __arm64__ + return vcvtnq_u32_f32(__x); +#else + simd_float4 magic = __tg_copysign(0x1.0p23, __x); + simd_int4 x_is_small = __tg_fabs(__x) < 0x1.0p23; + return __builtin_convertvector(simd_bitselect(__x, (__x + magic) - magic, x_is_small & 0x7fffffff), simd_uint4); +#endif +} + +static simd_uint8 SIMD_CFUNC simd_uint_rte(simd_float8 __x) { +#if defined __AVX512F__ + return _mm256_cvtps_epu32(__x); +#else + return simd_make_uint8(simd_uint_rte(__x.lo), simd_uint_rte(__x.hi)); +#endif +} + +static simd_uint16 SIMD_CFUNC simd_uint_rte(simd_float16 __x) { +#if defined __AVX512F__ + return _mm512_cvtps_epu32(__x); +#else + return simd_make_uint16(simd_uint_rte(__x.lo), simd_uint_rte(__x.hi)); +#endif +} 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; } @@ -1694,6 +2076,11 @@ static simd_float3 SIMD_CFUNC simd_float(simd_ushort3 __x) { return (simd_floa 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_half2 __x) { return __builtin_convertvector(__x,simd_float2); } +static simd_float3 SIMD_CFUNC simd_float(simd_half3 __x) { return __builtin_convertvector(__x,simd_float3); } +static simd_float4 SIMD_CFUNC simd_float(simd_half4 __x) { return __builtin_convertvector(__x,simd_float4); } +static simd_float8 SIMD_CFUNC simd_float(simd_half8 __x) { return __builtin_convertvector(__x,simd_float8); } +static simd_float16 SIMD_CFUNC simd_float(simd_half16 __x) { return __builtin_convertvector(__x,simd_float16); } 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); } @@ -1739,6 +2126,10 @@ static simd_long2 SIMD_CFUNC simd_long(simd_ushort2 __x) { return __builtin_co 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_half2 __x) { return __builtin_convertvector(__x,simd_long2); } +static simd_long3 SIMD_CFUNC simd_long(simd_half3 __x) { return __builtin_convertvector(__x,simd_long3); } +static simd_long4 SIMD_CFUNC simd_long(simd_half4 __x) { return __builtin_convertvector(__x,simd_long4); } +static simd_long8 SIMD_CFUNC simd_long(simd_half8 __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); } @@ -1772,6 +2163,10 @@ static simd_long2 SIMD_CFUNC simd_long_sat(simd_short2 __x) { return simd_lon 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_half2 __x) { return simd_long(__x); } +static simd_long3 SIMD_CFUNC simd_long_sat(simd_half3 __x) { return simd_long(__x); } +static simd_long4 SIMD_CFUNC simd_long_sat(simd_half4 __x) { return simd_long(__x); } +static simd_long8 SIMD_CFUNC simd_long_sat(simd_half8 __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); } @@ -1808,7 +2203,7 @@ static simd_long8 SIMD_CFUNC simd_long_sat(simd_ulong8 __x) { return simd_lon static simd_long2 SIMD_CFUNC simd_long_rte(simd_double2 __x) { #if defined __AVX512F__ return _mm_cvtpd_epi64(__x); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vcvtnq_s64_f64(__x); #else simd_double2 magic = __tg_copysign(0x1.0p52, __x); @@ -1831,7 +2226,7 @@ static simd_long4 SIMD_CFUNC simd_long_rte(simd_double4 __x) { static simd_long8 SIMD_CFUNC simd_long_rte(simd_double8 __x) { #if defined __AVX512F__ - return _mm512_cvt_roundpd_epi64(__x, _MM_FROUND_RINT); + return _mm512_cvtpd_epi64(__x); #else return simd_make_long8(simd_long_rte(__x.lo), simd_long_rte(__x.hi)); #endif @@ -1854,6 +2249,10 @@ static simd_ulong2 SIMD_CFUNC simd_ulong(simd_ushort2 __x) { return simd_ulong 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_half2 __x) { return simd_ulong(simd_long(__x)); } +static simd_ulong3 SIMD_CFUNC simd_ulong(simd_half3 __x) { return simd_ulong(simd_long(__x)); } +static simd_ulong4 SIMD_CFUNC simd_ulong(simd_half4 __x) { return simd_ulong(simd_long(__x)); } +static simd_ulong8 SIMD_CFUNC simd_ulong(simd_half8 __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)); } @@ -1887,6 +2286,10 @@ static simd_ulong2 SIMD_CFUNC simd_ulong_sat(simd_short2 __x) { return simd_u 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_half2 __x) { return simd_ulong(simd_max(__x,0)); } +static simd_ulong3 SIMD_CFUNC simd_ulong_sat(simd_half3 __x) { return simd_ulong(simd_max(__x,0)); } +static simd_ulong4 SIMD_CFUNC simd_ulong_sat(simd_half4 __x) { return simd_ulong(simd_max(__x,0)); } +static simd_ulong8 SIMD_CFUNC simd_ulong_sat(simd_half8 __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)); } @@ -1920,6 +2323,37 @@ 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_ulong2 SIMD_CFUNC simd_ulong_rte(simd_double2 __x) { +#if defined __AVX512F__ + return _mm_cvtpd_epu64(__x); +#elif defined __arm64__ + return vcvtnq_u64_f64(__x); +#else + simd_double2 magic = __tg_copysign(0x1.0p52, __x); + simd_long2 x_is_small = __tg_fabs(__x) < 0x1.0p52; + return __builtin_convertvector(simd_bitselect(__x, (__x + magic) - magic, x_is_small & 0x7fffffffffffffff), simd_ulong2); +#endif +} + +static simd_ulong3 SIMD_CFUNC simd_ulong_rte(simd_double3 __x) { + return simd_make_ulong3(simd_ulong_rte(simd_make_double4_undef(__x))); +} + +static simd_ulong4 SIMD_CFUNC simd_ulong_rte(simd_double4 __x) { +#if defined __AVX512F__ + return _mm256_cvtpd_epu64(__x); +#else + return simd_make_ulong4(simd_ulong_rte(__x.lo), simd_ulong_rte(__x.hi)); +#endif +} + +static simd_ulong8 SIMD_CFUNC simd_ulong_rte(simd_double8 __x) { +#if defined __AVX512F__ + return _mm512_cvtpd_epu64(__x); +#else + return simd_make_ulong8(simd_ulong_rte(__x.lo), simd_ulong_rte(__x.hi)); +#endif +} 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)); } @@ -1937,6 +2371,10 @@ static simd_double2 SIMD_CFUNC simd_double(simd_ushort2 __x) { return simd_dou 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_half2 __x) { return __builtin_convertvector(__x, simd_double2); } +static simd_double3 SIMD_CFUNC simd_double(simd_half3 __x) { return __builtin_convertvector(__x, simd_double3); } +static simd_double4 SIMD_CFUNC simd_double(simd_half4 __x) { return __builtin_convertvector(__x, simd_double4); } +static simd_double8 SIMD_CFUNC simd_double(simd_half8 __x) { return __builtin_convertvector(__x, simd_double8); } 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); } @@ -1991,6 +2429,8 @@ static constexpr Vector_t::count> convert(typeN vector return simd_long(vector); else if constexpr (std::is_same::value) return simd_ulong(vector); + else if constexpr (std::is_same::value) + return simd_half(vector); else if constexpr (std::is_same::value) return simd_float(vector); else if constexpr (std::is_same::value) diff --git a/lib/libc/include/any-macos-any/simd/extern.h b/lib/libc/include/any-macos-any/simd/extern.h index b4b6b8f53d81..3902fdb4307e 100644 --- a/lib/libc/include/any-macos-any/simd/extern.h +++ b/lib/libc/include/any-macos-any/simd/extern.h @@ -34,6 +34,16 @@ extern double _simd_orient_pd3(const double *); extern double _simd_insphere_pd3(const double *); #endif /* SIMD_LIBRARY_VERSION */ +#if SIMD_LIBRARY_VERSION >= 6 +extern _Float16 _simd_orient_vh2(simd_half2, simd_half2); +extern _Float16 _simd_orient_ph2(simd_half2, simd_half2, simd_half2); +extern _Float16 _simd_incircle_ph2(simd_half2, simd_half2, simd_half2, simd_half2); + +extern _Float16 _simd_orient_vh3(simd_half3, simd_half3, simd_half3); +extern _Float16 _simd_orient_ph3(simd_half3, simd_half3, simd_half3, simd_half3); +extern _Float16 _simd_insphere_ph3(simd_half3, simd_half3, simd_half3, simd_half3, simd_half3); +#endif /* SIMD_LIBRARY_VERSION */ + #pragma mark - matrix extern simd_float2x2 __invert_f2(simd_float2x2); extern simd_double2x2 __invert_d2(simd_double2x2); @@ -42,6 +52,12 @@ extern simd_double3x3 __invert_d3(simd_double3x3); extern simd_float4x4 __invert_f4(simd_float4x4); extern simd_double4x4 __invert_d4(simd_double4x4); +#if SIMD_LIBRARY_VERSION >= 6 +extern simd_half2x2 __invert_h2(simd_half2x2); +extern simd_half3x3 __invert_h3(simd_half3x3); +extern simd_half4x4 __invert_h4(simd_half4x4); +#endif /* SIMD_LIBRARY_VERSION */ + #ifdef __cplusplus } #endif diff --git a/lib/libc/include/any-macos-any/simd/geometry.h b/lib/libc/include/any-macos-any/simd/geometry.h index 83b5a3806186..f0529c6ffbf4 100644 --- a/lib/libc/include/any-macos-any/simd/geometry.h +++ b/lib/libc/include/any-macos-any/simd/geometry.h @@ -136,6 +136,12 @@ extern "C" { #endif +static _Float16 SIMD_CFUNC simd_dot(simd_half2 __x, simd_half2 __y); +static _Float16 SIMD_CFUNC simd_dot(simd_half3 __x, simd_half3 __y); +static _Float16 SIMD_CFUNC simd_dot(simd_half4 __x, simd_half4 __y); +static _Float16 SIMD_CFUNC simd_dot(simd_half8 __x, simd_half8 __y); +static _Float16 SIMD_CFUNC simd_dot(simd_half16 __x, simd_half16 __y); +static _Float16 SIMD_CFUNC simd_dot(simd_half32 __x, simd_half32 __y); static float SIMD_CFUNC simd_dot(simd_float2 __x, simd_float2 __y); static float SIMD_CFUNC simd_dot(simd_float3 __x, simd_float3 __y); static float SIMD_CFUNC simd_dot(simd_float4 __x, simd_float4 __y); @@ -147,6 +153,12 @@ static double SIMD_CFUNC simd_dot(simd_double4 __x, simd_double4 __y); static double SIMD_CFUNC simd_dot(simd_double8 __x, simd_double8 __y); #define vector_dot simd_dot +static simd_half2 SIMD_CFUNC simd_precise_project(simd_half2 __x, simd_half2 __y); +static simd_half3 SIMD_CFUNC simd_precise_project(simd_half3 __x, simd_half3 __y); +static simd_half4 SIMD_CFUNC simd_precise_project(simd_half4 __x, simd_half4 __y); +static simd_half8 SIMD_CFUNC simd_precise_project(simd_half8 __x, simd_half8 __y); +static simd_half16 SIMD_CFUNC simd_precise_project(simd_half16 __x, simd_half16 __y); +static simd_half32 SIMD_CFUNC simd_precise_project(simd_half32 __x, simd_half32 __y); static simd_float2 SIMD_CFUNC simd_precise_project(simd_float2 __x, simd_float2 __y); static simd_float3 SIMD_CFUNC simd_precise_project(simd_float3 __x, simd_float3 __y); static simd_float4 SIMD_CFUNC simd_precise_project(simd_float4 __x, simd_float4 __y); @@ -158,6 +170,12 @@ static simd_double4 SIMD_CFUNC simd_precise_project(simd_double4 __x, simd_doubl static simd_double8 SIMD_CFUNC simd_precise_project(simd_double8 __x, simd_double8 __y); #define vector_precise_project simd_precise_project +static simd_half2 SIMD_CFUNC simd_fast_project(simd_half2 __x, simd_half2 __y); +static simd_half3 SIMD_CFUNC simd_fast_project(simd_half3 __x, simd_half3 __y); +static simd_half4 SIMD_CFUNC simd_fast_project(simd_half4 __x, simd_half4 __y); +static simd_half8 SIMD_CFUNC simd_fast_project(simd_half8 __x, simd_half8 __y); +static simd_half16 SIMD_CFUNC simd_fast_project(simd_half16 __x, simd_half16 __y); +static simd_half32 SIMD_CFUNC simd_fast_project(simd_half32 __x, simd_half32 __y); static simd_float2 SIMD_CFUNC simd_fast_project(simd_float2 __x, simd_float2 __y); static simd_float3 SIMD_CFUNC simd_fast_project(simd_float3 __x, simd_float3 __y); static simd_float4 SIMD_CFUNC simd_fast_project(simd_float4 __x, simd_float4 __y); @@ -169,6 +187,12 @@ static simd_double4 SIMD_CFUNC simd_fast_project(simd_double4 __x, simd_double4 static simd_double8 SIMD_CFUNC simd_fast_project(simd_double8 __x, simd_double8 __y); #define vector_fast_project simd_fast_project +static simd_half2 SIMD_CFUNC simd_project(simd_half2 __x, simd_half2 __y); +static simd_half3 SIMD_CFUNC simd_project(simd_half3 __x, simd_half3 __y); +static simd_half4 SIMD_CFUNC simd_project(simd_half4 __x, simd_half4 __y); +static simd_half8 SIMD_CFUNC simd_project(simd_half8 __x, simd_half8 __y); +static simd_half16 SIMD_CFUNC simd_project(simd_half16 __x, simd_half16 __y); +static simd_half32 SIMD_CFUNC simd_project(simd_half32 __x, simd_half32 __y); static simd_float2 SIMD_CFUNC simd_project(simd_float2 __x, simd_float2 __y); static simd_float3 SIMD_CFUNC simd_project(simd_float3 __x, simd_float3 __y); static simd_float4 SIMD_CFUNC simd_project(simd_float4 __x, simd_float4 __y); @@ -180,6 +204,14 @@ static simd_double4 SIMD_CFUNC simd_project(simd_double4 __x, simd_double4 __y); static simd_double8 SIMD_CFUNC simd_project(simd_double8 __x, simd_double8 __y); #define vector_project simd_project +#if SIMD_LIBRARY_VERSION >= 6 +static _Float16 SIMD_CFUNC simd_precise_length(simd_half2 __x); +static _Float16 SIMD_CFUNC simd_precise_length(simd_half3 __x); +static _Float16 SIMD_CFUNC simd_precise_length(simd_half4 __x); +static _Float16 SIMD_CFUNC simd_precise_length(simd_half8 __x); +static _Float16 SIMD_CFUNC simd_precise_length(simd_half16 __x); +static _Float16 SIMD_CFUNC simd_precise_length(simd_half32 __x); +#endif // SIMD_LIBRARY_VERSION >= 6 static float SIMD_CFUNC simd_precise_length(simd_float2 __x); static float SIMD_CFUNC simd_precise_length(simd_float3 __x); static float SIMD_CFUNC simd_precise_length(simd_float4 __x); @@ -191,6 +223,12 @@ static double SIMD_CFUNC simd_precise_length(simd_double4 __x); static double SIMD_CFUNC simd_precise_length(simd_double8 __x); #define vector_precise_length simd_precise_length +static _Float16 SIMD_CFUNC simd_fast_length(simd_half2 __x); +static _Float16 SIMD_CFUNC simd_fast_length(simd_half3 __x); +static _Float16 SIMD_CFUNC simd_fast_length(simd_half4 __x); +static _Float16 SIMD_CFUNC simd_fast_length(simd_half8 __x); +static _Float16 SIMD_CFUNC simd_fast_length(simd_half16 __x); +static _Float16 SIMD_CFUNC simd_fast_length(simd_half32 __x); static float SIMD_CFUNC simd_fast_length(simd_float2 __x); static float SIMD_CFUNC simd_fast_length(simd_float3 __x); static float SIMD_CFUNC simd_fast_length(simd_float4 __x); @@ -202,6 +240,12 @@ static double SIMD_CFUNC simd_fast_length(simd_double4 __x); static double SIMD_CFUNC simd_fast_length(simd_double8 __x); #define vector_fast_length simd_fast_length +static _Float16 SIMD_CFUNC simd_length(simd_half2 __x); +static _Float16 SIMD_CFUNC simd_length(simd_half3 __x); +static _Float16 SIMD_CFUNC simd_length(simd_half4 __x); +static _Float16 SIMD_CFUNC simd_length(simd_half8 __x); +static _Float16 SIMD_CFUNC simd_length(simd_half16 __x); +static _Float16 SIMD_CFUNC simd_length(simd_half32 __x); static float SIMD_CFUNC simd_length(simd_float2 __x); static float SIMD_CFUNC simd_length(simd_float3 __x); static float SIMD_CFUNC simd_length(simd_float4 __x); @@ -213,6 +257,12 @@ static double SIMD_CFUNC simd_length(simd_double4 __x); static double SIMD_CFUNC simd_length(simd_double8 __x); #define vector_length simd_length +static _Float16 SIMD_CFUNC simd_length_squared(simd_half2 __x); +static _Float16 SIMD_CFUNC simd_length_squared(simd_half3 __x); +static _Float16 SIMD_CFUNC simd_length_squared(simd_half4 __x); +static _Float16 SIMD_CFUNC simd_length_squared(simd_half8 __x); +static _Float16 SIMD_CFUNC simd_length_squared(simd_half16 __x); +static _Float16 SIMD_CFUNC simd_length_squared(simd_half32 __x); static float SIMD_CFUNC simd_length_squared(simd_float2 __x); static float SIMD_CFUNC simd_length_squared(simd_float3 __x); static float SIMD_CFUNC simd_length_squared(simd_float4 __x); @@ -224,6 +274,12 @@ static double SIMD_CFUNC simd_length_squared(simd_double4 __x); static double SIMD_CFUNC simd_length_squared(simd_double8 __x); #define vector_length_squared simd_length_squared +static _Float16 SIMD_CFUNC simd_norm_one(simd_half2 __x); +static _Float16 SIMD_CFUNC simd_norm_one(simd_half3 __x); +static _Float16 SIMD_CFUNC simd_norm_one(simd_half4 __x); +static _Float16 SIMD_CFUNC simd_norm_one(simd_half8 __x); +static _Float16 SIMD_CFUNC simd_norm_one(simd_half16 __x); +static _Float16 SIMD_CFUNC simd_norm_one(simd_half32 __x); static float SIMD_CFUNC simd_norm_one(simd_float2 __x); static float SIMD_CFUNC simd_norm_one(simd_float3 __x); static float SIMD_CFUNC simd_norm_one(simd_float4 __x); @@ -235,6 +291,12 @@ static double SIMD_CFUNC simd_norm_one(simd_double4 __x); static double SIMD_CFUNC simd_norm_one(simd_double8 __x); #define vector_norm_one simd_norm_one +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half2 __x); +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half3 __x); +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half4 __x); +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half8 __x); +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half16 __x); +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half32 __x); static float SIMD_CFUNC simd_norm_inf(simd_float2 __x); static float SIMD_CFUNC simd_norm_inf(simd_float3 __x); static float SIMD_CFUNC simd_norm_inf(simd_float4 __x); @@ -246,6 +308,12 @@ static double SIMD_CFUNC simd_norm_inf(simd_double4 __x); static double SIMD_CFUNC simd_norm_inf(simd_double8 __x); #define vector_norm_inf simd_norm_inf +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half2 __x, simd_half2 __y); +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half3 __x, simd_half3 __y); +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half4 __x, simd_half4 __y); +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half8 __x, simd_half8 __y); +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half16 __x, simd_half16 __y); +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half32 __x, simd_half32 __y); static float SIMD_CFUNC simd_precise_distance(simd_float2 __x, simd_float2 __y); static float SIMD_CFUNC simd_precise_distance(simd_float3 __x, simd_float3 __y); static float SIMD_CFUNC simd_precise_distance(simd_float4 __x, simd_float4 __y); @@ -257,6 +325,12 @@ static double SIMD_CFUNC simd_precise_distance(simd_double4 __x, simd_double4 __ static double SIMD_CFUNC simd_precise_distance(simd_double8 __x, simd_double8 __y); #define vector_precise_distance simd_precise_distance +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half2 __x, simd_half2 __y); +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half3 __x, simd_half3 __y); +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half4 __x, simd_half4 __y); +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half8 __x, simd_half8 __y); +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half16 __x, simd_half16 __y); +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half32 __x, simd_half32 __y); static float SIMD_CFUNC simd_fast_distance(simd_float2 __x, simd_float2 __y); static float SIMD_CFUNC simd_fast_distance(simd_float3 __x, simd_float3 __y); static float SIMD_CFUNC simd_fast_distance(simd_float4 __x, simd_float4 __y); @@ -268,6 +342,12 @@ static double SIMD_CFUNC simd_fast_distance(simd_double4 __x, simd_double4 __y); static double SIMD_CFUNC simd_fast_distance(simd_double8 __x, simd_double8 __y); #define vector_fast_distance simd_fast_distance +static _Float16 SIMD_CFUNC simd_distance(simd_half2 __x, simd_half2 __y); +static _Float16 SIMD_CFUNC simd_distance(simd_half3 __x, simd_half3 __y); +static _Float16 SIMD_CFUNC simd_distance(simd_half4 __x, simd_half4 __y); +static _Float16 SIMD_CFUNC simd_distance(simd_half8 __x, simd_half8 __y); +static _Float16 SIMD_CFUNC simd_distance(simd_half16 __x, simd_half16 __y); +static _Float16 SIMD_CFUNC simd_distance(simd_half32 __x, simd_half32 __y); static float SIMD_CFUNC simd_distance(simd_float2 __x, simd_float2 __y); static float SIMD_CFUNC simd_distance(simd_float3 __x, simd_float3 __y); static float SIMD_CFUNC simd_distance(simd_float4 __x, simd_float4 __y); @@ -279,6 +359,12 @@ static double SIMD_CFUNC simd_distance(simd_double4 __x, simd_double4 __y); static double SIMD_CFUNC simd_distance(simd_double8 __x, simd_double8 __y); #define vector_distance simd_distance +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half2 __x, simd_half2 __y); +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half3 __x, simd_half3 __y); +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half4 __x, simd_half4 __y); +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half8 __x, simd_half8 __y); +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half16 __x, simd_half16 __y); +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half32 __x, simd_half32 __y); static float SIMD_CFUNC simd_distance_squared(simd_float2 __x, simd_float2 __y); static float SIMD_CFUNC simd_distance_squared(simd_float3 __x, simd_float3 __y); static float SIMD_CFUNC simd_distance_squared(simd_float4 __x, simd_float4 __y); @@ -290,6 +376,12 @@ static double SIMD_CFUNC simd_distance_squared(simd_double4 __x, simd_double4 __ static double SIMD_CFUNC simd_distance_squared(simd_double8 __x, simd_double8 __y); #define vector_distance_squared simd_distance_squared +static simd_half2 SIMD_CFUNC simd_precise_normalize(simd_half2 __x); +static simd_half3 SIMD_CFUNC simd_precise_normalize(simd_half3 __x); +static simd_half4 SIMD_CFUNC simd_precise_normalize(simd_half4 __x); +static simd_half8 SIMD_CFUNC simd_precise_normalize(simd_half8 __x); +static simd_half16 SIMD_CFUNC simd_precise_normalize(simd_half16 __x); +static simd_half32 SIMD_CFUNC simd_precise_normalize(simd_half32 __x); static simd_float2 SIMD_CFUNC simd_precise_normalize(simd_float2 __x); static simd_float3 SIMD_CFUNC simd_precise_normalize(simd_float3 __x); static simd_float4 SIMD_CFUNC simd_precise_normalize(simd_float4 __x); @@ -301,6 +393,12 @@ static simd_double4 SIMD_CFUNC simd_precise_normalize(simd_double4 __x); static simd_double8 SIMD_CFUNC simd_precise_normalize(simd_double8 __x); #define vector_precise_normalize simd_precise_normalize +static simd_half2 SIMD_CFUNC simd_fast_normalize(simd_half2 __x); +static simd_half3 SIMD_CFUNC simd_fast_normalize(simd_half3 __x); +static simd_half4 SIMD_CFUNC simd_fast_normalize(simd_half4 __x); +static simd_half8 SIMD_CFUNC simd_fast_normalize(simd_half8 __x); +static simd_half16 SIMD_CFUNC simd_fast_normalize(simd_half16 __x); +static simd_half32 SIMD_CFUNC simd_fast_normalize(simd_half32 __x); static simd_float2 SIMD_CFUNC simd_fast_normalize(simd_float2 __x); static simd_float3 SIMD_CFUNC simd_fast_normalize(simd_float3 __x); static simd_float4 SIMD_CFUNC simd_fast_normalize(simd_float4 __x); @@ -312,6 +410,12 @@ static simd_double4 SIMD_CFUNC simd_fast_normalize(simd_double4 __x); static simd_double8 SIMD_CFUNC simd_fast_normalize(simd_double8 __x); #define vector_fast_normalize simd_fast_normalize +static simd_half2 SIMD_CFUNC simd_normalize(simd_half2 __x); +static simd_half3 SIMD_CFUNC simd_normalize(simd_half3 __x); +static simd_half4 SIMD_CFUNC simd_normalize(simd_half4 __x); +static simd_half8 SIMD_CFUNC simd_normalize(simd_half8 __x); +static simd_half16 SIMD_CFUNC simd_normalize(simd_half16 __x); +static simd_half32 SIMD_CFUNC simd_normalize(simd_half32 __x); static simd_float2 SIMD_CFUNC simd_normalize(simd_float2 __x); static simd_float3 SIMD_CFUNC simd_normalize(simd_float3 __x); static simd_float4 SIMD_CFUNC simd_normalize(simd_float4 __x); @@ -323,12 +427,17 @@ static simd_double4 SIMD_CFUNC simd_normalize(simd_double4 __x); static simd_double8 SIMD_CFUNC simd_normalize(simd_double8 __x); #define vector_normalize simd_normalize +static simd_half3 SIMD_CFUNC simd_cross(simd_half2 __x, simd_half2 __y); +static simd_half3 SIMD_CFUNC simd_cross(simd_half3 __x, simd_half3 __y); static simd_float3 SIMD_CFUNC simd_cross(simd_float2 __x, simd_float2 __y); static simd_float3 SIMD_CFUNC simd_cross(simd_float3 __x, simd_float3 __y); static simd_double3 SIMD_CFUNC simd_cross(simd_double2 __x, simd_double2 __y); static simd_double3 SIMD_CFUNC simd_cross(simd_double3 __x, simd_double3 __y); #define vector_cross simd_cross +static simd_half2 SIMD_CFUNC simd_reflect(simd_half2 __x, simd_half2 __n); +static simd_half3 SIMD_CFUNC simd_reflect(simd_half3 __x, simd_half3 __n); +static simd_half4 SIMD_CFUNC simd_reflect(simd_half4 __x, simd_half4 __n); static simd_float2 SIMD_CFUNC simd_reflect(simd_float2 __x, simd_float2 __n); static simd_float3 SIMD_CFUNC simd_reflect(simd_float3 __x, simd_float3 __n); static simd_float4 SIMD_CFUNC simd_reflect(simd_float4 __x, simd_float4 __n); @@ -337,6 +446,11 @@ static simd_double3 SIMD_CFUNC simd_reflect(simd_double3 __x, simd_double3 __n); static simd_double4 SIMD_CFUNC simd_reflect(simd_double4 __x, simd_double4 __n); #define vector_reflect simd_reflect +#if SIMD_LIBRARY_VERSION >= 6 +static simd_half2 SIMD_CFUNC simd_refract(simd_half2 __x, simd_half2 __n, _Float16 __eta); +static simd_half3 SIMD_CFUNC simd_refract(simd_half3 __x, simd_half3 __n, _Float16 __eta); +static simd_half4 SIMD_CFUNC simd_refract(simd_half4 __x, simd_half4 __n, _Float16 __eta); +#endif // SIMD_LIBRARY_VERSION >= 6 static simd_float2 SIMD_CFUNC simd_refract(simd_float2 __x, simd_float2 __n, float __eta); static simd_float3 SIMD_CFUNC simd_refract(simd_float3 __x, simd_float3 __n, float __eta); static simd_float4 SIMD_CFUNC simd_refract(simd_float4 __x, simd_float4 __n, float __eta); @@ -578,11 +692,31 @@ static float SIMD_CFUNC simd_insphere(simd_float3 __x, simd_float3 __a, simd_flo * negatively-oriented. */ static double SIMD_CFUNC simd_insphere(simd_double3 __x, simd_double3 __a, simd_double3 __b, simd_double3 __c, simd_double3 __d); #endif /* SIMD_LIBRARY_VERSION */ - + +#if SIMD_LIBRARY_VERSION >= 6 +/* fp16 support requires that you are building for OS X 15.0 or later, + * iOS 18.0 or later, watchOS 11.0 or later, and tvOS 18.0 or later. On + * earlier OS versions, the library functions that implement these + * operations are not available. */ + + static _Float16 SIMD_CFUNC simd_orient(simd_half2 __x, simd_half2 __y); + static _Float16 SIMD_CFUNC simd_orient(simd_half3 __x, simd_half3 __y, simd_half3 __z); + static _Float16 SIMD_CFUNC simd_orient(simd_half2 __a, simd_half2 __b, simd_half2 __c); + static _Float16 SIMD_CFUNC simd_orient(simd_half3 __a, simd_half3 __b, simd_half3 __c, simd_half3 __d); + static _Float16 SIMD_CFUNC simd_incircle(simd_half2 __x, simd_half2 __a, simd_half2 __b, simd_half2 __c); + static _Float16 SIMD_CFUNC simd_insphere(simd_half3 __x, simd_half3 __a, simd_half3 __b, simd_half3 __c, simd_half3 __d); +#endif /* SIMD_LIBRARY_VERSION */ + #ifdef __cplusplus } /* extern "C" */ namespace simd { + static SIMD_CPPFUNC _Float16 dot(const half2 x, const half2 y) { return ::simd_dot(x, y); } + static SIMD_CPPFUNC _Float16 dot(const half3 x, const half3 y) { return ::simd_dot(x, y); } + static SIMD_CPPFUNC _Float16 dot(const half4 x, const half4 y) { return ::simd_dot(x, y); } + static SIMD_CPPFUNC _Float16 dot(const half8 x, const half8 y) { return ::simd_dot(x, y); } + static SIMD_CPPFUNC _Float16 dot(const half16 x, const half16 y) { return ::simd_dot(x, y); } + static SIMD_CPPFUNC _Float16 dot(const half32 x, const half32 y) { return ::simd_dot(x, y); } static SIMD_CPPFUNC float dot(const float2 x, const float2 y) { return ::simd_dot(x, y); } static SIMD_CPPFUNC float dot(const float3 x, const float3 y) { return ::simd_dot(x, y); } static SIMD_CPPFUNC float dot(const float4 x, const float4 y) { return ::simd_dot(x, y); } @@ -593,6 +727,12 @@ namespace simd { static SIMD_CPPFUNC double dot(const double4 x, const double4 y) { return ::simd_dot(x, y); } static SIMD_CPPFUNC double dot(const double8 x, const double8 y) { return ::simd_dot(x, y); } + static SIMD_CPPFUNC half2 project(const half2 x, const half2 y) { return ::simd_project(x, y); } + static SIMD_CPPFUNC half3 project(const half3 x, const half3 y) { return ::simd_project(x, y); } + static SIMD_CPPFUNC half4 project(const half4 x, const half4 y) { return ::simd_project(x, y); } + static SIMD_CPPFUNC half8 project(const half8 x, const half8 y) { return ::simd_project(x, y); } + static SIMD_CPPFUNC half16 project(const half16 x, const half16 y) { return ::simd_project(x, y); } + static SIMD_CPPFUNC half32 project(const half32 x, const half32 y) { return ::simd_project(x, y); } static SIMD_CPPFUNC float2 project(const float2 x, const float2 y) { return ::simd_project(x, y); } static SIMD_CPPFUNC float3 project(const float3 x, const float3 y) { return ::simd_project(x, y); } static SIMD_CPPFUNC float4 project(const float4 x, const float4 y) { return ::simd_project(x, y); } @@ -603,6 +743,12 @@ namespace simd { static SIMD_CPPFUNC double4 project(const double4 x, const double4 y) { return ::simd_project(x, y); } static SIMD_CPPFUNC double8 project(const double8 x, const double8 y) { return ::simd_project(x, y); } + static SIMD_CPPFUNC _Float16 length_squared(const half2 x) { return ::simd_length_squared(x); } + static SIMD_CPPFUNC _Float16 length_squared(const half3 x) { return ::simd_length_squared(x); } + static SIMD_CPPFUNC _Float16 length_squared(const half4 x) { return ::simd_length_squared(x); } + static SIMD_CPPFUNC _Float16 length_squared(const half8 x) { return ::simd_length_squared(x); } + static SIMD_CPPFUNC _Float16 length_squared(const half16 x) { return ::simd_length_squared(x); } + static SIMD_CPPFUNC _Float16 length_squared(const half32 x) { return ::simd_length_squared(x); } static SIMD_CPPFUNC float length_squared(const float2 x) { return ::simd_length_squared(x); } static SIMD_CPPFUNC float length_squared(const float3 x) { return ::simd_length_squared(x); } static SIMD_CPPFUNC float length_squared(const float4 x) { return ::simd_length_squared(x); } @@ -613,6 +759,12 @@ namespace simd { static SIMD_CPPFUNC double length_squared(const double4 x) { return ::simd_length_squared(x); } static SIMD_CPPFUNC double length_squared(const double8 x) { return ::simd_length_squared(x); } + static SIMD_CPPFUNC _Float16 norm_one(const half2 x) { return ::simd_norm_one(x); } + static SIMD_CPPFUNC _Float16 norm_one(const half3 x) { return ::simd_norm_one(x); } + static SIMD_CPPFUNC _Float16 norm_one(const half4 x) { return ::simd_norm_one(x); } + static SIMD_CPPFUNC _Float16 norm_one(const half8 x) { return ::simd_norm_one(x); } + static SIMD_CPPFUNC _Float16 norm_one(const half16 x) { return ::simd_norm_one(x); } + static SIMD_CPPFUNC _Float16 norm_one(const half32 x) { return ::simd_norm_one(x); } static SIMD_CPPFUNC float norm_one(const float2 x) { return ::simd_norm_one(x); } static SIMD_CPPFUNC float norm_one(const float3 x) { return ::simd_norm_one(x); } static SIMD_CPPFUNC float norm_one(const float4 x) { return ::simd_norm_one(x); } @@ -623,6 +775,12 @@ namespace simd { static SIMD_CPPFUNC double norm_one(const double4 x) { return ::simd_norm_one(x); } static SIMD_CPPFUNC double norm_one(const double8 x) { return ::simd_norm_one(x); } + static SIMD_CPPFUNC _Float16 norm_inf(const half2 x) { return ::simd_norm_inf(x); } + static SIMD_CPPFUNC _Float16 norm_inf(const half3 x) { return ::simd_norm_inf(x); } + static SIMD_CPPFUNC _Float16 norm_inf(const half4 x) { return ::simd_norm_inf(x); } + static SIMD_CPPFUNC _Float16 norm_inf(const half8 x) { return ::simd_norm_inf(x); } + static SIMD_CPPFUNC _Float16 norm_inf(const half16 x) { return ::simd_norm_inf(x); } + static SIMD_CPPFUNC _Float16 norm_inf(const half32 x) { return ::simd_norm_inf(x); } static SIMD_CPPFUNC float norm_inf(const float2 x) { return ::simd_norm_inf(x); } static SIMD_CPPFUNC float norm_inf(const float3 x) { return ::simd_norm_inf(x); } static SIMD_CPPFUNC float norm_inf(const float4 x) { return ::simd_norm_inf(x); } @@ -633,6 +791,12 @@ namespace simd { static SIMD_CPPFUNC double norm_inf(const double4 x) { return ::simd_norm_inf(x); } static SIMD_CPPFUNC double norm_inf(const double8 x) { return ::simd_norm_inf(x); } + static SIMD_CPPFUNC _Float16 length(const half2 x) { return ::simd_length(x); } + static SIMD_CPPFUNC _Float16 length(const half3 x) { return ::simd_length(x); } + static SIMD_CPPFUNC _Float16 length(const half4 x) { return ::simd_length(x); } + static SIMD_CPPFUNC _Float16 length(const half8 x) { return ::simd_length(x); } + static SIMD_CPPFUNC _Float16 length(const half16 x) { return ::simd_length(x); } + static SIMD_CPPFUNC _Float16 length(const half32 x) { return ::simd_length(x); } static SIMD_CPPFUNC float length(const float2 x) { return ::simd_length(x); } static SIMD_CPPFUNC float length(const float3 x) { return ::simd_length(x); } static SIMD_CPPFUNC float length(const float4 x) { return ::simd_length(x); } @@ -643,6 +807,12 @@ namespace simd { static SIMD_CPPFUNC double length(const double4 x) { return ::simd_length(x); } static SIMD_CPPFUNC double length(const double8 x) { return ::simd_length(x); } + static SIMD_CPPFUNC _Float16 distance_squared(const half2 x, const half2 y) { return ::simd_distance_squared(x, y); } + static SIMD_CPPFUNC _Float16 distance_squared(const half3 x, const half3 y) { return ::simd_distance_squared(x, y); } + static SIMD_CPPFUNC _Float16 distance_squared(const half4 x, const half4 y) { return ::simd_distance_squared(x, y); } + static SIMD_CPPFUNC _Float16 distance_squared(const half8 x, const half8 y) { return ::simd_distance_squared(x, y); } + static SIMD_CPPFUNC _Float16 distance_squared(const half16 x, const half16 y) { return ::simd_distance_squared(x, y); } + static SIMD_CPPFUNC _Float16 distance_squared(const half32 x, const half32 y) { return ::simd_distance_squared(x, y); } static SIMD_CPPFUNC float distance_squared(const float2 x, const float2 y) { return ::simd_distance_squared(x, y); } static SIMD_CPPFUNC float distance_squared(const float3 x, const float3 y) { return ::simd_distance_squared(x, y); } static SIMD_CPPFUNC float distance_squared(const float4 x, const float4 y) { return ::simd_distance_squared(x, y); } @@ -653,6 +823,12 @@ namespace simd { static SIMD_CPPFUNC double distance_squared(const double4 x, const double4 y) { return ::simd_distance_squared(x, y); } static SIMD_CPPFUNC double distance_squared(const double8 x, const double8 y) { return ::simd_distance_squared(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half2 x, const half2 y) { return ::simd_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half3 x, const half3 y) { return ::simd_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half4 x, const half4 y) { return ::simd_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half8 x, const half8 y) { return ::simd_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half16 x, const half16 y) { return ::simd_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half32 x, const half32 y) { return ::simd_distance(x, y); } static SIMD_CPPFUNC float distance(const float2 x, const float2 y) { return ::simd_distance(x, y); } static SIMD_CPPFUNC float distance(const float3 x, const float3 y) { return ::simd_distance(x, y); } static SIMD_CPPFUNC float distance(const float4 x, const float4 y) { return ::simd_distance(x, y); } @@ -663,6 +839,12 @@ namespace simd { static SIMD_CPPFUNC double distance(const double4 x, const double4 y) { return ::simd_distance(x, y); } static SIMD_CPPFUNC double distance(const double8 x, const double8 y) { return ::simd_distance(x, y); } + static SIMD_CPPFUNC half2 normalize(const half2 x) { return ::simd_normalize(x); } + static SIMD_CPPFUNC half3 normalize(const half3 x) { return ::simd_normalize(x); } + static SIMD_CPPFUNC half4 normalize(const half4 x) { return ::simd_normalize(x); } + static SIMD_CPPFUNC half8 normalize(const half8 x) { return ::simd_normalize(x); } + static SIMD_CPPFUNC half16 normalize(const half16 x) { return ::simd_normalize(x); } + static SIMD_CPPFUNC half32 normalize(const half32 x) { return ::simd_normalize(x); } static SIMD_CPPFUNC float2 normalize(const float2 x) { return ::simd_normalize(x); } static SIMD_CPPFUNC float3 normalize(const float3 x) { return ::simd_normalize(x); } static SIMD_CPPFUNC float4 normalize(const float4 x) { return ::simd_normalize(x); } @@ -673,18 +855,28 @@ namespace simd { static SIMD_CPPFUNC double4 normalize(const double4 x) { return ::simd_normalize(x); } static SIMD_CPPFUNC double8 normalize(const double8 x) { return ::simd_normalize(x); } + static SIMD_CPPFUNC half3 cross(const half2 x, const half2 y) { return ::simd_cross(x,y); } + static SIMD_CPPFUNC half3 cross(const half3 x, const half3 y) { return ::simd_cross(x,y); } static SIMD_CPPFUNC float3 cross(const float2 x, const float2 y) { return ::simd_cross(x,y); } static SIMD_CPPFUNC float3 cross(const float3 x, const float3 y) { return ::simd_cross(x,y); } static SIMD_CPPFUNC double3 cross(const double2 x, const double2 y) { return ::simd_cross(x,y); } static SIMD_CPPFUNC double3 cross(const double3 x, const double3 y) { return ::simd_cross(x,y); } + static SIMD_CPPFUNC half2 reflect(const half2 x, const half2 n) { return ::simd_reflect(x,n); } + static SIMD_CPPFUNC half3 reflect(const half3 x, const half3 n) { return ::simd_reflect(x,n); } + static SIMD_CPPFUNC half4 reflect(const half4 x, const half4 n) { return ::simd_reflect(x,n); } static SIMD_CPPFUNC float2 reflect(const float2 x, const float2 n) { return ::simd_reflect(x,n); } static SIMD_CPPFUNC float3 reflect(const float3 x, const float3 n) { return ::simd_reflect(x,n); } static SIMD_CPPFUNC float4 reflect(const float4 x, const float4 n) { return ::simd_reflect(x,n); } static SIMD_CPPFUNC double2 reflect(const double2 x, const double2 n) { return ::simd_reflect(x,n); } static SIMD_CPPFUNC double3 reflect(const double3 x, const double3 n) { return ::simd_reflect(x,n); } static SIMD_CPPFUNC double4 reflect(const double4 x, const double4 n) { return ::simd_reflect(x,n); } - + +#if SIMD_LIBRARY_VERSION >= 6 + static SIMD_CPPFUNC half2 refract(const half2 x, const half2 n, const _Float16 eta) { return ::simd_refract(x,n,eta); } + static SIMD_CPPFUNC half3 refract(const half3 x, const half3 n, const _Float16 eta) { return ::simd_refract(x,n,eta); } + static SIMD_CPPFUNC half4 refract(const half4 x, const half4 n, const _Float16 eta) { return ::simd_refract(x,n,eta); } +#endif // SIMD_LIBRARY_VERSION >= 6 static SIMD_CPPFUNC float2 refract(const float2 x, const float2 n, const float eta) { return ::simd_refract(x,n,eta); } static SIMD_CPPFUNC float3 refract(const float3 x, const float3 n, const float eta) { return ::simd_refract(x,n,eta); } static SIMD_CPPFUNC float4 refract(const float4 x, const float4 n, const float eta) { return ::simd_refract(x,n,eta); } @@ -703,8 +895,21 @@ namespace simd { static SIMD_CPPFUNC double orient(const double3 a, const double3 b, const double3 c, const double3 d) { return ::simd_orient(a,b,c,d); } #endif +#if SIMD_LIBRARY_VERSION >= 6 + static SIMD_CPPFUNC _Float16 orient(const half2 x, const half2 y) { return ::simd_orient(x,y); } + static SIMD_CPPFUNC _Float16 orient(const half2 a, const half2 b, const half2 c) { return ::simd_orient(a,b,c); } + static SIMD_CPPFUNC _Float16 orient(const half3 x, const half3 y, const half3 z) { return ::simd_orient(x,y,z); } + static SIMD_CPPFUNC _Float16 orient(const half3 a, const half3 b, const half3 c, const half3 d) { return ::simd_orient(a,b,c,d); } +#endif + /* precise and fast sub-namespaces */ namespace precise { + static SIMD_CPPFUNC half2 project(const half2 x, const half2 y) { return ::simd_precise_project(x, y); } + static SIMD_CPPFUNC half3 project(const half3 x, const half3 y) { return ::simd_precise_project(x, y); } + static SIMD_CPPFUNC half4 project(const half4 x, const half4 y) { return ::simd_precise_project(x, y); } + static SIMD_CPPFUNC half8 project(const half8 x, const half8 y) { return ::simd_precise_project(x, y); } + static SIMD_CPPFUNC half16 project(const half16 x, const half16 y) { return ::simd_precise_project(x, y); } + static SIMD_CPPFUNC half32 project(const half32 x, const half32 y) { return ::simd_precise_project(x, y); } static SIMD_CPPFUNC float2 project(const float2 x, const float2 y) { return ::simd_precise_project(x, y); } static SIMD_CPPFUNC float3 project(const float3 x, const float3 y) { return ::simd_precise_project(x, y); } static SIMD_CPPFUNC float4 project(const float4 x, const float4 y) { return ::simd_precise_project(x, y); } @@ -714,7 +919,15 @@ namespace simd { static SIMD_CPPFUNC double3 project(const double3 x, const double3 y) { return ::simd_precise_project(x, y); } static SIMD_CPPFUNC double4 project(const double4 x, const double4 y) { return ::simd_precise_project(x, y); } static SIMD_CPPFUNC double8 project(const double8 x, const double8 y) { return ::simd_precise_project(x, y); } - + +#if SIMD_LIBRARY_VERSION >= 6 + static SIMD_CPPFUNC _Float16 length(const half2 x) { return ::simd_precise_length(x); } + static SIMD_CPPFUNC _Float16 length(const half3 x) { return ::simd_precise_length(x); } + static SIMD_CPPFUNC _Float16 length(const half4 x) { return ::simd_precise_length(x); } + static SIMD_CPPFUNC _Float16 length(const half8 x) { return ::simd_precise_length(x); } + static SIMD_CPPFUNC _Float16 length(const half16 x) { return ::simd_precise_length(x); } + static SIMD_CPPFUNC _Float16 length(const half32 x) { return ::simd_precise_length(x); } +#endif // #if SIMD_LIBRARY_VERSION >= 6 static SIMD_CPPFUNC float length(const float2 x) { return ::simd_precise_length(x); } static SIMD_CPPFUNC float length(const float3 x) { return ::simd_precise_length(x); } static SIMD_CPPFUNC float length(const float4 x) { return ::simd_precise_length(x); } @@ -725,6 +938,12 @@ namespace simd { static SIMD_CPPFUNC double length(const double4 x) { return ::simd_precise_length(x); } static SIMD_CPPFUNC double length(const double8 x) { return ::simd_precise_length(x); } + static SIMD_CPPFUNC _Float16 distance(const half2 x, const half2 y) { return ::simd_precise_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half3 x, const half3 y) { return ::simd_precise_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half4 x, const half4 y) { return ::simd_precise_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half8 x, const half8 y) { return ::simd_precise_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half16 x, const half16 y) { return ::simd_precise_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half32 x, const half32 y) { return ::simd_precise_distance(x, y); } static SIMD_CPPFUNC float distance(const float2 x, const float2 y) { return ::simd_precise_distance(x, y); } static SIMD_CPPFUNC float distance(const float3 x, const float3 y) { return ::simd_precise_distance(x, y); } static SIMD_CPPFUNC float distance(const float4 x, const float4 y) { return ::simd_precise_distance(x, y); } @@ -735,6 +954,12 @@ namespace simd { static SIMD_CPPFUNC double distance(const double4 x, const double4 y) { return ::simd_precise_distance(x, y); } static SIMD_CPPFUNC double distance(const double8 x, const double8 y) { return ::simd_precise_distance(x, y); } + static SIMD_CPPFUNC half2 normalize(const half2 x) { return ::simd_precise_normalize(x); } + static SIMD_CPPFUNC half3 normalize(const half3 x) { return ::simd_precise_normalize(x); } + static SIMD_CPPFUNC half4 normalize(const half4 x) { return ::simd_precise_normalize(x); } + static SIMD_CPPFUNC half8 normalize(const half8 x) { return ::simd_precise_normalize(x); } + static SIMD_CPPFUNC half16 normalize(const half16 x) { return ::simd_precise_normalize(x); } + static SIMD_CPPFUNC half32 normalize(const half32 x) { return ::simd_precise_normalize(x); } static SIMD_CPPFUNC float2 normalize(const float2 x) { return ::simd_precise_normalize(x); } static SIMD_CPPFUNC float3 normalize(const float3 x) { return ::simd_precise_normalize(x); } static SIMD_CPPFUNC float4 normalize(const float4 x) { return ::simd_precise_normalize(x); } @@ -747,6 +972,12 @@ namespace simd { } namespace fast { + static SIMD_CPPFUNC half2 project(const half2 x, const half2 y) { return ::simd_fast_project(x, y); } + static SIMD_CPPFUNC half3 project(const half3 x, const half3 y) { return ::simd_fast_project(x, y); } + static SIMD_CPPFUNC half4 project(const half4 x, const half4 y) { return ::simd_fast_project(x, y); } + static SIMD_CPPFUNC half8 project(const half8 x, const half8 y) { return ::simd_fast_project(x, y); } + static SIMD_CPPFUNC half16 project(const half16 x, const half16 y) { return ::simd_fast_project(x, y); } + static SIMD_CPPFUNC half32 project(const half32 x, const half32 y) { return ::simd_fast_project(x, y); } static SIMD_CPPFUNC float2 project(const float2 x, const float2 y) { return ::simd_fast_project(x, y); } static SIMD_CPPFUNC float3 project(const float3 x, const float3 y) { return ::simd_fast_project(x, y); } static SIMD_CPPFUNC float4 project(const float4 x, const float4 y) { return ::simd_fast_project(x, y); } @@ -757,6 +988,12 @@ namespace simd { static SIMD_CPPFUNC double4 project(const double4 x, const double4 y) { return ::simd_fast_project(x, y); } static SIMD_CPPFUNC double8 project(const double8 x, const double8 y) { return ::simd_fast_project(x, y); } + static SIMD_CPPFUNC _Float16 length(const half2 x) { return ::simd_fast_length(x); } + static SIMD_CPPFUNC _Float16 length(const half3 x) { return ::simd_fast_length(x); } + static SIMD_CPPFUNC _Float16 length(const half4 x) { return ::simd_fast_length(x); } + static SIMD_CPPFUNC _Float16 length(const half8 x) { return ::simd_fast_length(x); } + static SIMD_CPPFUNC _Float16 length(const half16 x) { return ::simd_fast_length(x); } + static SIMD_CPPFUNC _Float16 length(const half32 x) { return ::simd_fast_length(x); } static SIMD_CPPFUNC float length(const float2 x) { return ::simd_fast_length(x); } static SIMD_CPPFUNC float length(const float3 x) { return ::simd_fast_length(x); } static SIMD_CPPFUNC float length(const float4 x) { return ::simd_fast_length(x); } @@ -767,6 +1004,12 @@ namespace simd { static SIMD_CPPFUNC double length(const double4 x) { return ::simd_fast_length(x); } static SIMD_CPPFUNC double length(const double8 x) { return ::simd_fast_length(x); } + static SIMD_CPPFUNC _Float16 distance(const half2 x, const half2 y) { return ::simd_fast_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half3 x, const half3 y) { return ::simd_fast_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half4 x, const half4 y) { return ::simd_fast_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half8 x, const half8 y) { return ::simd_fast_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half16 x, const half16 y) { return ::simd_fast_distance(x, y); } + static SIMD_CPPFUNC _Float16 distance(const half32 x, const half32 y) { return ::simd_fast_distance(x, y); } static SIMD_CPPFUNC float distance(const float2 x, const float2 y) { return ::simd_fast_distance(x, y); } static SIMD_CPPFUNC float distance(const float3 x, const float3 y) { return ::simd_fast_distance(x, y); } static SIMD_CPPFUNC float distance(const float4 x, const float4 y) { return ::simd_fast_distance(x, y); } @@ -777,6 +1020,12 @@ namespace simd { static SIMD_CPPFUNC double distance(const double4 x, const double4 y) { return ::simd_fast_distance(x, y); } static SIMD_CPPFUNC double distance(const double8 x, const double8 y) { return ::simd_fast_distance(x, y); } + static SIMD_CPPFUNC half2 normalize(const half2 x) { return ::simd_fast_normalize(x); } + static SIMD_CPPFUNC half3 normalize(const half3 x) { return ::simd_fast_normalize(x); } + static SIMD_CPPFUNC half4 normalize(const half4 x) { return ::simd_fast_normalize(x); } + static SIMD_CPPFUNC half8 normalize(const half8 x) { return ::simd_fast_normalize(x); } + static SIMD_CPPFUNC half16 normalize(const half16 x) { return ::simd_fast_normalize(x); } + static SIMD_CPPFUNC half32 normalize(const half32 x) { return ::simd_fast_normalize(x); } static SIMD_CPPFUNC float2 normalize(const float2 x) { return ::simd_fast_normalize(x); } static SIMD_CPPFUNC float3 normalize(const float3 x) { return ::simd_fast_normalize(x); } static SIMD_CPPFUNC float4 normalize(const float4 x) { return ::simd_fast_normalize(x); } @@ -794,6 +1043,12 @@ extern "C" { #pragma mark - Implementation +static _Float16 SIMD_CFUNC simd_dot(simd_half2 __x, simd_half2 __y) { return simd_reduce_add(__x*__y); } +static _Float16 SIMD_CFUNC simd_dot(simd_half3 __x, simd_half3 __y) { return simd_reduce_add(__x*__y); } +static _Float16 SIMD_CFUNC simd_dot(simd_half4 __x, simd_half4 __y) { return simd_reduce_add(__x*__y); } +static _Float16 SIMD_CFUNC simd_dot(simd_half8 __x, simd_half8 __y) { return simd_reduce_add(__x*__y); } +static _Float16 SIMD_CFUNC simd_dot(simd_half16 __x, simd_half16 __y) { return simd_reduce_add(__x*__y); } +static _Float16 SIMD_CFUNC simd_dot(simd_half32 __x, simd_half32 __y) { return simd_reduce_add(__x*__y); } static float SIMD_CFUNC simd_dot(simd_float2 __x, simd_float2 __y) { return simd_reduce_add(__x*__y); } static float SIMD_CFUNC simd_dot(simd_float3 __x, simd_float3 __y) { return simd_reduce_add(__x*__y); } static float SIMD_CFUNC simd_dot(simd_float4 __x, simd_float4 __y) { return simd_reduce_add(__x*__y); } @@ -804,6 +1059,12 @@ static double SIMD_CFUNC simd_dot(simd_double3 __x, simd_double3 __y) { return s static double SIMD_CFUNC simd_dot(simd_double4 __x, simd_double4 __y) { return simd_reduce_add(__x*__y); } static double SIMD_CFUNC simd_dot(simd_double8 __x, simd_double8 __y) { return simd_reduce_add(__x*__y); } +static simd_half2 SIMD_CFUNC simd_precise_project(simd_half2 __x, simd_half2 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } +static simd_half3 SIMD_CFUNC simd_precise_project(simd_half3 __x, simd_half3 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } +static simd_half4 SIMD_CFUNC simd_precise_project(simd_half4 __x, simd_half4 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } +static simd_half8 SIMD_CFUNC simd_precise_project(simd_half8 __x, simd_half8 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } +static simd_half16 SIMD_CFUNC simd_precise_project(simd_half16 __x, simd_half16 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } +static simd_half32 SIMD_CFUNC simd_precise_project(simd_half32 __x, simd_half32 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } static simd_float2 SIMD_CFUNC simd_precise_project(simd_float2 __x, simd_float2 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } static simd_float3 SIMD_CFUNC simd_precise_project(simd_float3 __x, simd_float3 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } static simd_float4 SIMD_CFUNC simd_precise_project(simd_float4 __x, simd_float4 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } @@ -814,6 +1075,12 @@ static simd_double3 SIMD_CFUNC simd_precise_project(simd_double3 __x, simd_doubl static simd_double4 SIMD_CFUNC simd_precise_project(simd_double4 __x, simd_double4 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } static simd_double8 SIMD_CFUNC simd_precise_project(simd_double8 __x, simd_double8 __y) { return simd_dot(__x,__y)/simd_dot(__y,__y)*__y; } +static simd_half2 SIMD_CFUNC simd_fast_project(simd_half2 __x, simd_half2 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } +static simd_half3 SIMD_CFUNC simd_fast_project(simd_half3 __x, simd_half3 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } +static simd_half4 SIMD_CFUNC simd_fast_project(simd_half4 __x, simd_half4 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } +static simd_half8 SIMD_CFUNC simd_fast_project(simd_half8 __x, simd_half8 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } +static simd_half16 SIMD_CFUNC simd_fast_project(simd_half16 __x, simd_half16 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } +static simd_half32 SIMD_CFUNC simd_fast_project(simd_half32 __x, simd_half32 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } static simd_float2 SIMD_CFUNC simd_fast_project(simd_float2 __x, simd_float2 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } static simd_float3 SIMD_CFUNC simd_fast_project(simd_float3 __x, simd_float3 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } static simd_float4 SIMD_CFUNC simd_fast_project(simd_float4 __x, simd_float4 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } @@ -825,6 +1092,12 @@ static simd_double4 SIMD_CFUNC simd_fast_project(simd_double4 __x, simd_double4 static simd_double8 SIMD_CFUNC simd_fast_project(simd_double8 __x, simd_double8 __y) { return __y*simd_dot(__x,__y)*simd_fast_recip(simd_dot(__y,__y)); } #if defined __FAST_MATH__ +static simd_half2 SIMD_CFUNC simd_project(simd_half2 __x, simd_half2 __y) { return simd_fast_project(__x,__y); } +static simd_half3 SIMD_CFUNC simd_project(simd_half3 __x, simd_half3 __y) { return simd_fast_project(__x,__y); } +static simd_half4 SIMD_CFUNC simd_project(simd_half4 __x, simd_half4 __y) { return simd_fast_project(__x,__y); } +static simd_half8 SIMD_CFUNC simd_project(simd_half8 __x, simd_half8 __y) { return simd_fast_project(__x,__y); } +static simd_half16 SIMD_CFUNC simd_project(simd_half16 __x, simd_half16 __y) { return simd_fast_project(__x,__y); } +static simd_half32 SIMD_CFUNC simd_project(simd_half32 __x, simd_half32 __y) { return simd_fast_project(__x,__y); } static simd_float2 SIMD_CFUNC simd_project(simd_float2 __x, simd_float2 __y) { return simd_fast_project(__x,__y); } static simd_float3 SIMD_CFUNC simd_project(simd_float3 __x, simd_float3 __y) { return simd_fast_project(__x,__y); } static simd_float4 SIMD_CFUNC simd_project(simd_float4 __x, simd_float4 __y) { return simd_fast_project(__x,__y); } @@ -835,6 +1108,12 @@ static simd_double3 SIMD_CFUNC simd_project(simd_double3 __x, simd_double3 __y) static simd_double4 SIMD_CFUNC simd_project(simd_double4 __x, simd_double4 __y) { return simd_fast_project(__x,__y); } static simd_double8 SIMD_CFUNC simd_project(simd_double8 __x, simd_double8 __y) { return simd_fast_project(__x,__y); } #else +static simd_half2 SIMD_CFUNC simd_project(simd_half2 __x, simd_half2 __y) { return simd_precise_project(__x,__y); } +static simd_half3 SIMD_CFUNC simd_project(simd_half3 __x, simd_half3 __y) { return simd_precise_project(__x,__y); } +static simd_half4 SIMD_CFUNC simd_project(simd_half4 __x, simd_half4 __y) { return simd_precise_project(__x,__y); } +static simd_half8 SIMD_CFUNC simd_project(simd_half8 __x, simd_half8 __y) { return simd_precise_project(__x,__y); } +static simd_half16 SIMD_CFUNC simd_project(simd_half16 __x, simd_half16 __y) { return simd_precise_project(__x,__y); } +static simd_half32 SIMD_CFUNC simd_project(simd_half32 __x, simd_half32 __y) { return simd_precise_project(__x,__y); } static simd_float2 SIMD_CFUNC simd_project(simd_float2 __x, simd_float2 __y) { return simd_precise_project(__x,__y); } static simd_float3 SIMD_CFUNC simd_project(simd_float3 __x, simd_float3 __y) { return simd_precise_project(__x,__y); } static simd_float4 SIMD_CFUNC simd_project(simd_float4 __x, simd_float4 __y) { return simd_precise_project(__x,__y); } @@ -846,6 +1125,14 @@ static simd_double4 SIMD_CFUNC simd_project(simd_double4 __x, simd_double4 __y) static simd_double8 SIMD_CFUNC simd_project(simd_double8 __x, simd_double8 __y) { return simd_precise_project(__x,__y); } #endif +#if SIMD_LIBRARY_VERSION >= 6 +static _Float16 SIMD_CFUNC simd_precise_length(simd_half2 __x) { return __sqrtf16(simd_length_squared(__x)); } +static _Float16 SIMD_CFUNC simd_precise_length(simd_half3 __x) { return __sqrtf16(simd_length_squared(__x)); } +static _Float16 SIMD_CFUNC simd_precise_length(simd_half4 __x) { return __sqrtf16(simd_length_squared(__x)); } +static _Float16 SIMD_CFUNC simd_precise_length(simd_half8 __x) { return __sqrtf16(simd_length_squared(__x)); } +static _Float16 SIMD_CFUNC simd_precise_length(simd_half16 __x) { return __sqrtf16(simd_length_squared(__x)); } +static _Float16 SIMD_CFUNC simd_precise_length(simd_half32 __x) { return __sqrtf16(simd_length_squared(__x)); } +#endif // SIMD_LIBRARY_VERSION >= 6 static float SIMD_CFUNC simd_precise_length(simd_float2 __x) { return sqrtf(simd_length_squared(__x)); } static float SIMD_CFUNC simd_precise_length(simd_float3 __x) { return sqrtf(simd_length_squared(__x)); } static float SIMD_CFUNC simd_precise_length(simd_float4 __x) { return sqrtf(simd_length_squared(__x)); } @@ -855,7 +1142,14 @@ static double SIMD_CFUNC simd_precise_length(simd_double2 __x) { return sqrt(sim static double SIMD_CFUNC simd_precise_length(simd_double3 __x) { return sqrt(simd_length_squared(__x)); } static double SIMD_CFUNC simd_precise_length(simd_double4 __x) { return sqrt(simd_length_squared(__x)); } static double SIMD_CFUNC simd_precise_length(simd_double8 __x) { return sqrt(simd_length_squared(__x)); } - +#if SIMD_LIBRARY_VERSION >= 6 +static _Float16 SIMD_CFUNC simd_fast_length(simd_half2 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_fast_length(simd_half3 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_fast_length(simd_half4 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_fast_length(simd_half8 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_fast_length(simd_half16 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_fast_length(simd_half32 __x) { return simd_precise_length(__x); } +#endif // SIMD_LIBRARY_VERSION >= 6 static float SIMD_CFUNC simd_fast_length(simd_float2 __x) { return simd_precise_length(__x); } static float SIMD_CFUNC simd_fast_length(simd_float3 __x) { return simd_precise_length(__x); } static float SIMD_CFUNC simd_fast_length(simd_float4 __x) { return simd_precise_length(__x); } @@ -867,6 +1161,12 @@ static double SIMD_CFUNC simd_fast_length(simd_double4 __x) { return simd_precis static double SIMD_CFUNC simd_fast_length(simd_double8 __x) { return simd_precise_length(__x); } #if defined __FAST_MATH__ +static _Float16 SIMD_CFUNC simd_length(simd_half2 __x) { return simd_fast_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half3 __x) { return simd_fast_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half4 __x) { return simd_fast_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half8 __x) { return simd_fast_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half16 __x) { return simd_fast_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half32 __x) { return simd_fast_length(__x); } static float SIMD_CFUNC simd_length(simd_float2 __x) { return simd_fast_length(__x); } static float SIMD_CFUNC simd_length(simd_float3 __x) { return simd_fast_length(__x); } static float SIMD_CFUNC simd_length(simd_float4 __x) { return simd_fast_length(__x); } @@ -877,6 +1177,14 @@ static double SIMD_CFUNC simd_length(simd_double3 __x) { return simd_fast_length static double SIMD_CFUNC simd_length(simd_double4 __x) { return simd_fast_length(__x); } static double SIMD_CFUNC simd_length(simd_double8 __x) { return simd_fast_length(__x); } #else +#if SIMD_LIBRARY_VERSION >= 6 +static _Float16 SIMD_CFUNC simd_length(simd_half2 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half3 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half4 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half8 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half16 __x) { return simd_precise_length(__x); } +static _Float16 SIMD_CFUNC simd_length(simd_half32 __x) { return simd_precise_length(__x); } +#endif // SIMD_LIBRARY_VERSION >= 6 static float SIMD_CFUNC simd_length(simd_float2 __x) { return simd_precise_length(__x); } static float SIMD_CFUNC simd_length(simd_float3 __x) { return simd_precise_length(__x); } static float SIMD_CFUNC simd_length(simd_float4 __x) { return simd_precise_length(__x); } @@ -888,6 +1196,12 @@ static double SIMD_CFUNC simd_length(simd_double4 __x) { return simd_precise_len static double SIMD_CFUNC simd_length(simd_double8 __x) { return simd_precise_length(__x); } #endif +static _Float16 SIMD_CFUNC simd_length_squared(simd_half2 __x) { return simd_dot(__x,__x); } +static _Float16 SIMD_CFUNC simd_length_squared(simd_half3 __x) { return simd_dot(__x,__x); } +static _Float16 SIMD_CFUNC simd_length_squared(simd_half4 __x) { return simd_dot(__x,__x); } +static _Float16 SIMD_CFUNC simd_length_squared(simd_half8 __x) { return simd_dot(__x,__x); } +static _Float16 SIMD_CFUNC simd_length_squared(simd_half16 __x) { return simd_dot(__x,__x); } +static _Float16 SIMD_CFUNC simd_length_squared(simd_half32 __x) { return simd_dot(__x,__x); } static float SIMD_CFUNC simd_length_squared(simd_float2 __x) { return simd_dot(__x,__x); } static float SIMD_CFUNC simd_length_squared(simd_float3 __x) { return simd_dot(__x,__x); } static float SIMD_CFUNC simd_length_squared(simd_float4 __x) { return simd_dot(__x,__x); } @@ -898,6 +1212,12 @@ static double SIMD_CFUNC simd_length_squared(simd_double3 __x) { return simd_dot static double SIMD_CFUNC simd_length_squared(simd_double4 __x) { return simd_dot(__x,__x); } static double SIMD_CFUNC simd_length_squared(simd_double8 __x) { return simd_dot(__x,__x); } +static _Float16 SIMD_CFUNC simd_norm_one(simd_half2 __x) { return simd_reduce_add(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_one(simd_half3 __x) { return simd_reduce_add(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_one(simd_half4 __x) { return simd_reduce_add(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_one(simd_half8 __x) { return simd_reduce_add(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_one(simd_half16 __x) { return simd_reduce_add(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_one(simd_half32 __x) { return simd_reduce_add(__tg_fabs(__x)); } static float SIMD_CFUNC simd_norm_one(simd_float2 __x) { return simd_reduce_add(__tg_fabs(__x)); } static float SIMD_CFUNC simd_norm_one(simd_float3 __x) { return simd_reduce_add(__tg_fabs(__x)); } static float SIMD_CFUNC simd_norm_one(simd_float4 __x) { return simd_reduce_add(__tg_fabs(__x)); } @@ -908,6 +1228,12 @@ static double SIMD_CFUNC simd_norm_one(simd_double3 __x) { return simd_reduce_ad static double SIMD_CFUNC simd_norm_one(simd_double4 __x) { return simd_reduce_add(__tg_fabs(__x)); } static double SIMD_CFUNC simd_norm_one(simd_double8 __x) { return simd_reduce_add(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half2 __x) { return simd_reduce_max(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half3 __x) { return simd_reduce_max(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half4 __x) { return simd_reduce_max(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half8 __x) { return simd_reduce_max(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half16 __x) { return simd_reduce_max(__tg_fabs(__x)); } +static _Float16 SIMD_CFUNC simd_norm_inf(simd_half32 __x) { return simd_reduce_max(__tg_fabs(__x)); } static float SIMD_CFUNC simd_norm_inf(simd_float2 __x) { return simd_reduce_max(__tg_fabs(__x)); } static float SIMD_CFUNC simd_norm_inf(simd_float3 __x) { return simd_reduce_max(__tg_fabs(__x)); } static float SIMD_CFUNC simd_norm_inf(simd_float4 __x) { return simd_reduce_max(__tg_fabs(__x)); } @@ -918,6 +1244,14 @@ static double SIMD_CFUNC simd_norm_inf(simd_double3 __x) { return simd_reduce_ma static double SIMD_CFUNC simd_norm_inf(simd_double4 __x) { return simd_reduce_max(__tg_fabs(__x)); } static double SIMD_CFUNC simd_norm_inf(simd_double8 __x) { return simd_reduce_max(__tg_fabs(__x)); } +#if SIMD_LIBRARY_VERSION >= 6 +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half2 __x, simd_half2 __y) { return simd_precise_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half3 __x, simd_half3 __y) { return simd_precise_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half4 __x, simd_half4 __y) { return simd_precise_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half8 __x, simd_half8 __y) { return simd_precise_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half16 __x, simd_half16 __y) { return simd_precise_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_precise_distance(simd_half32 __x, simd_half32 __y) { return simd_precise_length(__x - __y); } +#endif // SIMD_LIBRARY_VERSION >= 6 static float SIMD_CFUNC simd_precise_distance(simd_float2 __x, simd_float2 __y) { return simd_precise_length(__x - __y); } static float SIMD_CFUNC simd_precise_distance(simd_float3 __x, simd_float3 __y) { return simd_precise_length(__x - __y); } static float SIMD_CFUNC simd_precise_distance(simd_float4 __x, simd_float4 __y) { return simd_precise_length(__x - __y); } @@ -928,6 +1262,12 @@ static double SIMD_CFUNC simd_precise_distance(simd_double3 __x, simd_double3 __ static double SIMD_CFUNC simd_precise_distance(simd_double4 __x, simd_double4 __y) { return simd_precise_length(__x - __y); } static double SIMD_CFUNC simd_precise_distance(simd_double8 __x, simd_double8 __y) { return simd_precise_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half2 __x, simd_half2 __y) { return simd_fast_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half3 __x, simd_half3 __y) { return simd_fast_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half4 __x, simd_half4 __y) { return simd_fast_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half8 __x, simd_half8 __y) { return simd_fast_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half16 __x, simd_half16 __y) { return simd_fast_length(__x - __y); } +static _Float16 SIMD_CFUNC simd_fast_distance(simd_half32 __x, simd_half32 __y) { return simd_fast_length(__x - __y); } static float SIMD_CFUNC simd_fast_distance(simd_float2 __x, simd_float2 __y) { return simd_fast_length(__x - __y); } static float SIMD_CFUNC simd_fast_distance(simd_float3 __x, simd_float3 __y) { return simd_fast_length(__x - __y); } static float SIMD_CFUNC simd_fast_distance(simd_float4 __x, simd_float4 __y) { return simd_fast_length(__x - __y); } @@ -939,6 +1279,12 @@ static double SIMD_CFUNC simd_fast_distance(simd_double4 __x, simd_double4 __y) static double SIMD_CFUNC simd_fast_distance(simd_double8 __x, simd_double8 __y) { return simd_fast_length(__x - __y); } #if defined __FAST_MATH__ +static _Float16 SIMD_CFUNC simd_distance(simd_half2 __x, simd_half2 __y) { return simd_fast_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half3 __x, simd_half3 __y) { return simd_fast_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half4 __x, simd_half4 __y) { return simd_fast_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half8 __x, simd_half8 __y) { return simd_fast_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half16 __x, simd_half16 __y) { return simd_fast_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half32 __x, simd_half32 __y) { return simd_fast_distance(__x,__y); } static float SIMD_CFUNC simd_distance(simd_float2 __x, simd_float2 __y) { return simd_fast_distance(__x,__y); } static float SIMD_CFUNC simd_distance(simd_float3 __x, simd_float3 __y) { return simd_fast_distance(__x,__y); } static float SIMD_CFUNC simd_distance(simd_float4 __x, simd_float4 __y) { return simd_fast_distance(__x,__y); } @@ -949,6 +1295,12 @@ static double SIMD_CFUNC simd_distance(simd_double3 __x, simd_double3 __y) { ret static double SIMD_CFUNC simd_distance(simd_double4 __x, simd_double4 __y) { return simd_fast_distance(__x,__y); } static double SIMD_CFUNC simd_distance(simd_double8 __x, simd_double8 __y) { return simd_fast_distance(__x,__y); } #else +static _Float16 SIMD_CFUNC simd_distance(simd_half2 __x, simd_half2 __y) { return simd_precise_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half3 __x, simd_half3 __y) { return simd_precise_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half4 __x, simd_half4 __y) { return simd_precise_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half8 __x, simd_half8 __y) { return simd_precise_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half16 __x, simd_half16 __y) { return simd_precise_distance(__x,__y); } +static _Float16 SIMD_CFUNC simd_distance(simd_half32 __x, simd_half32 __y) { return simd_precise_distance(__x,__y); } static float SIMD_CFUNC simd_distance(simd_float2 __x, simd_float2 __y) { return simd_precise_distance(__x,__y); } static float SIMD_CFUNC simd_distance(simd_float3 __x, simd_float3 __y) { return simd_precise_distance(__x,__y); } static float SIMD_CFUNC simd_distance(simd_float4 __x, simd_float4 __y) { return simd_precise_distance(__x,__y); } @@ -960,6 +1312,12 @@ static double SIMD_CFUNC simd_distance(simd_double4 __x, simd_double4 __y) { ret static double SIMD_CFUNC simd_distance(simd_double8 __x, simd_double8 __y) { return simd_precise_distance(__x,__y); } #endif +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half2 __x, simd_half2 __y) { return simd_length_squared(__x - __y); } +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half3 __x, simd_half3 __y) { return simd_length_squared(__x - __y); } +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half4 __x, simd_half4 __y) { return simd_length_squared(__x - __y); } +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half8 __x, simd_half8 __y) { return simd_length_squared(__x - __y); } +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half16 __x, simd_half16 __y) { return simd_length_squared(__x - __y); } +static _Float16 SIMD_CFUNC simd_distance_squared(simd_half32 __x, simd_half32 __y) { return simd_length_squared(__x - __y); } static float SIMD_CFUNC simd_distance_squared(simd_float2 __x, simd_float2 __y) { return simd_length_squared(__x - __y); } static float SIMD_CFUNC simd_distance_squared(simd_float3 __x, simd_float3 __y) { return simd_length_squared(__x - __y); } static float SIMD_CFUNC simd_distance_squared(simd_float4 __x, simd_float4 __y) { return simd_length_squared(__x - __y); } @@ -970,6 +1328,12 @@ static double SIMD_CFUNC simd_distance_squared(simd_double3 __x, simd_double3 __ static double SIMD_CFUNC simd_distance_squared(simd_double4 __x, simd_double4 __y) { return simd_length_squared(__x - __y); } static double SIMD_CFUNC simd_distance_squared(simd_double8 __x, simd_double8 __y) { return simd_length_squared(__x - __y); } +static simd_half2 SIMD_CFUNC simd_precise_normalize(simd_half2 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } +static simd_half3 SIMD_CFUNC simd_precise_normalize(simd_half3 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } +static simd_half4 SIMD_CFUNC simd_precise_normalize(simd_half4 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } +static simd_half8 SIMD_CFUNC simd_precise_normalize(simd_half8 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } +static simd_half16 SIMD_CFUNC simd_precise_normalize(simd_half16 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } +static simd_half32 SIMD_CFUNC simd_precise_normalize(simd_half32 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } static simd_float2 SIMD_CFUNC simd_precise_normalize(simd_float2 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } static simd_float3 SIMD_CFUNC simd_precise_normalize(simd_float3 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } static simd_float4 SIMD_CFUNC simd_precise_normalize(simd_float4 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } @@ -980,6 +1344,12 @@ static simd_double3 SIMD_CFUNC simd_precise_normalize(simd_double3 __x) { return static simd_double4 SIMD_CFUNC simd_precise_normalize(simd_double4 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } static simd_double8 SIMD_CFUNC simd_precise_normalize(simd_double8 __x) { return __x * simd_precise_rsqrt(simd_length_squared(__x)); } +static simd_half2 SIMD_CFUNC simd_fast_normalize(simd_half2 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } +static simd_half3 SIMD_CFUNC simd_fast_normalize(simd_half3 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } +static simd_half4 SIMD_CFUNC simd_fast_normalize(simd_half4 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } +static simd_half8 SIMD_CFUNC simd_fast_normalize(simd_half8 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } +static simd_half16 SIMD_CFUNC simd_fast_normalize(simd_half16 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } +static simd_half32 SIMD_CFUNC simd_fast_normalize(simd_half32 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } static simd_float2 SIMD_CFUNC simd_fast_normalize(simd_float2 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } static simd_float3 SIMD_CFUNC simd_fast_normalize(simd_float3 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } static simd_float4 SIMD_CFUNC simd_fast_normalize(simd_float4 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } @@ -991,6 +1361,12 @@ static simd_double4 SIMD_CFUNC simd_fast_normalize(simd_double4 __x) { return __ static simd_double8 SIMD_CFUNC simd_fast_normalize(simd_double8 __x) { return __x * simd_fast_rsqrt(simd_length_squared(__x)); } #if defined __FAST_MATH__ +static simd_half2 SIMD_CFUNC simd_normalize(simd_half2 __x) { return simd_fast_normalize(__x); } +static simd_half3 SIMD_CFUNC simd_normalize(simd_half3 __x) { return simd_fast_normalize(__x); } +static simd_half4 SIMD_CFUNC simd_normalize(simd_half4 __x) { return simd_fast_normalize(__x); } +static simd_half8 SIMD_CFUNC simd_normalize(simd_half8 __x) { return simd_fast_normalize(__x); } +static simd_half16 SIMD_CFUNC simd_normalize(simd_half16 __x) { return simd_fast_normalize(__x); } +static simd_half32 SIMD_CFUNC simd_normalize(simd_half32 __x) { return simd_fast_normalize(__x); } static simd_float2 SIMD_CFUNC simd_normalize(simd_float2 __x) { return simd_fast_normalize(__x); } static simd_float3 SIMD_CFUNC simd_normalize(simd_float3 __x) { return simd_fast_normalize(__x); } static simd_float4 SIMD_CFUNC simd_normalize(simd_float4 __x) { return simd_fast_normalize(__x); } @@ -1001,6 +1377,12 @@ static simd_double3 SIMD_CFUNC simd_normalize(simd_double3 __x) { return simd_fa static simd_double4 SIMD_CFUNC simd_normalize(simd_double4 __x) { return simd_fast_normalize(__x); } static simd_double8 SIMD_CFUNC simd_normalize(simd_double8 __x) { return simd_fast_normalize(__x); } #else +static simd_half2 SIMD_CFUNC simd_normalize(simd_half2 __x) { return simd_precise_normalize(__x); } +static simd_half3 SIMD_CFUNC simd_normalize(simd_half3 __x) { return simd_precise_normalize(__x); } +static simd_half4 SIMD_CFUNC simd_normalize(simd_half4 __x) { return simd_precise_normalize(__x); } +static simd_half8 SIMD_CFUNC simd_normalize(simd_half8 __x) { return simd_precise_normalize(__x); } +static simd_half16 SIMD_CFUNC simd_normalize(simd_half16 __x) { return simd_precise_normalize(__x); } +static simd_half32 SIMD_CFUNC simd_normalize(simd_half32 __x) { return simd_precise_normalize(__x); } static simd_float2 SIMD_CFUNC simd_normalize(simd_float2 __x) { return simd_precise_normalize(__x); } static simd_float3 SIMD_CFUNC simd_normalize(simd_float3 __x) { return simd_precise_normalize(__x); } static simd_float4 SIMD_CFUNC simd_normalize(simd_float4 __x) { return simd_precise_normalize(__x); } @@ -1012,11 +1394,16 @@ static simd_double4 SIMD_CFUNC simd_normalize(simd_double4 __x) { return simd_pr static simd_double8 SIMD_CFUNC simd_normalize(simd_double8 __x) { return simd_precise_normalize(__x); } #endif +static simd_half3 SIMD_CFUNC simd_cross(simd_half2 __x, simd_half2 __y) { return (simd_half3){ 0, 0, __x.x*__y.y - __x.y*__y.x }; } +static simd_half3 SIMD_CFUNC simd_cross(simd_half3 __x, simd_half3 __y) { return (__x.zxy*__y - __x*__y.zxy).zxy; } static simd_float3 SIMD_CFUNC simd_cross(simd_float2 __x, simd_float2 __y) { return (simd_float3){ 0, 0, __x.x*__y.y - __x.y*__y.x }; } static simd_float3 SIMD_CFUNC simd_cross(simd_float3 __x, simd_float3 __y) { return (__x.zxy*__y - __x*__y.zxy).zxy; } static simd_double3 SIMD_CFUNC simd_cross(simd_double2 __x, simd_double2 __y) { return (simd_double3){ 0, 0, __x.x*__y.y - __x.y*__y.x }; } static simd_double3 SIMD_CFUNC simd_cross(simd_double3 __x, simd_double3 __y) { return (__x.zxy*__y - __x*__y.zxy).zxy; } +static simd_half2 SIMD_CFUNC simd_reflect(simd_half2 __x, simd_half2 __n) { return __x - 2*simd_dot(__x,__n)*__n; } +static simd_half3 SIMD_CFUNC simd_reflect(simd_half3 __x, simd_half3 __n) { return __x - 2*simd_dot(__x,__n)*__n; } +static simd_half4 SIMD_CFUNC simd_reflect(simd_half4 __x, simd_half4 __n) { return __x - 2*simd_dot(__x,__n)*__n; } static simd_float2 SIMD_CFUNC simd_reflect(simd_float2 __x, simd_float2 __n) { return __x - 2*simd_dot(__x,__n)*__n; } static simd_float3 SIMD_CFUNC simd_reflect(simd_float3 __x, simd_float3 __n) { return __x - 2*simd_dot(__x,__n)*__n; } static simd_float4 SIMD_CFUNC simd_reflect(simd_float4 __x, simd_float4 __n) { return __x - 2*simd_dot(__x,__n)*__n; } @@ -1024,6 +1411,20 @@ static simd_double2 SIMD_CFUNC simd_reflect(simd_double2 __x, simd_double2 __n) static simd_double3 SIMD_CFUNC simd_reflect(simd_double3 __x, simd_double3 __n) { return __x - 2*simd_dot(__x,__n)*__n; } static simd_double4 SIMD_CFUNC simd_reflect(simd_double4 __x, simd_double4 __n) { return __x - 2*simd_dot(__x,__n)*__n; } +#if SIMD_LIBRARY_VERSION >= 6 +static simd_half2 SIMD_CFUNC simd_refract(simd_half2 __x, simd_half2 __n, _Float16 __eta) { + const _Float16 __k = 1.0f16 - __eta*__eta*(1.0f16 - simd_dot(__x,__n)*simd_dot(__x,__n)); + return (__k >= 0.0f16) ? __eta*__x - (__eta*simd_dot(__x,__n) + __sqrtf16(__k))*__n : (simd_half2)0.0f16; +} +static simd_half3 SIMD_CFUNC simd_refract(simd_half3 __x, simd_half3 __n, _Float16 __eta) { + const _Float16 __k = 1.0f16 - __eta*__eta*(1.0f16 - simd_dot(__x,__n)*simd_dot(__x,__n)); + return (__k >= 0.0f16) ? __eta*__x - (__eta*simd_dot(__x,__n) + __sqrtf16(__k))*__n : (simd_half3)0.0f16; +} +static simd_half4 SIMD_CFUNC simd_refract(simd_half4 __x, simd_half4 __n, _Float16 __eta) { + const _Float16 __k = 1.0f16 - __eta*__eta*(1.0f16 - simd_dot(__x,__n)*simd_dot(__x,__n)); + return (__k >= 0.0f16) ? __eta*__x - (__eta*simd_dot(__x,__n) + __sqrtf16(__k))*__n : (simd_half4)0.0f16; +} +#endif // SIMD_LIBRARY_VERSION >= 6 static simd_float2 SIMD_CFUNC simd_refract(simd_float2 __x, simd_float2 __n, float __eta) { const float __k = 1.0f - __eta*__eta*(1.0f - simd_dot(__x,__n)*simd_dot(__x,__n)); return (__k >= 0.0f) ? __eta*__x - (__eta*simd_dot(__x,__n) + sqrt(__k))*__n : (simd_float2)0.0f; @@ -1093,6 +1494,29 @@ static double SIMD_CFUNC simd_insphere(simd_double3 __x, simd_double3 __a, simd_ } #endif /* SIMD_LIBRARY_VERSION */ +#if SIMD_LIBRARY_VERSION >= 6 +static _Float16 SIMD_CFUNC simd_orient(simd_half2 __x, simd_half2 __y) { + return _simd_orient_vh2(__x, __y); +} +static _Float16 SIMD_CFUNC simd_orient(simd_half3 __x, simd_half3 __y, simd_half3 __z) { + return _simd_orient_vh3(__x, __y, __z); +} + +static _Float16 SIMD_CFUNC simd_orient(simd_half2 __a, simd_half2 __b, simd_half2 __c) { + return _simd_orient_ph2(__a, __b, __c); +} +static _Float16 SIMD_CFUNC simd_orient(simd_half3 __a, simd_half3 __b, simd_half3 __c, simd_half3 __d) { + return _simd_orient_ph3(__a, __b, __c, __d); +} + +static _Float16 SIMD_CFUNC simd_incircle(simd_half2 __x, simd_half2 __a, simd_half2 __b, simd_half2 __c) { + return _simd_incircle_ph2(__x, __a, __b, __c); +} +static _Float16 SIMD_CFUNC simd_insphere(simd_half3 __x, simd_half3 __a, simd_half3 __b, simd_half3 __c, simd_half3 __d) { + return _simd_insphere_ph3(__x, __a, __b, __c, __d); +} +#endif /* SIMD_LIBRARY_VERSION */ + #ifdef __cplusplus } #endif diff --git a/lib/libc/include/any-macos-any/simd/logic.h b/lib/libc/include/any-macos-any/simd/logic.h index 0d447a910cc3..de2571f7b37d 100644 --- a/lib/libc/include/any-macos-any/simd/logic.h +++ b/lib/libc/include/any-macos-any/simd/logic.h @@ -343,6 +343,30 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_ulong8 x); * @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_half2 simd_select(simd_half2 x, simd_half2 y, simd_short2 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_half3 simd_select(simd_half3 x, simd_half3 y, simd_short3 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_half4 simd_select(simd_half4 x, simd_half4 y, simd_short4 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_half8 simd_select(simd_half8 x, simd_half8 y, simd_short8 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_half16 simd_select(simd_half16 x, simd_half16 y, simd_short16 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_half32 simd_select(simd_half32 x, simd_half32 y, simd_short32 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. */ @@ -489,6 +513,30 @@ static inline SIMD_CFUNC simd_ushort16 simd_bitselect(simd_ushort16 x, simd_usho * 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_half2 simd_bitselect(simd_half2 x, simd_half2 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_half3 simd_bitselect(simd_half3 x, simd_half3 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_half4 simd_bitselect(simd_half4 x, simd_half4 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_half8 simd_bitselect(simd_half8 x, simd_half8 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_half16 simd_bitselect(simd_half16 x, simd_half16 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_half32 simd_bitselect(simd_half32 x, simd_half32 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. */ @@ -629,7 +677,7 @@ extern "C" { static inline SIMD_CFUNC simd_bool simd_any(simd_char2 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x3); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_any(x.xyxy); #else union { uint16_t i; simd_char2 v; } u = { .v = x }; @@ -639,7 +687,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char2 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_char3 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x7); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_any(x.xyzz); #else union { uint32_t i; simd_char3 v; } u = { .v = x }; @@ -649,7 +697,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char3 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_char4 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xf); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_any(x.xyzwxyzw); #else union { uint32_t i; simd_char4 v; } u = { .v = x }; @@ -659,7 +707,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char4 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_char8 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xff); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxv_u8(x) & 0x80; #else union { uint64_t i; simd_char8 v; } u = { .v = x }; @@ -669,7 +717,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_char8 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_char16 x) { #if defined __SSE2__ return _mm_movemask_epi8((__m128i)x); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxvq_u8(x) & 0x80; #else return simd_any(x.lo | x.hi); @@ -709,7 +757,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_uchar64 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_short2 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xa); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_any(x.xyxy); #else union { uint32_t i; simd_short2 v; } u = { .v = x }; @@ -719,7 +767,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_short2 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_short3 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0x2a); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_any(x.xyzz); #else union { uint64_t i; simd_short3 v; } u = { .v = x }; @@ -729,7 +777,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_short3 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_short4 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xaa); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxv_u16(x) & 0x8000; #else union { uint64_t i; simd_short4 v; } u = { .v = x }; @@ -739,7 +787,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_short4 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_short8 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)x) & 0xaaaa); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxvq_u16(x) & 0x8000; #else return simd_any(x.lo | x.hi); @@ -776,7 +824,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_ushort32 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_int2 x) { #if defined __SSE2__ return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x3); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxv_u32(x) & 0x80000000; #else union { uint64_t i; simd_int2 v; } u = { .v = x }; @@ -786,7 +834,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_int2 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_int3 x) { #if defined __SSE2__ return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x7); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_any(x.xyzz); #else return (x.x | x.y | x.z) & 0x80000000; @@ -795,7 +843,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_int3 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_int4 x) { #if defined __SSE2__ return _mm_movemask_ps((__m128)x); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxvq_u32(x) & 0x80000000; #else return simd_any(x.lo | x.hi); @@ -829,7 +877,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_uint16 x) { static inline SIMD_CFUNC simd_bool simd_any(simd_long2 x) { #if defined __SSE2__ return _mm_movemask_pd((__m128d)x); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return (x.x | x.y) & 0x8000000000000000U; #else return (x.x | x.y) & 0x8000000000000000U; @@ -868,7 +916,7 @@ static inline SIMD_CFUNC simd_bool simd_any(simd_ulong8 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_char2 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x3) == 0x3; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_all(x.xyxy); #else union { uint16_t i; simd_char2 v; } u = { .v = x }; @@ -878,7 +926,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char2 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_char3 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0x7) == 0x7; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_all(x.xyzz); #else union { uint32_t i; simd_char3 v; } u = { .v = x }; @@ -888,7 +936,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char3 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_char4 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xf) == 0xf; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_all(x.xyzwxyzw); #else union { uint32_t i; simd_char4 v; } u = { .v = x }; @@ -898,7 +946,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char4 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_char8 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_char16_undef(x)) & 0xff) == 0xff; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminv_u8(x) & 0x80; #else union { uint64_t i; simd_char8 v; } u = { .v = x }; @@ -908,7 +956,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_char8 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_char16 x) { #if defined __SSE2__ return _mm_movemask_epi8((__m128i)x) == 0xffff; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminvq_u8(x) & 0x80; #else return simd_all(x.lo & x.hi); @@ -948,7 +996,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_uchar64 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_short2 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xa) == 0xa; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_all(x.xyxy); #else union { uint32_t i; simd_short2 v; } u = { .v = x }; @@ -958,7 +1006,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_short2 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_short3 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0x2a) == 0x2a; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_all(x.xyzz); #else union { uint64_t i; simd_short3 v; } u = { .v = x }; @@ -968,7 +1016,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_short3 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_short4 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)simd_make_short8_undef(x)) & 0xaa) == 0xaa; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminv_u16(x) & 0x8000; #else union { uint64_t i; simd_short4 v; } u = { .v = x }; @@ -978,7 +1026,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_short4 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_short8 x) { #if defined __SSE2__ return (_mm_movemask_epi8((__m128i)x) & 0xaaaa) == 0xaaaa; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminvq_u16(x) & 0x8000; #else return simd_all(x.lo & x.hi); @@ -1015,7 +1063,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_ushort32 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_int2 x) { #if defined __SSE2__ return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x3) == 0x3; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminv_u32(x) & 0x80000000; #else union { uint64_t i; simd_int2 v; } u = { .v = x }; @@ -1025,7 +1073,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_int2 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_int3 x) { #if defined __SSE2__ return (_mm_movemask_ps((__m128)simd_make_int4_undef(x)) & 0x7) == 0x7; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return simd_all(x.xyzz); #else return (x.x & x.y & x.z) & 0x80000000; @@ -1034,7 +1082,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_int3 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_int4 x) { #if defined __SSE2__ return _mm_movemask_ps((__m128)x) == 0xf; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminvq_u32(x) & 0x80000000; #else return simd_all(x.lo & x.hi); @@ -1068,7 +1116,7 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_uint16 x) { static inline SIMD_CFUNC simd_bool simd_all(simd_long2 x) { #if defined __SSE2__ return _mm_movemask_pd((__m128d)x) == 0x3; -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return (x.x & x.y) & 0x8000000000000000U; #else return (x.x & x.y) & 0x8000000000000000U; @@ -1104,6 +1152,24 @@ static inline SIMD_CFUNC simd_bool simd_all(simd_ulong8 x) { return simd_all((simd_long8)x); } +static inline SIMD_CFUNC simd_half2 simd_select(simd_half2 x, simd_half2 y, simd_short2 mask) { + return simd_make_half2(simd_select(simd_make_half8_undef(x), simd_make_half8_undef(y), simd_make_short8_undef(mask))); +} +static inline SIMD_CFUNC simd_half3 simd_select(simd_half3 x, simd_half3 y, simd_short3 mask) { + return simd_make_half3(simd_select(simd_make_half8_undef(x), simd_make_half8_undef(y), simd_make_short8_undef(mask))); +} +static inline SIMD_CFUNC simd_half4 simd_select(simd_half4 x, simd_half4 y, simd_short4 mask) { + return simd_make_half4(simd_select(simd_make_half8_undef(x), simd_make_half8_undef(y), simd_make_short8_undef(mask))); +} +static inline SIMD_CFUNC simd_half8 simd_select(simd_half8 x, simd_half8 y, simd_short8 mask) { + return simd_bitselect(x, y, mask >> 15); +} +static inline SIMD_CFUNC simd_half16 simd_select(simd_half16 x, simd_half16 y, simd_short16 mask) { + return simd_bitselect(x, y, mask >> 15); +} +static inline SIMD_CFUNC simd_half32 simd_select(simd_half32 x, simd_half32 y, simd_short32 mask) { + return simd_bitselect(x, y, mask >> 15); +} 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))); } @@ -1226,6 +1292,24 @@ static inline SIMD_CFUNC simd_ushort16 simd_bitselect(simd_ushort16 x, simd_usho 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_half2 simd_bitselect(simd_half2 x, simd_half2 y, simd_short2 mask) { + return (simd_half2)simd_bitselect((simd_short2)x, (simd_short2)y, mask); +} +static inline SIMD_CFUNC simd_half3 simd_bitselect(simd_half3 x, simd_half3 y, simd_short3 mask) { + return (simd_half3)simd_bitselect((simd_short3)x, (simd_short3)y, mask); +} +static inline SIMD_CFUNC simd_half4 simd_bitselect(simd_half4 x, simd_half4 y, simd_short4 mask) { + return (simd_half4)simd_bitselect((simd_short4)x, (simd_short4)y, mask); +} +static inline SIMD_CFUNC simd_half8 simd_bitselect(simd_half8 x, simd_half8 y, simd_short8 mask) { + return (simd_half8)simd_bitselect((simd_short8)x, (simd_short8)y, mask); +} +static inline SIMD_CFUNC simd_half16 simd_bitselect(simd_half16 x, simd_half16 y, simd_short16 mask) { + return (simd_half16)simd_bitselect((simd_short16)x, (simd_short16)y, mask); +} +static inline SIMD_CFUNC simd_half32 simd_bitselect(simd_half32 x, simd_half32 y, simd_short32 mask) { + return (simd_half32)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); } diff --git a/lib/libc/include/any-macos-any/simd/math.h b/lib/libc/include/any-macos-any/simd/math.h index 85d51984cc31..193a1c2d8859 100644 --- a/lib/libc/include/any-macos-any/simd/math.h +++ b/lib/libc/include/any-macos-any/simd/math.h @@ -1141,6 +1141,24 @@ static inline SIMD_NONCONST void __tg_sincospi(simd_double4 x, simd_double4 *sin 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_short2 __tg_isfinite(simd_half2 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_short3 __tg_isfinite(simd_half3 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_short4 __tg_isfinite(simd_half4 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_short8 __tg_isfinite(simd_half8 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_short16 __tg_isfinite(simd_half16 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_short32 __tg_isfinite(simd_half32 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_int2 __tg_isfinite(simd_float2 x); @@ -1169,6 +1187,24 @@ static inline SIMD_CFUNC simd_long4 __tg_isfinite(simd_double4 x); * 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_short2 __tg_isinf(simd_half2 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_short3 __tg_isinf(simd_half3 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_short4 __tg_isinf(simd_half4 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_short8 __tg_isinf(simd_half8 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_short16 __tg_isinf(simd_half16 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_short32 __tg_isinf(simd_half32 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); @@ -1197,6 +1233,24 @@ static inline SIMD_CFUNC simd_long4 __tg_isinf(simd_double4 x); * 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_short2 __tg_isnan(simd_half2 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_short3 __tg_isnan(simd_half3 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_short4 __tg_isnan(simd_half4 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_short8 __tg_isnan(simd_half8 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_short16 __tg_isnan(simd_half16 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_short32 __tg_isnan(simd_half32 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); @@ -1225,6 +1279,24 @@ static inline SIMD_CFUNC simd_long4 __tg_isnan(simd_double4 x); * 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_short2 __tg_isnormal(simd_half2 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_short3 __tg_isnormal(simd_half3 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_short4 __tg_isnormal(simd_half4 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_short8 __tg_isnormal(simd_half8 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_short16 __tg_isnormal(simd_half16 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_short32 __tg_isnormal(simd_half32 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); @@ -1253,6 +1325,120 @@ static inline SIMD_CFUNC simd_long4 __tg_isnormal(simd_double4 x); * 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 `fabs` in C and + * Objective-C, and `simd::fabs` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_fabs(simd_half2 x); +/*! @abstract Do not call this function; instead use `fabs` in C and + * Objective-C, and `simd::fabs` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_fabs(simd_half3 x); +/*! @abstract Do not call this function; instead use `fabs` in C and + * Objective-C, and `simd::fabs` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_fabs(simd_half4 x); +/*! @abstract Do not call this function; instead use `fabs` in C and + * Objective-C, and `simd::fabs` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_fabs(simd_half8 x); +/*! @abstract Do not call this function; instead use `fabs` in C and + * Objective-C, and `simd::fabs` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_fabs(simd_half16 x); +/*! @abstract Do not call this function; instead use `fabs` in C and + * Objective-C, and `simd::fabs` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_fabs(simd_half32 x); + +/*! @abstract Do not call this function; instead use `sqrt` in C and + * Objective-C, and `simd::sqrt` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_sqrt(simd_half2 x); +/*! @abstract Do not call this function; instead use `sqrt` in C and + * Objective-C, and `simd::sqrt` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_sqrt(simd_half3 x); +/*! @abstract Do not call this function; instead use `sqrt` in C and + * Objective-C, and `simd::sqrt` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_sqrt(simd_half4 x); +/*! @abstract Do not call this function; instead use `sqrt` in C and + * Objective-C, and `simd::sqrt` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_sqrt(simd_half8 x); +/*! @abstract Do not call this function; instead use `sqrt` in C and + * Objective-C, and `simd::sqrt` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_sqrt(simd_half16 x); +/*! @abstract Do not call this function; instead use `sqrt` in C and + * Objective-C, and `simd::sqrt` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_sqrt(simd_half32 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_half2 __tg_ceil(simd_half2 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_half3 __tg_ceil(simd_half3 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_half4 __tg_ceil(simd_half4 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_half8 __tg_ceil(simd_half8 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_half16 __tg_ceil(simd_half16 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_half32 __tg_ceil(simd_half32 x); + +/*! @abstract Do not call this function; instead use `floor` in C and + * Objective-C, and `simd::floor` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_floor(simd_half2 x); +/*! @abstract Do not call this function; instead use `floor` in C and + * Objective-C, and `simd::floor` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_floor(simd_half3 x); +/*! @abstract Do not call this function; instead use `floor` in C and + * Objective-C, and `simd::floor` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_floor(simd_half4 x); +/*! @abstract Do not call this function; instead use `floor` in C and + * Objective-C, and `simd::floor` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_floor(simd_half8 x); +/*! @abstract Do not call this function; instead use `floor` in C and + * Objective-C, and `simd::floor` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_floor(simd_half16 x); +/*! @abstract Do not call this function; instead use `floor` in C and + * Objective-C, and `simd::floor` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_floor(simd_half32 x); + +/*! @abstract Do not call this function; instead use `rint` in C and + * Objective-C, and `simd::rint` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_rint(simd_half2 x); +/*! @abstract Do not call this function; instead use `rint` in C and + * Objective-C, and `simd::rint` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_rint(simd_half3 x); +/*! @abstract Do not call this function; instead use `rint` in C and + * Objective-C, and `simd::rint` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_rint(simd_half4 x); +/*! @abstract Do not call this function; instead use `rint` in C and + * Objective-C, and `simd::rint` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_rint(simd_half8 x); +/*! @abstract Do not call this function; instead use `rint` in C and + * Objective-C, and `simd::rint` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_rint(simd_half16 x); +/*! @abstract Do not call this function; instead use `rint` in C and + * Objective-C, and `simd::rint` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_rint(simd_half32 x); + +/*! @abstract Do not call this function; instead use `trunc` in C and + * Objective-C, and `simd::trunc` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_trunc(simd_half2 x); +/*! @abstract Do not call this function; instead use `trunc` in C and + * Objective-C, and `simd::trunc` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_trunc(simd_half3 x); +/*! @abstract Do not call this function; instead use `trunc` in C and + * Objective-C, and `simd::trunc` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_trunc(simd_half4 x); +/*! @abstract Do not call this function; instead use `trunc` in C and + * Objective-C, and `simd::trunc` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_trunc(simd_half8 x); +/*! @abstract Do not call this function; instead use `trunc` in C and + * Objective-C, and `simd::trunc` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_trunc(simd_half16 x); +/*! @abstract Do not call this function; instead use `trunc` in C and + * Objective-C, and `simd::trunc` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_trunc(simd_half32 x); + /*! @abstract Do not call this function; instead use `atan2` in C and * Objective-C, and `simd::atan2` in C++. */ @@ -1534,6 +1720,63 @@ static inline SIMD_CFUNC simd_double4 __tg_fmin(simd_double4 x, simd_double4 y); * Objective-C, and `simd::fmin` in C++. */ static inline SIMD_CFUNC simd_double8 __tg_fmin(simd_double8 x, simd_double8 y); +/*! @abstract Do not call this function; instead use `fmin` in C and + * Objective-C, and `simd::fmin` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_fmin(simd_half2 x, simd_half2 y); +/*! @abstract Do not call this function; instead use `fmin` in C and + * Objective-C, and `simd::fmin` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_fmin(simd_half3 x, simd_half3 y); +/*! @abstract Do not call this function; instead use `fmin` in C and + * Objective-C, and `simd::fmin` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_fmin(simd_half4 x, simd_half4 y); +/*! @abstract Do not call this function; instead use `fmin` in C and + * Objective-C, and `simd::fmin` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_fmin(simd_half8 x, simd_half8 y); +/*! @abstract Do not call this function; instead use `fmin` in C and + * Objective-C, and `simd::fmin` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_fmin(simd_half16 x, simd_half16 y); +/*! @abstract Do not call this function; instead use `fmin` in C and + * Objective-C, and `simd::fmin` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_fmin(simd_half32 x, simd_half32 y); + +/*! @abstract Do not call this function; instead use `fmax` in C and + * Objective-C, and `simd::fmax` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_fmax(simd_half2 x, simd_half2 y); +/*! @abstract Do not call this function; instead use `fmax` in C and + * Objective-C, and `simd::fmax` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_fmax(simd_half3 x, simd_half3 y); +/*! @abstract Do not call this function; instead use `fmax` in C and + * Objective-C, and `simd::fmax` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_fmax(simd_half4 x, simd_half4 y); +/*! @abstract Do not call this function; instead use `fmax` in C and + * Objective-C, and `simd::fmax` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_fmax(simd_half8 x, simd_half8 y); +/*! @abstract Do not call this function; instead use `fmax` in C and + * Objective-C, and `simd::fmax` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_fmax(simd_half16 x, simd_half16 y); +/*! @abstract Do not call this function; instead use `fmax` in C and + * Objective-C, and `simd::fmax` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_fmax(simd_half32 x, simd_half32 y); + +/*! @abstract Do not call this function; instead use `copysign` in C and + * Objective-C, and `simd::copysign` in C++. */ +static inline SIMD_CFUNC simd_half2 __tg_copysign(simd_half2 x, simd_half2 y); +/*! @abstract Do not call this function; instead use `copysign` in C and + * Objective-C, and `simd::copysign` in C++. */ +static inline SIMD_CFUNC simd_half3 __tg_copysign(simd_half3 x, simd_half3 y); +/*! @abstract Do not call this function; instead use `copysign` in C and + * Objective-C, and `simd::copysign` in C++. */ +static inline SIMD_CFUNC simd_half4 __tg_copysign(simd_half4 x, simd_half4 y); +/*! @abstract Do not call this function; instead use `copysign` in C and + * Objective-C, and `simd::copysign` in C++. */ +static inline SIMD_CFUNC simd_half8 __tg_copysign(simd_half8 x, simd_half8 y); +/*! @abstract Do not call this function; instead use `copysign` in C and + * Objective-C, and `simd::copysign` in C++. */ +static inline SIMD_CFUNC simd_half16 __tg_copysign(simd_half16 x, simd_half16 y); +/*! @abstract Do not call this function; instead use `copysign` in C and + * Objective-C, and `simd::copysign` in C++. */ +static inline SIMD_CFUNC simd_half32 __tg_copysign(simd_half32 x, simd_half32 y); + /*! @abstract Do not call this function; instead use `fma` in C and Objective-C, * and `simd::fma` in C++. */ @@ -1563,6 +1806,27 @@ static inline SIMD_CFUNC simd_double4 __tg_fma(simd_double4 x, simd_double4 y, s * and `simd::fma` in C++. */ static inline SIMD_CFUNC simd_double8 __tg_fma(simd_double8 x, simd_double8 y, simd_double8 z); +/*! @abstract Computes accum + x*y by the most efficient means available; + * either a fused multiply add or separate multiply and add instructions. */ +static inline SIMD_CFUNC _Float16 simd_muladd(_Float16 x, _Float16 y, _Float16 z); +/*! @abstract Computes accum + x*y by the most efficient means available; + * either a fused multiply add or separate multiply and add instructions. */ +static inline SIMD_CFUNC simd_half2 simd_muladd(simd_half2 x, simd_half2 y, simd_half2 z); +/*! @abstract Computes accum + x*y by the most efficient means available; + * either a fused multiply add or separate multiply and add instructions. */ +static inline SIMD_CFUNC simd_half3 simd_muladd(simd_half3 x, simd_half3 y, simd_half3 z); +/*! @abstract Computes accum + x*y by the most efficient means available; + * either a fused multiply add or separate multiply and add instructions. */ +static inline SIMD_CFUNC simd_half4 simd_muladd(simd_half4 x, simd_half4 y, simd_half4 z); +/*! @abstract Computes accum + x*y by the most efficient means available; + * either a fused multiply add or separate multiply and add instructions. */ +static inline SIMD_CFUNC simd_half8 simd_muladd(simd_half8 x, simd_half8 y, simd_half8 z); +/*! @abstract Computes accum + x*y by the most efficient means available; + * either a fused multiply add or separate multiply and add instructions. */ +static inline SIMD_CFUNC simd_half16 simd_muladd(simd_half16 x, simd_half16 y, simd_half16 z); +/*! @abstract Computes accum + x*y by the most efficient means available; + * either a fused multiply add or separate multiply and add instructions. */ +static inline SIMD_CFUNC simd_half32 simd_muladd(simd_half32 x, simd_half32 y, simd_half32 z); /*! @abstract Computes accum + x*y by the most efficient means available; * either a fused multiply add or separate multiply and add instructions. */ static inline SIMD_CFUNC float simd_muladd(float x, float y, float z); @@ -1753,26 +2017,40 @@ static SIMD_INLINE SIMD_NODEBUG void __tg_sincospi(float x, float *sinp, float * * instead. */ static SIMD_INLINE SIMD_NODEBUG void __tg_sincospi(double x, double *sinp, double *cosp) { ::__sincospi(x, sinp, cosp); } #endif +#if SIMD_LIBRARY_VERSION >= 6 +/*! @abstract Do not call this function directly; use simd::fabs instead. */ +static SIMD_CPPFUNC _Float16 __tg_fabs(_Float16 x) { return ::__fabsf16(x); } +/*! @abstract Do not call this function directly; use simd::sqrt instead. */ +static SIMD_CPPFUNC _Float16 __tg_sqrt(_Float16 x) { return ::__sqrtf16(x); } +/*! @abstract Do not call this function directly; use simd::ceil instead. */ +static SIMD_CPPFUNC _Float16 __tg_ceil(_Float16 x) { return ::__ceilf16(x); } +/*! @abstract Do not call this function directly; use simd::floor instead. */ +static SIMD_CPPFUNC _Float16 __tg_floor(_Float16 x) { return ::__floorf16(x); } +/*! @abstract Do not call this function directly; use simd::rint instead. */ +static SIMD_CPPFUNC _Float16 __tg_rint(_Float16 x) { return ::__rintf16(x); } +/*! @abstract Do not call this function directly; use simd::trunc instead. */ +static SIMD_CPPFUNC _Float16 __tg_trunc(_Float16 x) { return ::__truncf16(x); } +#endif /*! @abstract Do not call this function directly; use simd::isfinite * instead. */ -static SIMD_CPPFUNC float __tg_isfinite(float x) { return ::isfinite(x); } +static SIMD_CPPFUNC float __tg_isfinite(float x) { return std::isfinite(x); } /*! @abstract Do not call this function directly; use simd::isfinite * instead. */ -static SIMD_CPPFUNC double __tg_isfinite(double x) { return ::isfinite(x); } +static SIMD_CPPFUNC double __tg_isfinite(double x) { return std::isfinite(x); } /*! @abstract Do not call this function directly; use simd::isinf instead. */ -static SIMD_CPPFUNC float __tg_isinf(float x) { return ::isinf(x); } +static SIMD_CPPFUNC float __tg_isinf(float x) { return std::isinf(x); } /*! @abstract Do not call this function directly; use simd::isinf instead. */ -static SIMD_CPPFUNC double __tg_isinf(double x) { return ::isinf(x); } +static SIMD_CPPFUNC double __tg_isinf(double x) { return std::isinf(x); } /*! @abstract Do not call this function directly; use simd::isnan instead. */ -static SIMD_CPPFUNC float __tg_isnan(float x) { return ::isnan(x); } +static SIMD_CPPFUNC float __tg_isnan(float x) { return std::isnan(x); } /*! @abstract Do not call this function directly; use simd::isnan instead. */ -static SIMD_CPPFUNC double __tg_isnan(double x) { return ::isnan(x); } +static SIMD_CPPFUNC double __tg_isnan(double x) { return std::isnan(x); } /*! @abstract Do not call this function directly; use simd::isnormal * instead. */ -static SIMD_CPPFUNC float __tg_isnormal(float x) { return ::isnormal(x); } +static SIMD_CPPFUNC float __tg_isnormal(float x) { return std::isnormal(x); } /*! @abstract Do not call this function directly; use simd::isnormal * instead. */ -static SIMD_CPPFUNC double __tg_isnormal(double x) { return ::isnormal(x); } +static SIMD_CPPFUNC double __tg_isnormal(double x) { return std::isnormal(x); } /*! @abstract Do not call this function directly; use simd::atan2 instead. */ 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. */ @@ -1819,11 +2097,20 @@ static SIMD_CPPFUNC double __tg_fmax(double x, double y) { return ::fmax(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, double y) { return ::fmin(x, y); } +#if SIMD_LIBRARY_VERSION >= 6 +/*! @abstract Do not call this function directly; use simd::fmin instead. */ +static SIMD_CPPFUNC _Float16 __tg_fmin(_Float16 x, _Float16 y) { return ::__fminf16(x, y); } +/*! @abstract Do not call this function directly; use simd::fmax instead. */ +static SIMD_CPPFUNC _Float16 __tg_fmax(_Float16 x, _Float16 y) { return ::__fmaxf16(x, y); } +/*! @abstract Do not call this function directly; use simd::copysign + * instead. */ +static SIMD_CPPFUNC _Float16 __tg_copysign(_Float16 x, _Float16 y) { return ::__copysignf16(x, y); } +#endif /*! @abstract Do not call this function directly; use simd::fma instead. */ 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); } - + namespace simd { /*! @abstract Generalizes the function acos to operate on vectors of * floats and doubles. */ @@ -2111,6 +2398,12 @@ extern "C" { #else #include /* C and Objective-C, we need some infrastructure to piggyback on tgmath.h */ +static SIMD_OVERLOAD simd_half2 __tg_promote(simd_half2); +static SIMD_OVERLOAD simd_half3 __tg_promote(simd_half3); +static SIMD_OVERLOAD simd_half4 __tg_promote(simd_half4); +static SIMD_OVERLOAD simd_half8 __tg_promote(simd_half8); +static SIMD_OVERLOAD simd_half16 __tg_promote(simd_half16); +static SIMD_OVERLOAD simd_half32 __tg_promote(simd_half32); static SIMD_OVERLOAD simd_float2 __tg_promote(simd_float2); static SIMD_OVERLOAD simd_float3 __tg_promote(simd_float3); static SIMD_OVERLOAD simd_float4 __tg_promote(simd_float4); @@ -2186,6 +2479,7 @@ static inline SIMD_CFUNC double __tg_exp10(double x) { return __exp10(x); } #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); } @@ -2272,6 +2566,12 @@ static inline SIMD_CFUNC int __tg_isnormal(long double x) { return __isnormall(x #endif /* !__cplusplus */ #pragma mark - fabs implementation +static inline SIMD_CFUNC simd_half2 __tg_fabs(simd_half2 x) { return simd_bitselect(0.0, x, 0x7fff); } +static inline SIMD_CFUNC simd_half3 __tg_fabs(simd_half3 x) { return simd_bitselect(0.0, x, 0x7fff); } +static inline SIMD_CFUNC simd_half4 __tg_fabs(simd_half4 x) { return simd_bitselect(0.0, x, 0x7fff); } +static inline SIMD_CFUNC simd_half8 __tg_fabs(simd_half8 x) { return simd_bitselect(0.0, x, 0x7fff); } +static inline SIMD_CFUNC simd_half16 __tg_fabs(simd_half16 x) { return simd_bitselect(0.0, x, 0x7fff); } +static inline SIMD_CFUNC simd_half32 __tg_fabs(simd_half32 x) { return simd_bitselect(0.0, x, 0x7fff); } static inline SIMD_CFUNC simd_float2 __tg_fabs(simd_float2 x) { return simd_bitselect(0.0, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float3 __tg_fabs(simd_float3 x) { return simd_bitselect(0.0, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float4 __tg_fabs(simd_float4 x) { return simd_bitselect(0.0, x, 0x7fffffff); } @@ -2283,6 +2583,12 @@ static inline SIMD_CFUNC simd_double4 __tg_fabs(simd_double4 x) { return simd_bi 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_short2 __tg_isfinite(simd_half2 x) { return x == x && __tg_fabs(x) != (simd_half2)INFINITY; } +static inline SIMD_CFUNC simd_short3 __tg_isfinite(simd_half3 x) { return x == x && __tg_fabs(x) != (simd_half3)INFINITY; } +static inline SIMD_CFUNC simd_short4 __tg_isfinite(simd_half4 x) { return x == x && __tg_fabs(x) != (simd_half4)INFINITY; } +static inline SIMD_CFUNC simd_short8 __tg_isfinite(simd_half8 x) { return x == x && __tg_fabs(x) != (simd_half8)INFINITY; } +static inline SIMD_CFUNC simd_short16 __tg_isfinite(simd_half16 x) { return x == x && __tg_fabs(x) != (simd_half16)INFINITY; } +static inline SIMD_CFUNC simd_short32 __tg_isfinite(simd_half32 x) { return x == x && __tg_fabs(x) != (simd_half32)INFINITY; } 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; } @@ -2294,6 +2600,12 @@ static inline SIMD_CFUNC simd_long4 __tg_isfinite(simd_double4 x) { return x == 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_short2 __tg_isinf(simd_half2 x) { return __tg_fabs(x) == (simd_half2)INFINITY; } +static inline SIMD_CFUNC simd_short3 __tg_isinf(simd_half3 x) { return __tg_fabs(x) == (simd_half3)INFINITY; } +static inline SIMD_CFUNC simd_short4 __tg_isinf(simd_half4 x) { return __tg_fabs(x) == (simd_half4)INFINITY; } +static inline SIMD_CFUNC simd_short8 __tg_isinf(simd_half8 x) { return __tg_fabs(x) == (simd_half8)INFINITY; } +static inline SIMD_CFUNC simd_short16 __tg_isinf(simd_half16 x) { return __tg_fabs(x) == (simd_half16)INFINITY; } +static inline SIMD_CFUNC simd_short32 __tg_isinf(simd_half32 x) { return __tg_fabs(x) == (simd_half32)INFINITY; } 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; } @@ -2305,6 +2617,12 @@ static inline SIMD_CFUNC simd_long4 __tg_isinf(simd_double4 x) { return __tg_fab 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_short2 __tg_isnan(simd_half2 x) { return x != x; } +static inline SIMD_CFUNC simd_short3 __tg_isnan(simd_half3 x) { return x != x; } +static inline SIMD_CFUNC simd_short4 __tg_isnan(simd_half4 x) { return x != x; } +static inline SIMD_CFUNC simd_short8 __tg_isnan(simd_half8 x) { return x != x; } +static inline SIMD_CFUNC simd_short16 __tg_isnan(simd_half16 x) { return x != x; } +static inline SIMD_CFUNC simd_short32 __tg_isnan(simd_half32 x) { return x != x; } 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; } @@ -2316,6 +2634,12 @@ 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_short2 __tg_isnormal(simd_half2 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half2)__DBL_MIN__; } +static inline SIMD_CFUNC simd_short3 __tg_isnormal(simd_half3 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half3)__DBL_MIN__; } +static inline SIMD_CFUNC simd_short4 __tg_isnormal(simd_half4 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half4)__DBL_MIN__; } +static inline SIMD_CFUNC simd_short8 __tg_isnormal(simd_half8 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half8)__DBL_MIN__; } +static inline SIMD_CFUNC simd_short16 __tg_isnormal(simd_half16 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half16)__DBL_MIN__; } +static inline SIMD_CFUNC simd_short32 __tg_isnormal(simd_half32 x) { return __tg_isfinite(x) && __tg_fabs(x) >= (simd_half32)__DBL_MIN__; } 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__; } @@ -2327,10 +2651,42 @@ static inline SIMD_CFUNC simd_long4 __tg_isnormal(simd_double4 x) { return __tg_ 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_half2 __tg_fmin(simd_half2 x, simd_half2 y) { + return __tg_fmin(simd_make_half4_undef(x), simd_make_half4_undef(y)).lo; +} + +static SIMD_CFUNC simd_half3 __tg_fmin(simd_half3 x, simd_half3 y) { + return simd_make_half3(__tg_fmin(simd_make_half4_undef(x), simd_make_half4_undef(y))); +} + +static SIMD_CFUNC simd_half4 __tg_fmin(simd_half4 x, simd_half4 y) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vminnm_f16(x, y); +#else + return simd_bitselect(y, x, (x <= y) | (y != y)); +#endif +} + +static SIMD_CFUNC simd_half8 __tg_fmin(simd_half8 x, simd_half8 y) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vminnmq_f16(x, y); +#else + return simd_make_half8(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi)); +#endif +} + +static SIMD_CFUNC simd_half16 __tg_fmin(simd_half16 x, simd_half16 y) { + return simd_make_half16(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi)); +} + +static SIMD_CFUNC simd_half32 __tg_fmin(simd_half32 x, simd_half32 y) { + return simd_make_half32(__tg_fmin(x.lo, y.lo), __tg_fmin(x.hi, y.hi)); +} + static SIMD_CFUNC simd_float2 __tg_fmin(simd_float2 x, simd_float2 y) { #if defined __SSE2__ return simd_make_float2(__tg_fmin(simd_make_float4_undef(x), simd_make_float4_undef(y))); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminnm_f32(x, y); #elif defined __arm__ && __FINITE_MATH_ONLY__ return vmin_f32(x, y); @@ -2350,7 +2706,7 @@ static SIMD_CFUNC simd_float4 __tg_fmin(simd_float4 x, simd_float4 y) { return _mm_min_ps(x, y); #elif defined __SSE2__ return simd_bitselect(_mm_min_ps(x, y), x, y != y); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminnmq_f32(x, y); #elif defined __arm__ && __FINITE_MATH_ONLY__ return vminq_f32(x, y); @@ -2390,7 +2746,7 @@ static SIMD_CFUNC simd_double2 __tg_fmin(simd_double2 x, simd_double2 y) { return _mm_min_pd(x, y); #elif defined __SSE2__ return simd_bitselect(_mm_min_pd(x, y), x, y != y); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vminnmq_f64(x, y); #else return simd_bitselect(y, x, (x <= y) | (y != y)); @@ -2425,10 +2781,42 @@ static SIMD_CFUNC simd_double8 __tg_fmin(simd_double8 x, simd_double8 y) { #endif } +static SIMD_CFUNC simd_half2 __tg_fmax(simd_half2 x, simd_half2 y) { + return __tg_fmax(simd_make_half4_undef(x), simd_make_half4_undef(y)).lo; +} + +static SIMD_CFUNC simd_half3 __tg_fmax(simd_half3 x, simd_half3 y) { + return simd_make_half3(__tg_fmax(simd_make_half4_undef(x), simd_make_half4_undef(y))); +} + +static SIMD_CFUNC simd_half4 __tg_fmax(simd_half4 x, simd_half4 y) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vmaxnm_f16(x, y); +#else + return simd_bitselect(y, x, (x >= y) | (y != y)); +#endif +} + +static SIMD_CFUNC simd_half8 __tg_fmax(simd_half8 x, simd_half8 y) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vmaxnmq_f16(x, y); +#else + return simd_make_half8(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi)); +#endif +} + +static SIMD_CFUNC simd_half16 __tg_fmax(simd_half16 x, simd_half16 y) { + return simd_make_half16(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi)); +} + +static SIMD_CFUNC simd_half32 __tg_fmax(simd_half32 x, simd_half32 y) { + return simd_make_half32(__tg_fmax(x.lo, y.lo), __tg_fmax(x.hi, y.hi)); +} + static SIMD_CFUNC simd_float2 __tg_fmax(simd_float2 x, simd_float2 y) { #if defined __SSE2__ return simd_make_float2(__tg_fmax(simd_make_float4_undef(x), simd_make_float4_undef(y))); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxnm_f32(x, y); #elif defined __arm__ && __FINITE_MATH_ONLY__ return vmax_f32(x, y); @@ -2448,7 +2836,7 @@ static SIMD_CFUNC simd_float4 __tg_fmax(simd_float4 x, simd_float4 y) { return _mm_max_ps(x, y); #elif defined __SSE2__ return simd_bitselect(_mm_max_ps(x, y), x, y != y); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxnmq_f32(x, y); #elif defined __arm__ && __FINITE_MATH_ONLY__ return vmaxq_f32(x, y); @@ -2488,7 +2876,7 @@ static SIMD_CFUNC simd_double2 __tg_fmax(simd_double2 x, simd_double2 y) { return _mm_max_pd(x, y); #elif defined __SSE2__ return simd_bitselect(_mm_max_pd(x, y), x, y != y); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vmaxnmq_f64(x, y); #else return simd_bitselect(y, x, (x >= y) | (y != y)); @@ -2524,6 +2912,12 @@ static SIMD_CFUNC simd_double8 __tg_fmax(simd_double8 x, simd_double8 y) { } #pragma mark - copysign implementation +static inline SIMD_CFUNC simd_half2 __tg_copysign(simd_half2 x, simd_half2 y) { return simd_bitselect(y, x, 0x7fff); } +static inline SIMD_CFUNC simd_half3 __tg_copysign(simd_half3 x, simd_half3 y) { return simd_bitselect(y, x, 0x7fff); } +static inline SIMD_CFUNC simd_half4 __tg_copysign(simd_half4 x, simd_half4 y) { return simd_bitselect(y, x, 0x7fff); } +static inline SIMD_CFUNC simd_half8 __tg_copysign(simd_half8 x, simd_half8 y) { return simd_bitselect(y, x, 0x7fff); } +static inline SIMD_CFUNC simd_half16 __tg_copysign(simd_half16 x, simd_half16 y) { return simd_bitselect(y, x, 0x7fff); } +static inline SIMD_CFUNC simd_half32 __tg_copysign(simd_half32 x, simd_half32 y) { return simd_bitselect(y, x, 0x7fff); } static inline SIMD_CFUNC simd_float2 __tg_copysign(simd_float2 x, simd_float2 y) { return simd_bitselect(y, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float3 __tg_copysign(simd_float3 x, simd_float3 y) { return simd_bitselect(y, x, 0x7fffffff); } static inline SIMD_CFUNC simd_float4 __tg_copysign(simd_float4 x, simd_float4 y) { return simd_bitselect(y, x, 0x7fffffff); } @@ -2535,10 +2929,50 @@ static inline SIMD_CFUNC simd_double4 __tg_copysign(simd_double4 x, simd_double4 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_half2 __tg_sqrt(simd_half2 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return __tg_sqrt(simd_make_half4_undef(x)).lo; +#else + return simd_make_half2(__sqrtf16(x.x), __sqrtf16(x.y)); +#endif +} + +static SIMD_CFUNC simd_half3 __tg_sqrt(simd_half3 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return simd_make_half3(__tg_sqrt(simd_make_half4_undef(x))); +#else + return simd_make_half3(__sqrtf16(x.x), __sqrtf16(x.y), __sqrtf16(x.z)); +#endif +} + +static SIMD_CFUNC simd_half4 __tg_sqrt(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vsqrt_f16(x); +#else + return simd_make_half4(__tg_sqrt(x.lo), __tg_sqrt(x.hi)); +#endif +} + +static SIMD_CFUNC simd_half8 __tg_sqrt(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vsqrtq_f16(x); +#else + return simd_make_half8(__tg_sqrt(x.lo), __tg_sqrt(x.hi)); +#endif +} + +static SIMD_CFUNC simd_half16 __tg_sqrt(simd_half16 x) { + return simd_make_half16(__tg_sqrt(x.lo), __tg_sqrt(x.hi)); +} + +static SIMD_CFUNC simd_half32 __tg_sqrt(simd_half32 x) { + return simd_make_half32(__tg_sqrt(x.lo), __tg_sqrt(x.hi)); +} + static SIMD_CFUNC simd_float2 __tg_sqrt(simd_float2 x) { #if defined __SSE2__ return simd_make_float2(__tg_sqrt(simd_make_float4_undef(x))); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vsqrt_f32(x); #else return simd_make_float2(sqrt(x.x), sqrt(x.y)); @@ -2552,7 +2986,7 @@ static SIMD_CFUNC simd_float3 __tg_sqrt(simd_float3 x) { static SIMD_CFUNC simd_float4 __tg_sqrt(simd_float4 x) { #if defined __SSE2__ return _mm_sqrt_ps(x); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vsqrtq_f32(x); #else return simd_make_float4(__tg_sqrt(x.lo), __tg_sqrt(x.hi)); @@ -2578,7 +3012,7 @@ static SIMD_CFUNC simd_float16 __tg_sqrt(simd_float16 x) { static SIMD_CFUNC simd_double2 __tg_sqrt(simd_double2 x) { #if defined __SSE2__ return _mm_sqrt_pd(x); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vsqrtq_f64(x); #else return simd_make_double2(sqrt(x.x), sqrt(x.y)); @@ -2606,8 +3040,145 @@ static SIMD_CFUNC simd_double8 __tg_sqrt(simd_double8 x) { } #pragma mark - ceil, floor, rint, trunc implementation +static SIMD_CFUNC simd_half2 __tg_ceil(simd_half2 x) { + return simd_make_half2(__tg_ceil(simd_make_half8_undef(x))); +} + +static SIMD_CFUNC simd_half3 __tg_ceil(simd_half3 x) { + return simd_make_half3(__tg_ceil(simd_make_half4_undef(x))); +} + +static SIMD_CFUNC simd_half4 __tg_ceil(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrndp_f16(x); +#else + return simd_make_half4(__tg_ceil(simd_make_half8_undef(x))); +#endif +} + +static SIMD_CFUNC simd_half8 __tg_ceil(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrndpq_f16(x); +#else + simd_half8 truncated = __tg_trunc(x); + simd_half8 adjust = simd_bitselect((simd_half8)0, 1, truncated < x); + return __tg_copysign(truncated + adjust, x); +#endif +} + +static SIMD_CFUNC simd_half16 __tg_ceil(simd_half16 x) { + return simd_make_half16(__tg_ceil(x.lo), __tg_ceil(x.hi)); +} + +static SIMD_CFUNC simd_half32 __tg_ceil(simd_half32 x) { + return simd_make_half32(__tg_ceil(x.lo), __tg_ceil(x.hi)); +} + +static SIMD_CFUNC simd_half2 __tg_floor(simd_half2 x) { + return simd_make_half2(__tg_floor(simd_make_half8_undef(x))); +} + +static SIMD_CFUNC simd_half3 __tg_floor(simd_half3 x) { + return simd_make_half3(__tg_floor(simd_make_half4_undef(x))); +} + +static SIMD_CFUNC simd_half4 __tg_floor(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrndm_f16(x); +#else + return simd_make_half4(__tg_floor(simd_make_half8_undef(x))); +#endif +} + +static SIMD_CFUNC simd_half8 __tg_floor(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrndmq_f16(x); +#else + simd_half8 truncated = __tg_trunc(x); + simd_half8 adjust = simd_bitselect((simd_half8)0, 1, truncated > x); + return truncated - adjust; +#endif +} + +static SIMD_CFUNC simd_half16 __tg_floor(simd_half16 x) { + return simd_make_half16(__tg_floor(x.lo), __tg_floor(x.hi)); +} + +static SIMD_CFUNC simd_half32 __tg_floor(simd_half32 x) { + return simd_make_half32(__tg_floor(x.lo), __tg_floor(x.hi)); +} + +static SIMD_CFUNC simd_half2 __tg_rint(simd_half2 x) { + return simd_make_half2(__tg_rint(simd_make_half8_undef(x))); +} + +static SIMD_CFUNC simd_half3 __tg_rint(simd_half3 x) { + return simd_make_half3(__tg_rint(simd_make_half4_undef(x))); +} + +static SIMD_CFUNC simd_half4 __tg_rint(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrndx_f16(x); +#else + return simd_make_half4(__tg_rint(simd_make_half8_undef(x))); +#endif +} + +static SIMD_CFUNC simd_half8 __tg_rint(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrndxq_f16(x); +#else + simd_half8 magic = __tg_copysign(0x1.0p10, x); + simd_short8 x_is_small = __tg_fabs(x) < 0x1.0p10; + return simd_bitselect(x, (x + magic) - magic, x_is_small & 0x7fff); +#endif +} + +static SIMD_CFUNC simd_half16 __tg_rint(simd_half16 x) { + return simd_make_half16(__tg_rint(x.lo), __tg_rint(x.hi)); +} + +static SIMD_CFUNC simd_half32 __tg_rint(simd_half32 x) { + return simd_make_half32(__tg_rint(x.lo), __tg_rint(x.hi)); +} + +static SIMD_CFUNC simd_half2 __tg_trunc(simd_half2 x) { + return simd_make_half2(__tg_trunc(simd_make_half8_undef(x))); +} + +static SIMD_CFUNC simd_half3 __tg_trunc(simd_half3 x) { + return simd_make_half3(__tg_trunc(simd_make_half4_undef(x))); +} + +static SIMD_CFUNC simd_half4 __tg_trunc(simd_half4 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrnd_f16(x); +#else + return simd_make_half4(__tg_trunc(simd_make_half8_undef(x))); +#endif +} + +static SIMD_CFUNC simd_half8 __tg_trunc(simd_half8 x) { +#if defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + return vrndq_f16(x); +#else + simd_half8 binade = simd_bitselect(0, x, 0x3c00); + simd_short8 mask = (simd_short8)__tg_fmin(-2*binade + 1, -0); + simd_half8 result = simd_bitselect(0, x, mask); + return simd_bitselect(x, result, binade < 0x1.0p10); +#endif +} + +static SIMD_CFUNC simd_half16 __tg_trunc(simd_half16 x) { + return simd_make_half16(__tg_trunc(x.lo), __tg_trunc(x.hi)); +} + +static SIMD_CFUNC simd_half32 __tg_trunc(simd_half32 x) { + return simd_make_half32(__tg_trunc(x.lo), __tg_trunc(x.hi)); +} + static SIMD_CFUNC simd_float2 __tg_ceil(simd_float2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vrndp_f32(x); #else return simd_make_float2(__tg_ceil(simd_make_float4_undef(x))); @@ -2625,7 +3196,7 @@ extern simd_float4 _simd_ceil_f4(simd_float4 x); static SIMD_CFUNC simd_float4 __tg_ceil(simd_float4 x) { #if defined __SSE4_1__ return _mm_round_ps(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndpq_f32(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_ceil_f4(x); @@ -2659,7 +3230,7 @@ extern simd_double2 _simd_ceil_d2(simd_double2 x); static SIMD_CFUNC simd_double2 __tg_ceil(simd_double2 x) { #if defined __SSE4_1__ return _mm_round_pd(x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndpq_f64(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_ceil_d2(x); @@ -2691,7 +3262,7 @@ static SIMD_CFUNC simd_double8 __tg_ceil(simd_double8 x) { } static SIMD_CFUNC simd_float2 __tg_floor(simd_float2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vrndm_f32(x); #else return simd_make_float2(__tg_floor(simd_make_float4_undef(x))); @@ -2709,7 +3280,7 @@ extern simd_float4 _simd_floor_f4(simd_float4 x); static SIMD_CFUNC simd_float4 __tg_floor(simd_float4 x) { #if defined __SSE4_1__ return _mm_round_ps(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndmq_f32(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_floor_f4(x); @@ -2743,7 +3314,7 @@ extern simd_double2 _simd_floor_d2(simd_double2 x); static SIMD_CFUNC simd_double2 __tg_floor(simd_double2 x) { #if defined __SSE4_1__ return _mm_round_pd(x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndmq_f64(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_floor_d2(x); @@ -2775,7 +3346,7 @@ static SIMD_CFUNC simd_double8 __tg_floor(simd_double8 x) { } static SIMD_CFUNC simd_float2 __tg_rint(simd_float2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vrndx_f32(x); #else return simd_make_float2(__tg_rint(simd_make_float4_undef(x))); @@ -2793,7 +3364,7 @@ extern simd_float4 _simd_rint_f4(simd_float4 x); static SIMD_CFUNC simd_float4 __tg_rint(simd_float4 x) { #if defined __SSE4_1__ return _mm_round_ps(x, _MM_FROUND_RINT); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndxq_f32(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_rint_f4(x); @@ -2827,7 +3398,7 @@ extern simd_double2 _simd_rint_d2(simd_double2 x); static SIMD_CFUNC simd_double2 __tg_rint(simd_double2 x) { #if defined __SSE4_1__ return _mm_round_pd(x, _MM_FROUND_RINT); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndxq_f64(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_rint_d2(x); @@ -2859,7 +3430,7 @@ static SIMD_CFUNC simd_double8 __tg_rint(simd_double8 x) { } static SIMD_CFUNC simd_float2 __tg_trunc(simd_float2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vrnd_f32(x); #else return simd_make_float2(__tg_trunc(simd_make_float4_undef(x))); @@ -2877,7 +3448,7 @@ extern simd_float4 _simd_trunc_f4(simd_float4 x); static SIMD_CFUNC simd_float4 __tg_trunc(simd_float4 x) { #if defined __SSE4_1__ return _mm_round_ps(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndq_f32(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_trunc_f4(x); @@ -2912,7 +3483,7 @@ extern simd_double2 _simd_trunc_d2(simd_double2 x); static SIMD_CFUNC simd_double2 __tg_trunc(simd_double2 x) { #if defined __SSE4_1__ return _mm_round_pd(x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC); -#elif defined __arm64__ +#elif defined __arm64__ || defined __aarch64__ return vrndq_f64(x); #elif defined __arm__ && SIMD_LIBRARY_VERSION >= 3 return _simd_trunc_d2(x); @@ -5117,7 +5688,7 @@ static inline SIMD_CFUNC simd_float3 __tg_round(simd_float3 x) { #if SIMD_LIBRARY_VERSION >= 3 extern simd_float4 _simd_round_f4(simd_float4 x); static inline SIMD_CFUNC simd_float4 __tg_round(simd_float4 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vrndaq_f32(x); #else return _simd_round_f4(x); @@ -5154,7 +5725,7 @@ static inline SIMD_CFUNC simd_float16 __tg_round(simd_float16 x) { #if SIMD_LIBRARY_VERSION >= 3 extern simd_double2 _simd_round_d2(simd_double2 x); static inline SIMD_CFUNC simd_double2 __tg_round(simd_double2 x) { -#if defined __arm64__ +#if defined __arm64__ || defined __aarch64__ return vrndaq_f64(x); #else return _simd_round_d2(x); @@ -5868,7 +6439,7 @@ static inline SIMD_CFUNC simd_double4 __tg_fdim(simd_double4 x, simd_double4 y) static inline SIMD_CFUNC simd_double8 __tg_fdim(simd_double8 x, simd_double8 y) { return simd_bitselect(x-y, 0, x= 6 +static simd_half2x2 SIMD_CFUNC simd_inverse( simd_half2x2 __x) { return __invert_h2(__x); } +static simd_half3x3 SIMD_CFUNC simd_inverse( simd_half3x3 __x) { return __invert_h3(__x); } +static simd_half4x4 SIMD_CFUNC simd_inverse( simd_half4x4 __x) { return __invert_h4(__x); } +#endif /* SIMD_LIBRARY_VERSION */ 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); } @@ -1520,6 +2170,15 @@ static simd_double2x2 SIMD_CFUNC simd_inverse(simd_double2x2 __x) { return __inv 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_half2 SIMD_CFUNC simd_mul( simd_half2x2 __x, simd_half2 __y) { simd_half2 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } +static simd_half3 SIMD_CFUNC simd_mul( simd_half2x3 __x, simd_half2 __y) { simd_half3 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } +static simd_half4 SIMD_CFUNC simd_mul( simd_half2x4 __x, simd_half2 __y) { simd_half4 __r = __x.columns[0]*__y[0]; __r = simd_muladd( __x.columns[1], __y[1],__r); return __r; } +static simd_half2 SIMD_CFUNC simd_mul( simd_half3x2 __x, simd_half3 __y) { simd_half2 __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_half3 SIMD_CFUNC simd_mul( simd_half3x3 __x, simd_half3 __y) { simd_half3 __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_half4 SIMD_CFUNC simd_mul( simd_half3x4 __x, simd_half3 __y) { simd_half4 __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_half2 SIMD_CFUNC simd_mul( simd_half4x2 __x, simd_half4 __y) { simd_half2 __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_half3 SIMD_CFUNC simd_mul( simd_half4x3 __x, simd_half4 __y) { simd_half3 __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_half4 SIMD_CFUNC simd_mul( simd_half4x4 __x, simd_half4 __y) { simd_half4 __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_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; } @@ -1539,6 +2198,15 @@ static simd_double2 SIMD_CFUNC simd_mul(simd_double4x2 __x, simd_double4 __y) { 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_half2 SIMD_CFUNC simd_mul( simd_half2 __x, simd_half2x2 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half3 SIMD_CFUNC simd_mul( simd_half2 __x, simd_half3x2 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half4 SIMD_CFUNC simd_mul( simd_half2 __x, simd_half4x2 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half2 SIMD_CFUNC simd_mul( simd_half3 __x, simd_half2x3 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half3 SIMD_CFUNC simd_mul( simd_half3 __x, simd_half3x3 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half4 SIMD_CFUNC simd_mul( simd_half3 __x, simd_half4x3 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half2 SIMD_CFUNC simd_mul( simd_half4 __x, simd_half2x4 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half3 SIMD_CFUNC simd_mul( simd_half4 __x, simd_half3x4 __y) { return simd_mul(simd_transpose(__y), __x); } +static simd_half4 SIMD_CFUNC simd_mul( simd_half4 __x, simd_half4x4 __y) { return simd_mul(simd_transpose(__y), __x); } 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); } @@ -1558,63 +2226,99 @@ 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) { 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_half2x2 SIMD_CFUNC simd_mul( simd_half2x2 __x, simd_half2x2 __y) { simd_half2x2 __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_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_half2x3 SIMD_CFUNC simd_mul( simd_half2x3 __x, simd_half2x2 __y) { simd_half2x3 __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_half2x4 SIMD_CFUNC simd_mul( simd_half2x4 __x, simd_half2x2 __y) { simd_half2x4 __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_half2x2 SIMD_CFUNC simd_mul( simd_half3x2 __x, simd_half2x3 __y) { simd_half2x2 __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_half2x3 SIMD_CFUNC simd_mul( simd_half3x3 __x, simd_half2x3 __y) { simd_half2x3 __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_half2x4 SIMD_CFUNC simd_mul( simd_half3x4 __x, simd_half2x3 __y) { simd_half2x4 __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_half2x2 SIMD_CFUNC simd_mul( simd_half4x2 __x, simd_half2x4 __y) { simd_half2x2 __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_half2x3 SIMD_CFUNC simd_mul( simd_half4x3 __x, simd_half2x4 __y) { simd_half2x3 __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_half2x4 SIMD_CFUNC simd_mul( simd_half4x4 __x, simd_half2x4 __y) { simd_half2x4 __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_half3x2 SIMD_CFUNC simd_mul( simd_half2x2 __x, simd_half3x2 __y) { simd_half3x2 __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_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_half3x3 SIMD_CFUNC simd_mul( simd_half2x3 __x, simd_half3x2 __y) { simd_half3x3 __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_half3x4 SIMD_CFUNC simd_mul( simd_half2x4 __x, simd_half3x2 __y) { simd_half3x4 __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_half3x2 SIMD_CFUNC simd_mul( simd_half3x2 __x, simd_half3x3 __y) { simd_half3x2 __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_half3x3 SIMD_CFUNC simd_mul( simd_half3x3 __x, simd_half3x3 __y) { simd_half3x3 __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_half3x4 SIMD_CFUNC simd_mul( simd_half3x4 __x, simd_half3x3 __y) { simd_half3x4 __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_half3x2 SIMD_CFUNC simd_mul( simd_half4x2 __x, simd_half3x4 __y) { simd_half3x2 __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_half3x3 SIMD_CFUNC simd_mul( simd_half4x3 __x, simd_half3x4 __y) { simd_half3x3 __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_half3x4 SIMD_CFUNC simd_mul( simd_half4x4 __x, simd_half3x4 __y) { simd_half3x4 __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_half4x2 SIMD_CFUNC simd_mul( simd_half2x2 __x, simd_half4x2 __y) { simd_half4x2 __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_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_half4x3 SIMD_CFUNC simd_mul( simd_half2x3 __x, simd_half4x2 __y) { simd_half4x3 __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_half4x4 SIMD_CFUNC simd_mul( simd_half2x4 __x, simd_half4x2 __y) { simd_half4x4 __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_half4x2 SIMD_CFUNC simd_mul( simd_half3x2 __x, simd_half4x3 __y) { simd_half4x2 __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_half4x3 SIMD_CFUNC simd_mul( simd_half3x3 __x, simd_half4x3 __y) { simd_half4x3 __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_half4x4 SIMD_CFUNC simd_mul( simd_half3x4 __x, simd_half4x3 __y) { simd_half4x4 __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_half4x2 SIMD_CFUNC simd_mul( simd_half4x2 __x, simd_half4x4 __y) { simd_half4x2 __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_half4x3 SIMD_CFUNC simd_mul( simd_half4x3 __x, simd_half4x4 __y) { simd_half4x3 __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_half4x4 SIMD_CFUNC simd_mul( simd_half4x4 __x, simd_half4x4 __y) { simd_half4x4 __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_half2 SIMD_CFUNC matrix_multiply( simd_half2x2 __x, simd_half2 __y) { return simd_mul(__x, __y); } +static simd_half3 SIMD_CFUNC matrix_multiply( simd_half2x3 __x, simd_half2 __y) { return simd_mul(__x, __y); } +static simd_half4 SIMD_CFUNC matrix_multiply( simd_half2x4 __x, simd_half2 __y) { return simd_mul(__x, __y); } +static simd_half2 SIMD_CFUNC matrix_multiply( simd_half3x2 __x, simd_half3 __y) { return simd_mul(__x, __y); } +static simd_half3 SIMD_CFUNC matrix_multiply( simd_half3x3 __x, simd_half3 __y) { return simd_mul(__x, __y); } +static simd_half4 SIMD_CFUNC matrix_multiply( simd_half3x4 __x, simd_half3 __y) { return simd_mul(__x, __y); } +static simd_half2 SIMD_CFUNC matrix_multiply( simd_half4x2 __x, simd_half4 __y) { return simd_mul(__x, __y); } +static simd_half3 SIMD_CFUNC matrix_multiply( simd_half4x3 __x, simd_half4 __y) { return simd_mul(__x, __y); } +static simd_half4 SIMD_CFUNC matrix_multiply( simd_half4x4 __x, simd_half4 __y) { return simd_mul(__x, __y); } 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); } @@ -1634,6 +2338,15 @@ static simd_double2 SIMD_CFUNC matrix_multiply(simd_double4x2 __x, simd_double4 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_half2 SIMD_CFUNC matrix_multiply( simd_half2 __x, simd_half2x2 __y) { return simd_mul(__x, __y); } +static simd_half3 SIMD_CFUNC matrix_multiply( simd_half2 __x, simd_half3x2 __y) { return simd_mul(__x, __y); } +static simd_half4 SIMD_CFUNC matrix_multiply( simd_half2 __x, simd_half4x2 __y) { return simd_mul(__x, __y); } +static simd_half2 SIMD_CFUNC matrix_multiply( simd_half3 __x, simd_half2x3 __y) { return simd_mul(__x, __y); } +static simd_half3 SIMD_CFUNC matrix_multiply( simd_half3 __x, simd_half3x3 __y) { return simd_mul(__x, __y); } +static simd_half4 SIMD_CFUNC matrix_multiply( simd_half3 __x, simd_half4x3 __y) { return simd_mul(__x, __y); } +static simd_half2 SIMD_CFUNC matrix_multiply( simd_half4 __x, simd_half2x4 __y) { return simd_mul(__x, __y); } +static simd_half3 SIMD_CFUNC matrix_multiply( simd_half4 __x, simd_half3x4 __y) { return simd_mul(__x, __y); } +static simd_half4 SIMD_CFUNC matrix_multiply( simd_half4 __x, simd_half4x4 __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); } @@ -1652,64 +2365,136 @@ static simd_double4 SIMD_CFUNC matrix_multiply(simd_double3 __x, simd_double4x3 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_half2x2 SIMD_CFUNC matrix_multiply( simd_half2x2 __x, simd_half2x2 __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_half2x3 SIMD_CFUNC matrix_multiply( simd_half2x3 __x, simd_half2x2 __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_half2x4 SIMD_CFUNC matrix_multiply( simd_half2x4 __x, simd_half2x2 __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_half2x2 SIMD_CFUNC matrix_multiply( simd_half3x2 __x, simd_half2x3 __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_half2x3 SIMD_CFUNC matrix_multiply( simd_half3x3 __x, simd_half2x3 __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_half2x4 SIMD_CFUNC matrix_multiply( simd_half3x4 __x, simd_half2x3 __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_half2x2 SIMD_CFUNC matrix_multiply( simd_half4x2 __x, simd_half2x4 __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_half2x3 SIMD_CFUNC matrix_multiply( simd_half4x3 __x, simd_half2x4 __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_half2x4 SIMD_CFUNC matrix_multiply( simd_half4x4 __x, simd_half2x4 __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_half3x2 SIMD_CFUNC matrix_multiply( simd_half2x2 __x, simd_half3x2 __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_half3x3 SIMD_CFUNC matrix_multiply( simd_half2x3 __x, simd_half3x2 __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_half3x4 SIMD_CFUNC matrix_multiply( simd_half2x4 __x, simd_half3x2 __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_half3x2 SIMD_CFUNC matrix_multiply( simd_half3x2 __x, simd_half3x3 __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_half3x3 SIMD_CFUNC matrix_multiply( simd_half3x3 __x, simd_half3x3 __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_half3x4 SIMD_CFUNC matrix_multiply( simd_half3x4 __x, simd_half3x3 __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_half3x2 SIMD_CFUNC matrix_multiply( simd_half4x2 __x, simd_half3x4 __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_half3x3 SIMD_CFUNC matrix_multiply( simd_half4x3 __x, simd_half3x4 __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_half3x4 SIMD_CFUNC matrix_multiply( simd_half4x4 __x, simd_half3x4 __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_half4x2 SIMD_CFUNC matrix_multiply( simd_half2x2 __x, simd_half4x2 __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_half4x3 SIMD_CFUNC matrix_multiply( simd_half2x3 __x, simd_half4x2 __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_half4x4 SIMD_CFUNC matrix_multiply( simd_half2x4 __x, simd_half4x2 __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_half4x2 SIMD_CFUNC matrix_multiply( simd_half3x2 __x, simd_half4x3 __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_half4x3 SIMD_CFUNC matrix_multiply( simd_half3x3 __x, simd_half4x3 __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_half4x4 SIMD_CFUNC matrix_multiply( simd_half3x4 __x, simd_half4x3 __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_half4x2 SIMD_CFUNC matrix_multiply( simd_half4x2 __x, simd_half4x4 __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_half4x3 SIMD_CFUNC matrix_multiply( simd_half4x3 __x, simd_half4x4 __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_half4x4 SIMD_CFUNC matrix_multiply( simd_half4x4 __x, simd_half4x4 __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_half2x2 __x, simd_half2x2 __y) { + return simd_all((__x.columns[0] == __y.columns[0]) & + (__x.columns[1] == __y.columns[1])); +} +static simd_bool SIMD_CFUNC simd_equal(simd_half2x3 __x, simd_half2x3 __y) { + return simd_all((__x.columns[0] == __y.columns[0]) & + (__x.columns[1] == __y.columns[1])); +} +static simd_bool SIMD_CFUNC simd_equal(simd_half2x4 __x, simd_half2x4 __y) { + return simd_all((__x.columns[0] == __y.columns[0]) & + (__x.columns[1] == __y.columns[1])); +} +static simd_bool SIMD_CFUNC simd_equal(simd_half3x2 __x, simd_half3x2 __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_half3x3 __x, simd_half3x3 __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_half3x4 __x, simd_half3x4 __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_half4x2 __x, simd_half4x2 __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_half4x3 __x, simd_half4x3 __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_half4x4 __x, simd_half4x4 __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_float2x2 __x, simd_float2x2 __y) { return simd_all((__x.columns[0] == __y.columns[0]) & (__x.columns[1] == __y.columns[1])); @@ -1801,6 +2586,51 @@ static simd_bool SIMD_CFUNC simd_equal(simd_double4x4 __x, simd_double4x4 __y) { (__x.columns[3] == __y.columns[3])); } +static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_half2x2 __x, simd_half2x2 __y, _Float16 __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_half2x3 __x, simd_half2x3 __y, _Float16 __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_half2x4 __x, simd_half2x4 __y, _Float16 __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_half3x2 __x, simd_half3x2 __y, _Float16 __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_half3x3 __x, simd_half3x3 __y, _Float16 __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_half3x4 __x, simd_half3x4 __y, _Float16 __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_half4x2 __x, simd_half4x2 __y, _Float16 __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_half4x3 __x, simd_half4x3 __y, _Float16 __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_half4x4 __x, simd_half4x4 __y, _Float16 __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_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)); @@ -1892,6 +2722,51 @@ static simd_bool SIMD_CFUNC simd_almost_equal_elements(simd_double4x4 __x, simd_ (__tg_fabs(__x.columns[3] - __y.columns[3]) <= __tol)); } +static simd_bool SIMD_CFUNC simd_almost_equal_elements_relative(simd_half2x2 __x, simd_half2x2 __y, _Float16 __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_half2x3 __x, simd_half2x3 __y, _Float16 __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_half2x4 __x, simd_half2x4 __y, _Float16 __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_half3x2 __x, simd_half3x2 __y, _Float16 __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_half3x3 __x, simd_half3x3 __y, _Float16 __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_half3x4 __x, simd_half3x4 __y, _Float16 __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_half4x2 __x, simd_half4x2 __y, _Float16 __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_half4x3 __x, simd_half4x3 __y, _Float16 __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_half4x4 __x, simd_half4x4 __y, _Float16 __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_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]))); diff --git a/lib/libc/include/any-macos-any/simd/matrix_types.h b/lib/libc/include/any-macos-any/simd/matrix_types.h index 69f821eec34e..51104f3d6c3f 100644 --- a/lib/libc/include/any-macos-any/simd/matrix_types.h +++ b/lib/libc/include/any-macos-any/simd/matrix_types.h @@ -34,6 +34,18 @@ #if SIMD_COMPILER_HAS_REQUIRED_FEATURES /* Matrix types available in C, Objective-C, and C++ */ +typedef simd_half2x2 matrix_half2x2; +typedef simd_half3x2 matrix_half3x2; +typedef simd_half4x2 matrix_half4x2; + +typedef simd_half2x3 matrix_half2x3; +typedef simd_half3x3 matrix_half3x3; +typedef simd_half4x3 matrix_half4x3; + +typedef simd_half2x4 matrix_half2x4; +typedef simd_half3x4 matrix_half3x4; +typedef simd_half4x4 matrix_half4x4; + typedef simd_float2x2 matrix_float2x2; typedef simd_float3x2 matrix_float3x2; typedef simd_float4x2 matrix_float4x2; @@ -60,6 +72,8 @@ typedef simd_double4x4 matrix_double4x4; #ifdef __cplusplus #if defined SIMD_MATRIX_HEADER +static simd_half3x3 SIMD_NOINLINE simd_matrix3x3(simd_quath q); +static simd_half4x4 SIMD_NOINLINE simd_matrix4x4(simd_quath q); 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); @@ -68,6 +82,117 @@ static simd_double4x4 SIMD_NOINLINE simd_matrix4x4(simd_quatd q); namespace simd { + struct half2x2 : ::simd_half2x2 { + SIMD_CONSTEXPR half2x2() SIMD_NOEXCEPT : ::simd_half2x2((simd_half2x2){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half2x2(_Float16 diagonal) SIMD_NOEXCEPT : half2x2((half2)diagonal) { } +#endif + SIMD_CONSTEXPR half2x2(half2 v) SIMD_NOEXCEPT : + ::simd_half2x2((simd_half2x2){(half2){v.x,0}, (half2){0,v.y}}) { } + SIMD_CONSTEXPR half2x2(half2 c0, half2 c1) SIMD_NOEXCEPT : simd_half2x2((simd_half2x2){c0, c1}) { } + SIMD_CONSTEXPR half2x2(::simd_half2x2 m) SIMD_NOEXCEPT : ::simd_half2x2(m) { } + }; + + struct half3x2 : ::simd_half3x2 { + SIMD_CONSTEXPR half3x2() SIMD_NOEXCEPT : ::simd_half3x2((simd_half3x2){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half3x2(_Float16 diagonal) SIMD_NOEXCEPT : half3x2((half2)diagonal) { } +#endif + SIMD_CONSTEXPR half3x2(half2 v) SIMD_NOEXCEPT : + ::simd_half3x2((simd_half3x2){(half2){v.x,0}, (half2){0,v.y}, (half2){0}}) { } + SIMD_CONSTEXPR half3x2(half2 c0, half2 c1, half2 c2) SIMD_NOEXCEPT : + ::simd_half3x2((simd_half3x2){c0, c1, c2}) { } + SIMD_CONSTEXPR half3x2(::simd_half3x2 m) SIMD_NOEXCEPT : ::simd_half3x2(m) { } + }; + + struct half4x2 : ::simd_half4x2 { + SIMD_CONSTEXPR half4x2() SIMD_NOEXCEPT : ::simd_half4x2((simd_half4x2){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half4x2(_Float16 diagonal) SIMD_NOEXCEPT : half4x2((half2)diagonal) { } +#endif + SIMD_CONSTEXPR half4x2(half2 v) SIMD_NOEXCEPT : + ::simd_half4x2((simd_half4x2){(half2){v.x,0}, (half2){0,v.y}, (half2){0}, (half2){0}}) { } + SIMD_CONSTEXPR half4x2(half2 c0, half2 c1, half2 c2, half2 c3) SIMD_NOEXCEPT : + ::simd_half4x2((simd_half4x2){c0, c1, c2, c3}) { } + SIMD_CONSTEXPR half4x2(::simd_half4x2 m) SIMD_NOEXCEPT : ::simd_half4x2(m) { } + }; + + struct half2x3 : ::simd_half2x3 { + SIMD_CONSTEXPR half2x3() SIMD_NOEXCEPT : ::simd_half2x3((simd_half2x3){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half2x3(_Float16 diagonal) SIMD_NOEXCEPT : half2x3((half2)diagonal) { } +#endif + SIMD_CONSTEXPR half2x3(half2 v) SIMD_NOEXCEPT : + ::simd_half2x3((simd_half2x3){(half3){v.x,0,0}, (half3){0,v.y,0}}) { } + SIMD_CONSTEXPR half2x3(half3 c0, half3 c1) SIMD_NOEXCEPT : ::simd_half2x3((simd_half2x3){c0, c1}) { } + SIMD_CONSTEXPR half2x3(::simd_half2x3 m) SIMD_NOEXCEPT : ::simd_half2x3(m) { } + }; + + struct half3x3 : ::simd_half3x3 { + SIMD_CONSTEXPR half3x3() SIMD_NOEXCEPT : ::simd_half3x3((simd_half3x3){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half3x3(_Float16 diagonal) SIMD_NOEXCEPT : half3x3((half3)diagonal) { } +#endif + SIMD_CONSTEXPR half3x3(half3 v) SIMD_NOEXCEPT : + ::simd_half3x3((simd_half3x3){(half3){v.x,0,0}, (half3){0,v.y,0}, (half3){0,0,v.z}}) { } + SIMD_CONSTEXPR half3x3(half3 c0, half3 c1, half3 c2) SIMD_NOEXCEPT : + ::simd_half3x3((simd_half3x3){c0, c1, c2}) { } + SIMD_CONSTEXPR half3x3(::simd_half3x3 m) SIMD_NOEXCEPT : ::simd_half3x3(m) { } +#if defined SIMD_MATRIX_HEADER + SIMD_CONSTEXPR half3x3(::simd_quath q) SIMD_NOEXCEPT : ::simd_half3x3(::simd_matrix3x3(q)) { } +#endif + }; + + struct half4x3 : ::simd_half4x3 { + SIMD_CONSTEXPR half4x3() SIMD_NOEXCEPT : ::simd_half4x3((simd_half4x3){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half4x3(_Float16 diagonal) SIMD_NOEXCEPT : half4x3((half3)diagonal) { } +#endif + SIMD_CONSTEXPR half4x3(half3 v) SIMD_NOEXCEPT : + ::simd_half4x3((simd_half4x3){(half3){v.x,0,0}, (half3){0,v.y,0}, (half3){0,0,v.z}, (half3){0}}) { } + SIMD_CONSTEXPR half4x3(half3 c0, half3 c1, half3 c2, half3 c3) SIMD_NOEXCEPT : + ::simd_half4x3((simd_half4x3){c0, c1, c2, c3}) { } + SIMD_CONSTEXPR half4x3(::simd_half4x3 m) SIMD_NOEXCEPT : ::simd_half4x3(m) { } + }; + + struct half2x4 : ::simd_half2x4 { + SIMD_CONSTEXPR half2x4() SIMD_NOEXCEPT : ::simd_half2x4((simd_half2x4){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half2x4(_Float16 diagonal) SIMD_NOEXCEPT : half2x4((half2)diagonal) { } +#endif + SIMD_CONSTEXPR half2x4(half2 v) SIMD_NOEXCEPT : + ::simd_half2x4((simd_half2x4){(half4){v.x,0,0,0}, (half4){0,v.y,0,0}}) { } + SIMD_CONSTEXPR half2x4(half4 c0, half4 c1) SIMD_NOEXCEPT : ::simd_half2x4((simd_half2x4){c0, c1}) { } + SIMD_CONSTEXPR half2x4(::simd_half2x4 m) SIMD_NOEXCEPT : ::simd_half2x4(m) { } + }; + + struct half3x4 : ::simd_half3x4 { + SIMD_CONSTEXPR half3x4() SIMD_NOEXCEPT : ::simd_half3x4((simd_half3x4){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half3x4(_Float16 diagonal) SIMD_NOEXCEPT : half3x4((half3)diagonal) { } +#endif + SIMD_CONSTEXPR half3x4(half3 v) SIMD_NOEXCEPT : + ::simd_half3x4((simd_half3x4){(half4){v.x,0,0,0}, (half4){0,v.y,0,0}, (half4){0,0,v.z,0}}) { } + SIMD_CONSTEXPR half3x4(half4 c0, half4 c1, half4 c2) SIMD_NOEXCEPT : + ::simd_half3x4((simd_half3x4){c0, c1, c2}) { } + SIMD_CONSTEXPR half3x4(::simd_half3x4 m) SIMD_NOEXCEPT : ::simd_half3x4(m) { } + }; + + struct half4x4 : ::simd_half4x4 { + SIMD_CONSTEXPR half4x4() SIMD_NOEXCEPT : ::simd_half4x4((simd_half4x4){0}) { } +#if __has_feature(cxx_delegating_constructors) + SIMD_CONSTEXPR half4x4(_Float16 diagonal) SIMD_NOEXCEPT : half4x4((half4)diagonal) { } +#endif + SIMD_CONSTEXPR half4x4(half4 v) SIMD_NOEXCEPT : + ::simd_half4x4((simd_half4x4){(half4){v.x,0,0,0}, (half4){0,v.y,0,0}, (half4){0,0,v.z,0}, (half4){0,0,0,v.w}}) { } + SIMD_CONSTEXPR half4x4(half4 c0, half4 c1, half4 c2, half4 c3) SIMD_NOEXCEPT : + ::simd_half4x4((simd_half4x4){c0, c1, c2, c3}) { } + SIMD_CONSTEXPR half4x4(::simd_half4x4 m) SIMD_NOEXCEPT : ::simd_half4x4(m) { } +#if defined SIMD_MATRIX_HEADER + SIMD_CONSTEXPR half4x4(::simd_quath q) SIMD_NOEXCEPT : ::simd_half4x4(::simd_matrix4x4(q)) { } +#endif + }; + struct float2x2 : ::simd_float2x2 { SIMD_CONSTEXPR float2x2() SIMD_NOEXCEPT : ::simd_float2x2((simd_float2x2){0}) { } #if __has_feature(cxx_delegating_constructors) @@ -303,6 +428,69 @@ template struct Matrix { template using Matrix_t = typename Matrix::type; +template<> struct Matrix<_Float16, 2, 2> { + static const size_t col = 2; + static const size_t row = 2; + typedef _Float16 scalar_t; + typedef half2x2 type; +}; + +template<> struct Matrix<_Float16, 3, 2> { + static const size_t col = 3; + static const size_t row = 2; + typedef _Float16 scalar_t; + typedef half3x2 type; +}; + +template<> struct Matrix<_Float16, 4, 2> { + static const size_t col = 4; + static const size_t row = 2; + typedef _Float16 scalar_t; + typedef half4x2 type; +}; + +template<> struct Matrix<_Float16, 2, 3> { + static const size_t col = 2; + static const size_t row = 3; + typedef _Float16 scalar_t; + typedef half2x3 type; +}; + +template<> struct Matrix<_Float16, 3, 3> { + static const size_t col = 3; + static const size_t row = 3; + typedef _Float16 scalar_t; + typedef half3x3 type; +}; + +template<> struct Matrix<_Float16, 4, 3> { + static const size_t col = 4; + static const size_t row = 3; + typedef _Float16 scalar_t; + typedef half4x3 type; +}; + +template<> struct Matrix<_Float16, 2, 4> { + static const size_t col = 2; + static const size_t row = 4; + typedef _Float16 scalar_t; + typedef half2x4 type; +}; + +template<> struct Matrix<_Float16, 3, 4> { + static const size_t col = 3; + static const size_t row = 4; + typedef _Float16 scalar_t; + typedef half3x4 type; +}; + +template<> struct Matrix<_Float16, 4, 4> { + static const size_t col = 4; + static const size_t row = 4; + typedef _Float16 scalar_t; + typedef half4x4 type; +}; + template<> struct Matrix { static const size_t col = 2; static const size_t row = 2; @@ -429,6 +617,51 @@ template<> struct Matrix { typedef double4x4 type; }; +template <> struct get_traits +{ + using type = Matrix<_Float16, 2, 2>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 3, 2>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 4, 2>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 2, 3>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 3, 3>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 4, 3>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 2, 4>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 3, 4>; +}; + +template <> struct get_traits +{ + using type = Matrix<_Float16, 4, 4>; +}; + template <> struct get_traits { using type = Matrix; diff --git a/lib/libc/include/any-macos-any/simd/packed.h b/lib/libc/include/any-macos-any/simd/packed.h index 284947c376ef..553f8a090bbb 100644 --- a/lib/libc/include/any-macos-any/simd/packed.h +++ b/lib/libc/include/any-macos-any/simd/packed.h @@ -208,6 +208,46 @@ typedef __attribute__((__ext_vector_type__(16),__aligned__(2))) unsigned short s * 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 16-bit floating-point numbers with relaxed + * alignment. + * @description In C++ and Metal, this type is also available as + * simd::packed::half2. 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))) _Float16 simd_packed_half2; + +/*! @abstract A vector of four 16-bit floating-point numbers with relaxed + * alignment. + * @description In C++ and Metal, this type is also available as + * simd::packed::half4. 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))) _Float16 simd_packed_half4; + +/*! @abstract A vector of eight 16-bit floating-point numbers with relaxed + * alignment. + * @description In C++ this type is also available as simd::packed::half8. + * 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))) _Float16 simd_packed_half8; + +/*! @abstract A vector of sixteen 16-bit floating-point numbers with relaxed + * alignment. + * @description In C++ this type is also available as simd::packed::half16. + * 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))) _Float16 simd_packed_half16; + +/*! @abstract A vector of thirty-two 16-bit floating-point numbers with + * relaxed alignment. + * @description In C++ this type is also available as simd::packed::half32. + * 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))) _Float16 simd_packed_half32; + /*! @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 @@ -592,6 +632,46 @@ typedef ::simd_packed_ushort16 ushort16; * 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 16-bit floating-point numbers with relaxed + * alignment. + * @description In C or Objective-C, this type is available as + * simd_packed_half2. 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_half2 half2; + + /*! @abstract A vector of four 16-bit floating-point numbers with + * relaxed alignment. + * @description In C or Objective-C, this type is available as + * simd_packed_half4. 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_half4 half4; + + /*! @abstract A vector of eight 16-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_half8. 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_half8 half8; + + /*! @abstract A vector of sixteen 16-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_half16. 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_half16 half16; + + /*! @abstract A vector of thirty-two 16-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_half32. 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_half32 half32; + /*! @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 diff --git a/lib/libc/include/any-macos-any/simd/quaternion.h b/lib/libc/include/any-macos-any/simd/quaternion.h index bb9211b81a5e..455692f9c606 100644 --- a/lib/libc/include/any-macos-any/simd/quaternion.h +++ b/lib/libc/include/any-macos-any/simd/quaternion.h @@ -15,6 +15,592 @@ extern "C" { #endif +/* MARK: - C and Objective-C _Float16 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_quath simd_quaternion(_Float16 ix, _Float16 iy, _Float16 iz, _Float16 r) { + return (simd_quath){ { 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_quath simd_quaternion(const _Float16 xyzr[4]) { + return (simd_quath){ *(const simd_packed_half4 *)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_quath simd_quaternion(simd_half4 xyzr) { + return (simd_quath){ xyzr }; +} + +/*! @abstract Constructs a quaternion that rotates by `angle` radians about + * `axis`. */ +static inline SIMD_CFUNC simd_quath simd_quaternion(_Float16 angle, simd_half3 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_quath simd_quaternion(simd_half3 from, simd_half3 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_quath simd_quaternion(simd_half3x3 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_quath simd_quaternion(simd_half4x4 matrix); + +/*! @abstract The real (scalar) part of the quaternion `q`. */ +static inline SIMD_CFUNC _Float16 simd_real(simd_quath q) { + return q.vector.w; +} + +/*! @abstract The imaginary (vector) part of the quaternion `q`. */ +static inline SIMD_CFUNC simd_half3 simd_imag(simd_quath q) { + return q.vector.xyz; +} + +/*! @abstract The angle (in radians) of rotation represented by `q`. */ +static inline SIMD_CFUNC _Float16 simd_angle(simd_quath q); + +/*! @abstract The normalized axis (a 3-element vector) around which the + * action of the quaternion `q` rotates. */ +static inline SIMD_CFUNC simd_half3 simd_axis(simd_quath q); + +/*! @abstract The sum of the quaternions `p` and `q`. */ +static inline SIMD_CFUNC simd_quath simd_add(simd_quath p, simd_quath q); + +/*! @abstract The difference of the quaternions `p` and `q`. */ +static inline SIMD_CFUNC simd_quath simd_sub(simd_quath p, simd_quath q); + +/*! @abstract The product of the quaternions `p` and `q`. */ +static inline SIMD_CFUNC simd_quath simd_mul(simd_quath p, simd_quath q); + +/*! @abstract The quaternion `q` scaled by the real value `a`. */ +static inline SIMD_CFUNC simd_quath simd_mul(simd_quath q, _Float16 a); + +/*! @abstract The quaternion `q` scaled by the real value `a`. */ +static inline SIMD_CFUNC simd_quath simd_mul(_Float16 a, simd_quath q); + +/*! @abstract The conjugate of the quaternion `q`. */ +static inline SIMD_CFUNC simd_quath simd_conjugate(simd_quath q); + +/*! @abstract The (multiplicative) inverse of the quaternion `q`. */ +static inline SIMD_CFUNC simd_quath simd_inverse(simd_quath q); + +/*! @abstract The negation (additive inverse) of the quaternion `q`. */ +static inline SIMD_CFUNC simd_quath simd_negate(simd_quath q); + +/*! @abstract The dot product of the quaternions `p` and `q` interpreted as + * four-dimensional vectors. */ +static inline SIMD_CFUNC _Float16 simd_dot(simd_quath p, simd_quath q); + +/*! @abstract The length of the quaternion `q`. */ +static inline SIMD_CFUNC _Float16 simd_length(simd_quath q); + +/*! @abstract The unit quaternion obtained by normalizing `q`. */ +static inline SIMD_CFUNC simd_quath simd_normalize(simd_quath q); + +/*! @abstract Rotates the vector `v` by the quaternion `q`. */ +static inline SIMD_CFUNC simd_half3 simd_act(simd_quath q, simd_half3 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_quath __tg_log(simd_quath 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_quath __tg_exp(simd_quath q); + +/*! @abstract Spherical linear interpolation along the shortest arc between + * quaternions `q0` and `q1`. */ +static SIMD_NOINLINE simd_quath simd_slerp(simd_quath q0, simd_quath q1, _Float16 t); + +/*! @abstract Spherical linear interpolation along the longest arc between + * quaternions `q0` and `q1`. */ +static SIMD_NOINLINE simd_quath simd_slerp_longest(simd_quath q0, simd_quath q1, _Float16 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_quath simd_spline(simd_quath q0, simd_quath q1, simd_quath q2, simd_quath q3, _Float16 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_quath simd_bezier(simd_quath q0, simd_quath q1, simd_quath q2, simd_quath q3, _Float16 t); + +#ifdef __cplusplus +} /* extern "C" */ +/* MARK: - C++ _Float16 interfaces */ + +namespace simd { + struct quath : ::simd_quath { + /*! @abstract The identity quaternion. */ + quath( ) : ::simd_quath(::simd_quaternion((half4){0,0,0,1})) { } + + /*! @abstract Constructs a C++ quaternion from a C quaternion. */ + quath(::simd_quath q) : ::simd_quath(q) { } + + /*! @abstract Constructs a quaternion from components. */ + quath(_Float16 ix, _Float16 iy, _Float16 iz, _Float16 r) : ::simd_quath(::simd_quaternion(ix, iy, iz, r)) { } + + /*! @abstract Constructs a quaternion from an array of scalars. */ + quath(const _Float16 xyzr[4]) : ::simd_quath(::simd_quaternion(xyzr)) { } + + /*! @abstract Constructs a quaternion from a vector. */ + quath(half4 xyzr) : ::simd_quath(::simd_quaternion(xyzr)) { } + + /*! @abstract Quaternion representing rotation about `axis` by `angle` + * radians. */ + quath(_Float16 angle, half3 axis) : ::simd_quath(::simd_quaternion(angle, axis)) { } + + /*! @abstract Quaternion that rotates `from` into `to`. */ + quath(half3 from, half3 to) : ::simd_quath(::simd_quaternion(from, to)) { } + + /*! @abstract Constructs a quaternion from a rotation matrix. */ + quath(::simd_half3x3 matrix) : ::simd_quath(::simd_quaternion(matrix)) { } + + /*! @abstract Constructs a quaternion from a rotation matrix. */ + quath(::simd_half4x4 matrix) : ::simd_quath(::simd_quaternion(matrix)) { } + + /*! @abstract The real (scalar) part of the quaternion. */ + _Float16 real(void) const { return ::simd_real(*this); } + + /*! @abstract The imaginary (vector) part of the quaternion. */ + half3 imag(void) const { return ::simd_imag(*this); } + + /*! @abstract The angle the quaternion rotates by. */ + _Float16 angle(void) const { return ::simd_angle(*this); } + + /*! @abstract The axis the quaternion rotates about. */ + half3 axis(void) const { return ::simd_axis(*this); } + + /*! @abstract The length of the quaternion. */ + _Float16 length(void) const { return ::simd_length(*this); } + + /*! @abstract Act on the vector `v` by rotation. */ + half3 operator()(const ::simd_half3 v) const { return ::simd_act(*this, v); } + }; + + static SIMD_CPPFUNC quath operator+(const ::simd_quath p, const ::simd_quath q) { return ::simd_add(p, q); } + static SIMD_CPPFUNC quath operator-(const ::simd_quath p, const ::simd_quath q) { return ::simd_sub(p, q); } + static SIMD_CPPFUNC quath operator-(const ::simd_quath p) { return ::simd_negate(p); } + static SIMD_CPPFUNC quath operator*(const _Float16 r, const ::simd_quath p) { return ::simd_mul(r, p); } + static SIMD_CPPFUNC quath operator*(const ::simd_quath p, const _Float16 r) { return ::simd_mul(p, r); } + static SIMD_CPPFUNC quath operator*(const ::simd_quath p, const ::simd_quath q) { return ::simd_mul(p, q); } + static SIMD_CPPFUNC quath operator/(const ::simd_quath p, const ::simd_quath q) { return ::simd_mul(p, ::simd_inverse(q)); } + static SIMD_INLINE SIMD_NODEBUG quath operator+=(quath &p, const ::simd_quath q) { return p = p+q; } + static SIMD_INLINE SIMD_NODEBUG quath operator-=(quath &p, const ::simd_quath q) { return p = p-q; } + static SIMD_INLINE SIMD_NODEBUG quath operator*=(quath &p, const _Float16 r) { return p = p*r; } + static SIMD_INLINE SIMD_NODEBUG quath operator*=(quath &p, const ::simd_quath q) { return p = p*q; } + static SIMD_INLINE SIMD_NODEBUG quath operator/=(quath &p, const ::simd_quath q) { return p = p/q; } + + /*! @abstract The conjugate of the quaternion `q`. */ + static SIMD_CPPFUNC quath conjugate(const ::simd_quath p) { return ::simd_conjugate(p); } + + /*! @abstract The (multiplicative) inverse of the quaternion `q`. */ + static SIMD_CPPFUNC quath inverse(const ::simd_quath p) { return ::simd_inverse(p); } + + /*! @abstract The dot product of the quaternions `p` and `q` interpreted as + * four-dimensional vectors. */ + static SIMD_CPPFUNC _Float16 dot(const ::simd_quath p, const ::simd_quath q) { return ::simd_dot(p, q); } + + /*! @abstract The unit quaternion obtained by normalizing `q`. */ + static SIMD_CPPFUNC quath normalize(const ::simd_quath p) { return ::simd_normalize(p); } + + /*! @abstract logarithm of the quaternion `q`. */ + static SIMD_CPPFUNC quath log(const ::simd_quath q) { return ::__tg_log(q); } + + /*! @abstract exponential map of quaterion `q`. */ + static SIMD_CPPFUNC quath exp(const ::simd_quath q) { return ::__tg_exp(q); } + + /*! @abstract Spherical linear interpolation along the shortest arc between + * quaternions `q0` and `q1`. */ + static SIMD_CPPFUNC quath slerp(const ::simd_quath p0, const ::simd_quath p1, _Float16 t) { return ::simd_slerp(p0, p1, t); } + + /*! @abstract Spherical linear interpolation along the longest arc between + * quaternions `q0` and `q1`. */ + static SIMD_CPPFUNC quath slerp_longest(const ::simd_quath p0, const ::simd_quath p1, _Float16 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 quath spline(const ::simd_quath p0, const ::simd_quath p1, const ::simd_quath p2, const ::simd_quath p3, _Float16 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 quath bezier(const ::simd_quath p0, const ::simd_quath p1, const ::simd_quath p2, const ::simd_quath p3, _Float16 t) { return ::simd_bezier(p0, p1, p2, p3, t); } +} + +extern "C" { +#endif /* __cplusplus */ + +/* MARK: - _Float16 implementations */ + +#include +#include + +/* tg_promote is implementation gobbledygook that enables the compile-time + * dispatching in tgmath.h to work its magic. */ +static simd_quath __attribute__((__overloadable__)) __tg_promote(simd_quath); + +/*! @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_quath _simd_quaternion(simd_half3 imag, _Float16 real) { + return simd_quaternion(simd_make_half4(imag, real)); +} + +static inline SIMD_CFUNC simd_quath simd_quaternion(_Float16 angle, simd_half3 axis) { + return _simd_quaternion((_Float16)sinf(angle/2) * axis, (_Float16)cosf(angle/2)); +} + +static inline SIMD_CFUNC _Float16 simd_angle(simd_quath q) { + return 2*(_Float16)atan2f(simd_length(q.vector.xyz), q.vector.w); +} + +static inline SIMD_CFUNC simd_half3 simd_axis(simd_quath q) { + return simd_normalize(q.vector.xyz); +} + +static inline SIMD_CFUNC simd_quath simd_add(simd_quath p, simd_quath q) { + return simd_quaternion(p.vector + q.vector); +} + +static inline SIMD_CFUNC simd_quath simd_sub(simd_quath p, simd_quath q) { + return simd_quaternion(p.vector - q.vector); +} + +static inline SIMD_CFUNC simd_quath simd_mul(simd_quath p, simd_quath 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_quath simd_mul(simd_quath q, _Float16 a) { + return simd_quaternion(a * q.vector); +} + +static inline SIMD_CFUNC simd_quath simd_mul(_Float16 a, simd_quath q) { + return simd_mul(q,a); +} + +static inline SIMD_CFUNC simd_quath simd_conjugate(simd_quath q) { + return simd_quaternion(q.vector * (simd_half4){-1,-1,-1, 1}); +} + +static inline SIMD_CFUNC simd_quath simd_inverse(simd_quath q) { + return simd_quaternion(simd_conjugate(q).vector * simd_recip(simd_length_squared(q.vector))); +} + +static inline SIMD_CFUNC simd_quath simd_negate(simd_quath q) { + return simd_quaternion(-q.vector); +} + +static inline SIMD_CFUNC _Float16 simd_dot(simd_quath p, simd_quath q) { + return simd_dot(p.vector, q.vector); +} + +static inline SIMD_CFUNC _Float16 simd_length(simd_quath q) { + return simd_length(q.vector); +} + +static inline SIMD_CFUNC simd_quath simd_normalize(simd_quath q) { + _Float16 length_squared = simd_length_squared(q.vector); + if (length_squared == 0) { + return simd_quaternion((simd_half4){0,0,0,1}); + } + return simd_quaternion(q.vector * simd_rsqrt(length_squared)); +} + +#if defined __arm__ || defined __arm64__ || defined __aarch64__ +/*! @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_quath _simd_mul_vq(simd_half3 v, simd_quath 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_half3 simd_act(simd_quath q, simd_half3 v) { +#if defined __arm__ || defined __arm64__ || defined __aarch64__ + return simd_mul(q, _simd_mul_vq(v, simd_conjugate(q))).vector.xyz; +#else + #pragma STDC FP_CONTRACT ON + simd_half3 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_quath __tg_log(simd_quath q) { + _Float16 real = (_Float16)logf(simd_length_squared(q.vector))/2; + if (simd_equal(simd_imag(q), 0)) return _simd_quaternion(0, real); + simd_half3 imag = (_Float16)acosf(simd_real(q)/simd_length(q)) * simd_normalize(simd_imag(q)); + return _simd_quaternion(imag, real); +} + +static SIMD_NOINLINE simd_quath __tg_exp(simd_quath 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`. + _Float16 angle = simd_length(simd_imag(q)); + if (angle == 0) return _simd_quaternion((simd_half3)0, (_Float16)expf(simd_real(q))); + simd_half3 axis = simd_normalize(simd_imag(q)); + simd_quath unit = _simd_quaternion((_Float16)sinf(angle)*axis, (_Float16)cosf(angle)); + return simd_mul((_Float16)expf(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_quath _simd_quaternion_reduced(simd_half3 from, simd_half3 to) { + simd_half3 half = simd_normalize(from + to); + return _simd_quaternion(simd_cross(from, half), simd_dot(from, half)); +} + +static SIMD_NOINLINE simd_quath simd_quaternion(simd_half3 from, simd_half3 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_half3 half = simd_normalize(from) + simd_normalize(to); + + if (simd_length_squared(half) <= 0x1p-46f) { + // 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_half3 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_half3){1,0,0})), 0.f); + else if (abs_from.y <= abs_from.z) + return _simd_quaternion(simd_normalize(simd_cross(from, (simd_half3){0,1,0})), 0.f); + else + return _simd_quaternion(simd_normalize(simd_cross(from, (simd_half3){0,0,1})), 0.f); + } + + // Compute the two-step rotation. */ + half = simd_normalize(half); + return simd_mul(_simd_quaternion_reduced(from, half), + _simd_quaternion_reduced(half, to)); +} + +static SIMD_NOINLINE simd_quath simd_quaternion(simd_half3x3 matrix) { + const simd_half3 *mat = matrix.columns; + _Float16 trace = mat[0][0] + mat[1][1] + mat[2][2]; + if (trace >= 0.0) { + _Float16 r = 2*__sqrtf16(1 + trace); + _Float16 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]) { + _Float16 r = 2*__sqrtf16(1 - mat[1][1] - mat[2][2] + mat[0][0]); + _Float16 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]) { + _Float16 r = 2*__sqrtf16(1 - mat[0][0] - mat[2][2] + mat[1][1]); + _Float16 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 { + _Float16 r = 2*__sqrtf16(1 - mat[0][0] - mat[1][1] + mat[2][2]); + _Float16 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_quath simd_quaternion(simd_half4x4 matrix) { + const simd_half4 *mat = matrix.columns; + _Float16 trace = mat[0][0] + mat[1][1] + mat[2][2]; + if (trace >= 0.0) { + _Float16 r = 2*__sqrtf16(1 + trace); + _Float16 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]) { + _Float16 r = 2*__sqrtf16(1 - mat[1][1] - mat[2][2] + mat[0][0]); + _Float16 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]) { + _Float16 r = 2*__sqrtf16(1 - mat[0][0] - mat[2][2] + mat[1][1]); + _Float16 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 { + _Float16 r = 2*__sqrtf16(1 - mat[0][0] - mat[1][1] + mat[2][2]); + _Float16 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 _Float16 _simd_angle(simd_quath p, simd_quath q) { + return 2*(_Float16)atan2f(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 _Float16 _simd_sinc(_Float16 x) { + if (x == 0) return 1; + return (_Float16)sinf(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_quath _simd_slerp_internal(simd_quath q0, simd_quath q1, _Float16 t) { + _Float16 s = 1 - t; + _Float16 a = _simd_angle(q0, q1); + _Float16 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_quath simd_slerp(simd_quath q0, simd_quath q1, _Float16 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_quath simd_slerp_longest(simd_quath q0, simd_quath q1, _Float16 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_quath _simd_intermediate(simd_quath q0, simd_quath q1, simd_quath q2) { + simd_quath p0 = __tg_log(simd_mul(q0, simd_inverse(q1))); + simd_quath 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_quath _simd_squad(simd_quath q0, simd_quath qa, simd_quath qb, simd_quath q1, _Float16 t) { + simd_quath r0 = _simd_slerp_internal(q0, q1, t); + simd_quath r1 = _simd_slerp_internal(qa, qb, t); + return _simd_slerp_internal(r0, r1, 2*t*(1 - t)); +} + +static SIMD_NOINLINE simd_quath simd_spline(simd_quath q0, simd_quath q1, simd_quath q2, simd_quath q3, _Float16 t) { + simd_quath qa = _simd_intermediate(q0, q1, q2); + simd_quath qb = _simd_intermediate(q1, q2, q3); + return _simd_squad(q1, qa, qb, q2, t); +} + +static SIMD_NOINLINE simd_quath simd_bezier(simd_quath q0, simd_quath q1, simd_quath q2, simd_quath q3, _Float16 t) { + simd_quath q01 = _simd_slerp_internal(q0, q1, t); + simd_quath q12 = _simd_slerp_internal(q1, q2, t); + simd_quath q23 = _simd_slerp_internal(q2, q3, t); + simd_quath q012 = _simd_slerp_internal(q01, q12, t); + simd_quath q123 = _simd_slerp_internal(q12, q23, t); + return _simd_slerp_internal(q012, q123, t); +} + /* MARK: - C and Objective-C float interfaces */ /*! @abstract Constructs a quaternion from four scalar values. @@ -368,7 +954,7 @@ static inline SIMD_CFUNC simd_quatf simd_normalize(simd_quatf q) { return simd_quaternion(q.vector * simd_rsqrt(length_squared)); } -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ /*! @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 @@ -384,7 +970,7 @@ static inline SIMD_CFUNC simd_quatf _simd_mul_vq(simd_float3 v, simd_quatf q) { #endif static inline SIMD_CFUNC simd_float3 simd_act(simd_quatf q, simd_float3 v) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return simd_mul(q, _simd_mul_vq(v, simd_conjugate(q))).vector.xyz; #else #pragma STDC FP_CONTRACT ON @@ -394,9 +980,9 @@ static inline SIMD_CFUNC simd_float3 simd_act(simd_quatf q, simd_float3 v) { } static SIMD_NOINLINE simd_quatf __tg_log(simd_quatf q) { - float real = __tg_log(simd_length_squared(q.vector))/2; + float real = 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)); + simd_float3 imag = acos(simd_real(q)/simd_length(q)) * simd_normalize(simd_imag(q)); return _simd_quaternion(imag, real); } @@ -405,9 +991,9 @@ static SIMD_NOINLINE simd_quatf __tg_exp(simd_quatf q) { // 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))); + if (angle == 0) return _simd_quaternion((simd_float3)0, exp(simd_real(q))); simd_float3 axis = simd_normalize(simd_imag(q)); - simd_quatf unit = _simd_quaternion(sin(angle)*axis, cosf(angle)); + simd_quatf unit = _simd_quaternion(sin(angle)*axis, cos(angle)); return simd_mul(exp(simd_real(q)), unit); } @@ -954,7 +1540,7 @@ static inline SIMD_CFUNC simd_quatd simd_normalize(simd_quatd q) { return simd_quaternion(q.vector * simd_rsqrt(length_squared)); } -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ /*! @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 @@ -970,7 +1556,7 @@ static inline SIMD_CFUNC simd_quatd _simd_mul_vq(simd_double3 v, simd_quatd q) { #endif static inline SIMD_CFUNC simd_double3 simd_act(simd_quatd q, simd_double3 v) { -#if defined __arm__ || defined __arm64__ +#if defined __arm__ || defined __arm64__ || defined __aarch64__ return simd_mul(q, _simd_mul_vq(v, simd_conjugate(q))).vector.xyz; #else #pragma STDC FP_CONTRACT ON @@ -980,9 +1566,9 @@ static inline SIMD_CFUNC simd_double3 simd_act(simd_quatd q, simd_double3 v) { } static SIMD_NOINLINE simd_quatd __tg_log(simd_quatd q) { - double real = __tg_log(simd_length_squared(q.vector))/2; + double real = 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)); + simd_double3 imag = acos(simd_real(q)/simd_length(q)) * simd_normalize(simd_imag(q)); return _simd_quaternion(imag, real); } @@ -991,9 +1577,9 @@ static SIMD_NOINLINE simd_quatd __tg_exp(simd_quatd q) { // 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))); + if (angle == 0) return _simd_quaternion((simd_double3)0, exp(simd_real(q))); simd_double3 axis = simd_normalize(simd_imag(q)); - simd_quatd unit = _simd_quaternion(sin(angle)*axis, cosf(angle)); + simd_quatd unit = _simd_quaternion(sin(angle)*axis, cos(angle)); return simd_mul(exp(simd_real(q)), unit); } diff --git a/lib/libc/include/any-macos-any/simd/types.h b/lib/libc/include/any-macos-any/simd/types.h index e094467047c5..c56ef556b6ec 100644 --- a/lib/libc/include/any-macos-any/simd/types.h +++ b/lib/libc/include/any-macos-any/simd/types.h @@ -36,6 +36,33 @@ * storage details of matrices, you don't need to worry about this at all. * Consider this yet another good reason to avoid doing so. */ +/*! @abstract A matrix with 2 rows and 2 columns. */ +typedef struct { simd_half2 columns[2]; } simd_half2x2; + +/*! @abstract A matrix with 2 rows and 3 columns. */ +typedef struct { simd_half2 columns[3]; } simd_half3x2; + +/*! @abstract A matrix with 2 rows and 4 columns. */ +typedef struct { simd_half2 columns[4]; } simd_half4x2; + +/*! @abstract A matrix with 3 rows and 2 columns. */ +typedef struct { simd_half3 columns[2]; } simd_half2x3; + +/*! @abstract A matrix with 3 rows and 3 columns. */ +typedef struct { simd_half3 columns[3]; } simd_half3x3; + +/*! @abstract A matrix with 3 rows and 4 columns. */ +typedef struct { simd_half3 columns[4]; } simd_half4x3; + +/*! @abstract A matrix with 4 rows and 2 columns. */ +typedef struct { simd_half4 columns[2]; } simd_half2x4; + +/*! @abstract A matrix with 4 rows and 3 columns. */ +typedef struct { simd_half4 columns[3]; } simd_half3x4; + +/*! @abstract A matrix with 4 rows and 4 columns. */ +typedef struct { simd_half4 columns[4]; } simd_half4x4; + /*! @abstract A matrix with 2 rows and 2 columns. */ typedef struct { simd_float2 columns[2]; } simd_float2x2; @@ -118,6 +145,9 @@ typedef struct { simd_double4 columns[4]; } simd_double4x4; * While the C types are defined here, the operations on quaternions and the * C++ quaternion types are defined in */ +/*! @abstract A half-precision quaternion. */ +typedef struct { simd_half4 vector; } simd_quath; + /*! @abstract A single-precision quaternion. */ typedef struct { simd_float4 vector; } simd_quatf; diff --git a/lib/libc/include/any-macos-any/simd/vector_make.h b/lib/libc/include/any-macos-any/simd/vector_make.h index 73b95fa612d1..4a2673c4dfdf 100644 --- a/lib/libc/include/any-macos-any/simd/vector_make.h +++ b/lib/libc/include/any-macos-any/simd/vector_make.h @@ -70,6 +70,7 @@ #define SIMD_VECTOR_CONSTRUCTORS #include +#include #if SIMD_COMPILER_HAS_REQUIRED_FEATURES #ifdef __cplusplus @@ -2876,6 +2877,617 @@ 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 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2(_Float16 x, _Float16 y) { + simd_half2 result; + result.x = x; + result.y = y; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of two 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2(_Float16 other) { + simd_half2 result = 0; + result.x = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of two 16-bit floating-point + * numbers. The contents of the newly-created vector lanes are unspecified. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2_undef(_Float16 other) { + simd_half2 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_half2 simd_make_half2(simd_half2 other) { + return other; +} + +/*! @abstract Truncates `other` to form a vector of two 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2(simd_half3 other) { + return other.xy; +} + +/*! @abstract Truncates `other` to form a vector of two 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2(simd_half4 other) { + return other.xy; +} + +/*! @abstract Truncates `other` to form a vector of two 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2(simd_half8 other) { + return other.xy; +} + +/*! @abstract Truncates `other` to form a vector of two 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2(simd_half16 other) { + return other.xy; +} + +/*! @abstract Truncates `other` to form a vector of two 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half2 simd_make_half2(simd_half32 other) { + return other.xy; +} + +/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(_Float16 x, _Float16 y, _Float16 z) { + simd_half3 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 + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(_Float16 x, simd_half2 yz) { + simd_half3 result; + result.x = x; + result.yz = yz; + return result; +} + +/*! @abstract Concatenates `xy` and `z` to form a vector of three 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(simd_half2 xy, _Float16 z) { + simd_half3 result; + result.xy = xy; + result.z = z; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of three 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(_Float16 other) { + simd_half3 result = 0; + result.x = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of three 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3_undef(_Float16 other) { + simd_half3 result; + result.x = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of three 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(simd_half2 other) { + simd_half3 result = 0; + result.xy = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of three 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3_undef(simd_half2 other) { + simd_half3 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_half3 simd_make_half3(simd_half3 other) { + return other; +} + +/*! @abstract Truncates `other` to form a vector of three 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(simd_half4 other) { + return other.xyz; +} + +/*! @abstract Truncates `other` to form a vector of three 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(simd_half8 other) { + return other.xyz; +} + +/*! @abstract Truncates `other` to form a vector of three 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(simd_half16 other) { + return other.xyz; +} + +/*! @abstract Truncates `other` to form a vector of three 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half3 simd_make_half3(simd_half32 other) { + return other.xyz; +} + +/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four + * 16-bit floating-point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(_Float16 x, _Float16 y, _Float16 z, _Float16 w) { + simd_half4 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 + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(_Float16 x, _Float16 y, simd_half2 zw) { + simd_half4 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 + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(_Float16 x, simd_half2 yz, _Float16 w) { + simd_half4 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 + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half2 xy, _Float16 z, _Float16 w) { + simd_half4 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 + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(_Float16 x, simd_half3 yzw) { + simd_half4 result; + result.x = x; + result.yzw = yzw; + return result; +} + +/*! @abstract Concatenates `xy` and `zw` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half2 xy, simd_half2 zw) { + simd_half4 result; + result.xy = xy; + result.zw = zw; + return result; +} + +/*! @abstract Concatenates `xyz` and `w` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half3 xyz, _Float16 w) { + simd_half4 result; + result.xyz = xyz; + result.w = w; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of four 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(_Float16 other) { + simd_half4 result = 0; + result.x = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of four 16-bit floating-point + * numbers. The contents of the newly-created vector lanes are unspecified. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4_undef(_Float16 other) { + simd_half4 result; + result.x = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of four 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half2 other) { + simd_half4 result = 0; + result.xy = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of four 16-bit floating-point + * numbers. The contents of the newly-created vector lanes are unspecified. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4_undef(simd_half2 other) { + simd_half4 result; + result.xy = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of four 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half3 other) { + simd_half4 result = 0; + result.xyz = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of four 16-bit floating-point + * numbers. The contents of the newly-created vector lanes are unspecified. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4_undef(simd_half3 other) { + simd_half4 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_half4 simd_make_half4(simd_half4 other) { + return other; +} + +/*! @abstract Truncates `other` to form a vector of four 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half8 other) { + return other.xyzw; +} + +/*! @abstract Truncates `other` to form a vector of four 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half16 other) { + return other.xyzw; +} + +/*! @abstract Truncates `other` to form a vector of four 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half4 simd_make_half4(simd_half32 other) { + return other.xyzw; +} + +/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8(simd_half4 lo, simd_half4 hi) { + simd_half8 result; + result.lo = lo; + result.hi = hi; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of eight 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8(_Float16 other) { + simd_half8 result = 0; + result.x = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of eight 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8_undef(_Float16 other) { + simd_half8 result; + result.x = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of eight 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8(simd_half2 other) { + simd_half8 result = 0; + result.xy = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of eight 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8_undef(simd_half2 other) { + simd_half8 result; + result.xy = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of eight 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8(simd_half3 other) { + simd_half8 result = 0; + result.xyz = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of eight 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8_undef(simd_half3 other) { + simd_half8 result; + result.xyz = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of eight 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8(simd_half4 other) { + simd_half8 result = 0; + result.xyzw = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of eight 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8_undef(simd_half4 other) { + simd_half8 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_half8 simd_make_half8(simd_half8 other) { + return other; +} + +/*! @abstract Truncates `other` to form a vector of eight 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8(simd_half16 other) { + return simd_make_half8(other.lo); +} + +/*! @abstract Truncates `other` to form a vector of eight 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half8 simd_make_half8(simd_half32 other) { + return simd_make_half8(other.lo); +} + +/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(simd_half8 lo, simd_half8 hi) { + simd_half16 result; + result.lo = lo; + result.hi = hi; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(_Float16 other) { + simd_half16 result = 0; + result.x = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of sixteen 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16_undef(_Float16 other) { + simd_half16 result; + result.x = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(simd_half2 other) { + simd_half16 result = 0; + result.xy = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of sixteen 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16_undef(simd_half2 other) { + simd_half16 result; + result.xy = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(simd_half3 other) { + simd_half16 result = 0; + result.xyz = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of sixteen 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16_undef(simd_half3 other) { + simd_half16 result; + result.xyz = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(simd_half4 other) { + simd_half16 result = 0; + result.xyzw = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of sixteen 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16_undef(simd_half4 other) { + simd_half16 result; + result.xyzw = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of sixteen 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(simd_half8 other) { + simd_half16 result = 0; + result.lo = simd_make_half8(other); + return result; +} + +/*! @abstract Extends `other` to form a vector of sixteen 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16_undef(simd_half8 other) { + simd_half16 result; + result.lo = simd_make_half8(other); + return result; +} + +/*! @abstract Returns `other` unmodified. This function is a convenience for + * templated and autogenerated code. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(simd_half16 other) { + return other; +} + +/*! @abstract Truncates `other` to form a vector of sixteen 16-bit floating- + * point numbers. */ +static inline SIMD_CFUNC simd_half16 simd_make_half16(simd_half32 other) { + return simd_make_half16(other.lo); +} + +/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two + * 16-bit floating-point numbers. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(simd_half16 lo, simd_half16 hi) { + simd_half32 result; + result.lo = lo; + result.hi = hi; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(_Float16 other) { + simd_half32 result = 0; + result.x = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. The contents of the newly-created vector lanes + * are unspecified. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32_undef(_Float16 other) { + simd_half32 result; + result.x = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(simd_half2 other) { + simd_half32 result = 0; + result.xy = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. The contents of the newly-created vector lanes + * are unspecified. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32_undef(simd_half2 other) { + simd_half32 result; + result.xy = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(simd_half3 other) { + simd_half32 result = 0; + result.xyz = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. The contents of the newly-created vector lanes + * are unspecified. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32_undef(simd_half3 other) { + simd_half32 result; + result.xyz = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(simd_half4 other) { + simd_half32 result = 0; + result.xyzw = other; + return result; +} + +/*! @abstract Extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. The contents of the newly-created vector lanes + * are unspecified. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32_undef(simd_half4 other) { + simd_half32 result; + result.xyzw = other; + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(simd_half8 other) { + simd_half32 result = 0; + result.lo = simd_make_half16(other); + return result; +} + +/*! @abstract Extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. The contents of the newly-created vector lanes + * are unspecified. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32_undef(simd_half8 other) { + simd_half32 result; + result.lo = simd_make_half16(other); + return result; +} + +/*! @abstract Zero-extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(simd_half16 other) { + simd_half32 result = 0; + result.lo = simd_make_half16(other); + return result; +} + +/*! @abstract Extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. The contents of the newly-created vector lanes + * are unspecified. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32_undef(simd_half16 other) { + simd_half32 result; + result.lo = simd_make_half16(other); + return result; +} + +/*! @abstract Returns `other` unmodified. This function is a convenience for + * templated and autogenerated code. */ +static inline SIMD_CFUNC simd_half32 simd_make_half32(simd_half32 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) { @@ -5997,6 +6609,166 @@ template static SIMD_CPPFUNC ushort32 make_ushort32_undef(typeN return ::simd_make_ushort32_undef(other); } +/*! @abstract Concatenates `x` and `y` to form a vector of two 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half2 make_half2(_Float16 x, _Float16 y) { + return ::simd_make_half2(x, y); +} + +/*! @abstract Truncates or zero-extends `other` to form a vector of two + * 16-bit floating-point numbers. */ +template static SIMD_CPPFUNC half2 make_half2(typeN other) { + return ::simd_make_half2(other); +} + +/*! @abstract Extends `other` to form a vector of two 16-bit floating-point + * numbers. The contents of the newly-created vector lanes are unspecified. */ +template static SIMD_CPPFUNC half2 make_half2_undef(typeN other) { + return ::simd_make_half2_undef(other); +} + +/*! @abstract Concatenates `x`, `y` and `z` to form a vector of three 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half3 make_half3(_Float16 x, _Float16 y, _Float16 z) { + return ::simd_make_half3(x, y, z); +} + +/*! @abstract Concatenates `x` and `yz` to form a vector of three 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half3 make_half3(_Float16 x, half2 yz) { + return ::simd_make_half3(x, yz); +} + +/*! @abstract Concatenates `xy` and `z` to form a vector of three 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half3 make_half3(half2 xy, _Float16 z) { + return ::simd_make_half3(xy, z); +} + +/*! @abstract Truncates or zero-extends `other` to form a vector of three + * 16-bit floating-point numbers. */ +template static SIMD_CPPFUNC half3 make_half3(typeN other) { + return ::simd_make_half3(other); +} + +/*! @abstract Extends `other` to form a vector of three 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +template static SIMD_CPPFUNC half3 make_half3_undef(typeN other) { + return ::simd_make_half3_undef(other); +} + +/*! @abstract Concatenates `x`, `y`, `z` and `w` to form a vector of four + * 16-bit floating-point numbers. */ +static inline SIMD_CPPFUNC half4 make_half4(_Float16 x, _Float16 y, _Float16 z, _Float16 w) { + return ::simd_make_half4(x, y, z, w); +} + +/*! @abstract Concatenates `x`, `y` and `zw` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half4 make_half4(_Float16 x, _Float16 y, half2 zw) { + return ::simd_make_half4(x, y, zw); +} + +/*! @abstract Concatenates `x`, `yz` and `w` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half4 make_half4(_Float16 x, half2 yz, _Float16 w) { + return ::simd_make_half4(x, yz, w); +} + +/*! @abstract Concatenates `xy`, `z` and `w` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half4 make_half4(half2 xy, _Float16 z, _Float16 w) { + return ::simd_make_half4(xy, z, w); +} + +/*! @abstract Concatenates `x` and `yzw` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half4 make_half4(_Float16 x, half3 yzw) { + return ::simd_make_half4(x, yzw); +} + +/*! @abstract Concatenates `xy` and `zw` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half4 make_half4(half2 xy, half2 zw) { + return ::simd_make_half4(xy, zw); +} + +/*! @abstract Concatenates `xyz` and `w` to form a vector of four 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half4 make_half4(half3 xyz, _Float16 w) { + return ::simd_make_half4(xyz, w); +} + +/*! @abstract Truncates or zero-extends `other` to form a vector of four + * 16-bit floating-point numbers. */ +template static SIMD_CPPFUNC half4 make_half4(typeN other) { + return ::simd_make_half4(other); +} + +/*! @abstract Extends `other` to form a vector of four 16-bit floating-point + * numbers. The contents of the newly-created vector lanes are unspecified. */ +template static SIMD_CPPFUNC half4 make_half4_undef(typeN other) { + return ::simd_make_half4_undef(other); +} + +/*! @abstract Concatenates `lo` and `hi` to form a vector of eight 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half8 make_half8(half4 lo, half4 hi) { + return ::simd_make_half8(lo, hi); +} + +/*! @abstract Truncates or zero-extends `other` to form a vector of eight + * 16-bit floating-point numbers. */ +template static SIMD_CPPFUNC half8 make_half8(typeN other) { + return ::simd_make_half8(other); +} + +/*! @abstract Extends `other` to form a vector of eight 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +template static SIMD_CPPFUNC half8 make_half8_undef(typeN other) { + return ::simd_make_half8_undef(other); +} + +/*! @abstract Concatenates `lo` and `hi` to form a vector of sixteen 16-bit + * floating-point numbers. */ +static inline SIMD_CPPFUNC half16 make_half16(half8 lo, half8 hi) { + return ::simd_make_half16(lo, hi); +} + +/*! @abstract Truncates or zero-extends `other` to form a vector of sixteen + * 16-bit floating-point numbers. */ +template static SIMD_CPPFUNC half16 make_half16(typeN other) { + return ::simd_make_half16(other); +} + +/*! @abstract Extends `other` to form a vector of sixteen 16-bit floating- + * point numbers. The contents of the newly-created vector lanes are + * unspecified. */ +template static SIMD_CPPFUNC half16 make_half16_undef(typeN other) { + return ::simd_make_half16_undef(other); +} + +/*! @abstract Concatenates `lo` and `hi` to form a vector of thirty-two + * 16-bit floating-point numbers. */ +static inline SIMD_CPPFUNC half32 make_half32(half16 lo, half16 hi) { + return ::simd_make_half32(lo, hi); +} + +/*! @abstract Truncates or zero-extends `other` to form a vector of thirty- + * two 16-bit floating-point numbers. */ +template static SIMD_CPPFUNC half32 make_half32(typeN other) { + return ::simd_make_half32(other); +} + +/*! @abstract Extends `other` to form a vector of thirty-two 16-bit + * floating-point numbers. The contents of the newly-created vector lanes + * are unspecified. */ +template static SIMD_CPPFUNC half32 make_half32_undef(typeN other) { + return ::simd_make_half32_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) { @@ -7208,6 +7980,95 @@ template <> struct get_traits using type = Vector; }; +template<> struct Vector { + static const size_t count = 1; + typedef half1 scalar_t; + typedef half1 type; + typedef short1 mask_t; +}; + +template <> struct get_traits +{ + using type = Vector; +}; + +template<> struct Vector { + static const size_t count = 2; + typedef half1 scalar_t; + typedef half2 type; + typedef packed::half2 packed_t; + typedef short2 mask_t; +}; + +template <> struct get_traits +{ + using type = Vector; +}; + +template<> struct Vector { + static const size_t count = 3; + typedef half1 scalar_t; + typedef half3 type; + typedef short3 mask_t; +}; + +template <> struct get_traits +{ + using type = Vector; +}; + +template<> struct Vector { + static const size_t count = 4; + typedef half1 scalar_t; + typedef half4 type; + typedef packed::half4 packed_t; + typedef short4 mask_t; +}; + +template <> struct get_traits +{ + using type = Vector; +}; + +template<> struct Vector { + static const size_t count = 8; + typedef half1 scalar_t; + typedef half8 type; + typedef packed::half8 packed_t; + typedef short8 mask_t; +}; + +template <> struct get_traits +{ + using type = Vector; +}; + +template<> struct Vector { + static const size_t count = 16; + typedef half1 scalar_t; + typedef half16 type; + typedef packed::half16 packed_t; + typedef short16 mask_t; +}; + +template <> struct get_traits +{ + using type = Vector; +}; + +template<> struct Vector { + static const size_t count = 32; + typedef half1 scalar_t; + typedef half32 type; + typedef packed::half32 packed_t; + typedef short32 mask_t; +}; + +template <> struct get_traits +{ + using type = Vector; +}; + template<> struct Vector { static const size_t count = 1; typedef int1 scalar_t; @@ -7691,6 +8552,18 @@ static constexpr typeN make(Args... args) return make_ushort16(args...); else if constexpr (std::is_same::value) return make_ushort32(args...); + else if constexpr (std::is_same::value) + return make_half2(args...); + else if constexpr (std::is_same::value) + return make_half3(args...); + else if constexpr (std::is_same::value) + return make_half4(args...); + else if constexpr (std::is_same::value) + return make_half8(args...); + else if constexpr (std::is_same::value) + return make_half16(args...); + else if constexpr (std::is_same::value) + return make_half32(args...); else if constexpr (std::is_same::value) return make_int2(args...); else if constexpr (std::is_same::value) @@ -7812,6 +8685,18 @@ static constexpr typeN make_undef(Args... args) return make_ushort16_undef(args...); else if constexpr (std::is_same::value) return make_ushort32_undef(args...); + else if constexpr (std::is_same::value) + return make_half2_undef(args...); + else if constexpr (std::is_same::value) + return make_half3_undef(args...); + else if constexpr (std::is_same::value) + return make_half4_undef(args...); + else if constexpr (std::is_same::value) + return make_half8_undef(args...); + else if constexpr (std::is_same::value) + return make_half16_undef(args...); + else if constexpr (std::is_same::value) + return make_half32_undef(args...); else if constexpr (std::is_same::value) return make_int2_undef(args...); else if constexpr (std::is_same::value) diff --git a/lib/libc/include/any-macos-any/simd/vector_types.h b/lib/libc/include/any-macos-any/simd/vector_types.h index 223d696e10dc..9b01ad08b54c 100644 --- a/lib/libc/include/any-macos-any/simd/vector_types.h +++ b/lib/libc/include/any-macos-any/simd/vector_types.h @@ -310,6 +310,55 @@ typedef __attribute__((__ext_vector_type__(16),__aligned__(16))) unsigned short * simd_packed_ushort32 instead. */ typedef __attribute__((__ext_vector_type__(32),__aligned__(16))) unsigned short simd_ushort32; +/*! @abstract A scalar 16-bit floating-point number. */ +typedef _Float16 simd_half1; + +/*! @abstract A vector of two 16-bit floating-point numbers. + * @description In C++ and Metal, this type is also available as + * simd::half2. The alignment of this type is greater than the alignment of + * _Float16; if you need to operate on data buffers that may not be + * suitably aligned, you should access them using simd_packed_half2 + * instead. */ +typedef __attribute__((__ext_vector_type__(2))) _Float16 simd_half2; + +/*! @abstract A vector of three 16-bit floating-point numbers. + * @description In C++ and Metal, this type is also available as + * simd::half3. Note that vectors of this type are padded to have the same + * size and alignment as simd_half4. */ +typedef __attribute__((__ext_vector_type__(3))) _Float16 simd_half3; + +/*! @abstract A vector of four 16-bit floating-point numbers. + * @description In C++ and Metal, this type is also available as + * simd::half4. The alignment of this type is greater than the alignment of + * _Float16; if you need to operate on data buffers that may not be + * suitably aligned, you should access them using simd_packed_half4 + * instead. */ +typedef __attribute__((__ext_vector_type__(4))) _Float16 simd_half4; + +/*! @abstract A vector of eight 16-bit floating-point numbers. + * @description In C++ this type is also available as simd::half8. This + * type is not available in Metal. The alignment of this type is greater + * than the alignment of _Float16; if you need to operate on data buffers + * that may not be suitably aligned, you should access them using + * simd_packed_half8 instead. */ +typedef __attribute__((__ext_vector_type__(8))) _Float16 simd_half8; + +/*! @abstract A vector of sixteen 16-bit floating-point numbers. + * @description In C++ this type is also available as simd::half16. This + * type is not available in Metal. The alignment of this type is greater + * than the alignment of _Float16; if you need to operate on data buffers + * that may not be suitably aligned, you should access them using + * simd_packed_half16 instead. */ +typedef __attribute__((__ext_vector_type__(16),__aligned__(16))) _Float16 simd_half16; + +/*! @abstract A vector of thirty-two 16-bit floating-point numbers. + * @description In C++ this type is also available as simd::half32. This + * type is not available in Metal. The alignment of this type is greater + * than the alignment of _Float16; if you need to operate on data buffers + * that may not be suitably aligned, you should access them using + * simd_packed_half32 instead. */ +typedef __attribute__((__ext_vector_type__(32),__aligned__(16))) _Float16 simd_half32; + /*! @abstract A scalar 32-bit signed (twos-complement) integer. */ typedef int simd_int1; @@ -769,6 +818,57 @@ typedef ::simd_ushort16 ushort16; * them using simd::packed_ushort32 instead. */ typedef ::simd_ushort32 ushort32; + /*! @abstract A scalar 16-bit floating-point number. + * @discussion In C and Objective-C, this type is available as + * simd_half1. */ +typedef ::simd_half1 half1; + + /*! @abstract A vector of two 16-bit floating-point numbers. + * @description In C or Objective-C, this type is available as + * simd_half2. The alignment of this type is greater than the alignment + * of _Float16; if you need to operate on data buffers that may not be + * suitably aligned, you should access them using simd::packed_half2 + * instead. */ +typedef ::simd_half2 half2; + + /*! @abstract A vector of three 16-bit floating-point numbers. + * @description In C or Objective-C, this type is available as + * simd_half3. Vectors of this type are padded to have the same size and + * alignment as simd_half4. */ +typedef ::simd_half3 half3; + + /*! @abstract A vector of four 16-bit floating-point numbers. + * @description In C or Objective-C, this type is available as + * simd_half4. The alignment of this type is greater than the alignment + * of _Float16; if you need to operate on data buffers that may not be + * suitably aligned, you should access them using simd::packed_half4 + * instead. */ +typedef ::simd_half4 half4; + + /*! @abstract A vector of eight 16-bit floating-point numbers. + * @description This type is not available in Metal. In C or Objective-C, + * this type is available as simd_half8. The alignment of this type is + * greater than the alignment of _Float16; if you need to operate on data + * buffers that may not be suitably aligned, you should access them using + * simd::packed_half8 instead. */ +typedef ::simd_half8 half8; + + /*! @abstract A vector of sixteen 16-bit floating-point numbers. + * @description This type is not available in Metal. In C or Objective-C, + * this type is available as simd_half16. The alignment of this type is + * greater than the alignment of _Float16; if you need to operate on data + * buffers that may not be suitably aligned, you should access them using + * simd::packed_half16 instead. */ +typedef ::simd_half16 half16; + + /*! @abstract A vector of thirty-two 16-bit floating-point numbers. + * @description This type is not available in Metal. In C or Objective-C, + * this type is available as simd_half32. The alignment of this type is + * greater than the alignment of _Float16; if you need to operate on data + * buffers that may not be suitably aligned, you should access them using + * simd::packed_half32 instead. */ +typedef ::simd_half32 half32; + /*! @abstract A scalar 32-bit signed (twos-complement) integer. * @discussion In C and Objective-C, this type is available as simd_int1. */ typedef ::simd_int1 int1; diff --git a/lib/libc/include/any-macos-any/stdio.h b/lib/libc/include/any-macos-any/stdio.h index d8585fb34c65..9799e5e5dc6d 100644 --- a/lib/libc/include/any-macos-any/stdio.h +++ b/lib/libc/include/any-macos-any/stdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2005, 2007, 2009, 2010, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -58,355 +58,8 @@ * @(#)stdio.h 8.5 (Berkeley) 4/29/95 */ -#ifndef _STDIO_H_ -#define _STDIO_H_ - #include <_stdio.h> -#include - -__BEGIN_DECLS -extern FILE *__stdinp; -extern FILE *__stdoutp; -extern FILE *__stderrp; -__END_DECLS - -#define __SLBF 0x0001 /* line buffered */ -#define __SNBF 0x0002 /* unbuffered */ -#define __SRD 0x0004 /* OK to read */ -#define __SWR 0x0008 /* OK to write */ - /* RD and WR are never simultaneously asserted */ -#define __SRW 0x0010 /* open for reading & writing */ -#define __SEOF 0x0020 /* found EOF */ -#define __SERR 0x0040 /* found error */ -#define __SMBF 0x0080 /* _buf is from malloc */ -#define __SAPP 0x0100 /* fdopen()ed in append mode */ -#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ -#define __SOPT 0x0400 /* do fseek() optimisation */ -#define __SNPT 0x0800 /* do not do fseek() optimisation */ -#define __SOFF 0x1000 /* set iff _offset is in fact correct */ -#define __SMOD 0x2000 /* true => fgetln modified _p text */ -#define __SALC 0x4000 /* allocate string space dynamically */ -#define __SIGN 0x8000 /* ignore this file in _fwalk */ - -/* - * The following three definitions are for ANSI C, which took them - * from System V, which brilliantly took internal interface macros and - * made them official arguments to setvbuf(), without renaming them. - * Hence, these ugly _IOxxx names are *supposed* to appear in user code. - * - * Although numbered as their counterparts above, the implementation - * does not rely on this. - */ -#define _IOFBF 0 /* setvbuf should set fully buffered */ -#define _IOLBF 1 /* setvbuf should set line buffered */ -#define _IONBF 2 /* setvbuf should set unbuffered */ - -#define BUFSIZ 1024 /* size of buffer used by setbuf */ -#define EOF (-1) - - /* must be == _POSIX_STREAM_MAX */ -#define FOPEN_MAX 20 /* must be <= OPEN_MAX */ -#define FILENAME_MAX 1024 /* must be <= PATH_MAX */ - -/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ -#ifndef _ANSI_SOURCE -#define P_tmpdir "/var/tmp/" -#endif -#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ -#define TMP_MAX 308915776 - -#define stdin __stdinp -#define stdout __stdoutp -#define stderr __stderrp - -#ifdef _DARWIN_UNLIMITED_STREAMS -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 -#error "_DARWIN_UNLIMITED_STREAMS 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_STREAMS specified, but -mmacosx-version-min version does not support it." -#endif -#endif - -/* ANSI-C */ - -__BEGIN_DECLS -void clearerr(FILE *); -int fclose(FILE *); -int feof(FILE *); -int ferror(FILE *); -int fflush(FILE *); -int fgetc(FILE *); -int fgetpos(FILE * __restrict, fpos_t *); -char *fgets(char * __restrict, int, FILE *); -#if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE) -FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(fopen)); -#else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */ -FILE *fopen(const char * __restrict __filename, const char * __restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fopen)); -#endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */ -int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3); -int fputc(int, FILE *); -int fputs(const char * __restrict, FILE * __restrict) __DARWIN_ALIAS(fputs); -size_t fread(void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream); -FILE *freopen(const char * __restrict, const char * __restrict, - FILE * __restrict) __DARWIN_ALIAS(freopen); -int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3); -int fseek(FILE *, long, int); -int fsetpos(FILE *, const fpos_t *); -long ftell(FILE *); -size_t fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite); -int getc(FILE *); -int getchar(void); - -#if !defined(_POSIX_C_SOURCE) -__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of gets(3), it is highly recommended that you use fgets(3) instead.") -#endif -char *gets(char *); - -void perror(const char *) __cold; -int printf(const char * __restrict, ...) __printflike(1, 2); -int putc(int, FILE *); -int putchar(int); -int puts(const char *); -int remove(const char *); -int rename (const char *__old, const char *__new); -void rewind(FILE *); -int scanf(const char * __restrict, ...) __scanflike(1, 2); -void setbuf(FILE * __restrict, char * __restrict); -int setvbuf(FILE * __restrict, char * __restrict, int, size_t); - -__swift_unavailable("Use snprintf 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 sprintf(3), it is highly recommended that you use snprintf(3) instead.") -#endif -int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3); - -int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3); -FILE *tmpfile(void); - -__swift_unavailable("Use mkstemp(3) 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 tmpnam(3), it is highly recommended that you use mkstemp(3) instead.") -#endif -char *tmpnam(char *); - -int ungetc(int, FILE *); -int vfprintf(FILE * __restrict, const char * __restrict, va_list) __printflike(2, 0); -int vprintf(const char * __restrict, va_list) __printflike(1, 0); - -__swift_unavailable("Use vsnprintf 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 sprintf(3), it is highly recommended that you use vsnprintf(3) instead.") -#endif -int vsprintf(char * __restrict, const char * __restrict, va_list) __printflike(2, 0); -__END_DECLS - - - -/* Additional functionality provided by: - * POSIX.1-1988 - */ - -#if __DARWIN_C_LEVEL >= 198808L -#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ - -#include <_ctermid.h> - -__BEGIN_DECLS - -#if defined(_DARWIN_UNLIMITED_STREAMS) || defined(_DARWIN_C_SOURCE) -FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(fdopen)); -#else /* !_DARWIN_UNLIMITED_STREAMS && !_DARWIN_C_SOURCE */ -FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen)); -#endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */ -int fileno(FILE *); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 198808L */ - - -/* Additional functionality provided by: - * POSIX.2-1992 C Language Binding Option - */ - -#if __DARWIN_C_LEVEL >= 199209L -__BEGIN_DECLS -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("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("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 */ - -/* Additional functionality provided by: - * POSIX.1c-1995, - * POSIX.1i-1995, - * and the omnibus ISO/IEC 9945-1: 1996 - */ - -#if __DARWIN_C_LEVEL >= 199506L - -/* Functions internal to the implementation. */ -__BEGIN_DECLS -int __srget(FILE *); -int __svfscanf(FILE *, const char *, va_list) __scanflike(2, 0); -int __swbuf(int, FILE *); -__END_DECLS - -/* - * The __sfoo macros are here so that we can - * define function versions in the C library. - */ -#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) -#if defined(__GNUC__) && defined(__STDC__) -__header_always_inline int __sputc(int _c, FILE *_p) { - if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) - return (*_p->_p++ = _c); - else - return (__swbuf(_c, _p)); -} -#else -/* - * This has been tuned to generate reasonable code on the vax using pcc. - */ -#define __sputc(c, p) \ - (--(p)->_w < 0 ? \ - (p)->_w >= (p)->_lbfsize ? \ - (*(p)->_p = (c)), *(p)->_p != '\n' ? \ - (int)*(p)->_p++ : \ - __swbuf('\n', p) : \ - __swbuf((int)(c), p) : \ - (*(p)->_p = (c), (int)*(p)->_p++)) -#endif - -#define __sfeof(p) (((p)->_flags & __SEOF) != 0) -#define __sferror(p) (((p)->_flags & __SERR) != 0) -#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) -#define __sfileno(p) ((p)->_file) - -__BEGIN_DECLS -void flockfile(FILE *); -int ftrylockfile(FILE *); -void funlockfile(FILE *); -int getc_unlocked(FILE *); -int getchar_unlocked(void); -int putc_unlocked(int, FILE *); -int putchar_unlocked(int); - -/* Removed in Issue 6 */ -#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L -int getw(FILE *); -int putw(int, FILE *); -#endif - -__swift_unavailable("Use mkstemp(3) 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 tempnam(3), it is highly recommended that you use mkstemp(3) instead.") -#endif -char *tempnam(const char *__dir, const char *__prefix) __DARWIN_ALIAS(tempnam); -__END_DECLS - -#ifndef lint -#define getc_unlocked(fp) __sgetc(fp) -#define putc_unlocked(x, fp) __sputc(x, fp) -#endif /* lint */ - -#define getchar_unlocked() getc_unlocked(stdin) -#define putchar_unlocked(x) putc_unlocked(x, stdout) -#endif /* __DARWIN_C_LEVEL >= 199506L */ - - - -/* Additional functionality provided by: - * POSIX.1-2001 - * ISO C99 - */ - -#if __DARWIN_C_LEVEL >= 200112L -#include - -__BEGIN_DECLS -int fseeko(FILE * __stream, off_t __offset, int __whence); -off_t ftello(FILE * __stream); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200112L */ - -#if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) -__BEGIN_DECLS -int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4); -int vfscanf(FILE * __restrict __stream, const char * __restrict __format, va_list) __scanflike(2, 0); -int vscanf(const char * __restrict __format, va_list) __scanflike(1, 0); -int vsnprintf(char * __restrict __str, size_t __size, const char * __restrict __format, va_list) __printflike(3, 0); -int vsscanf(const char * __restrict __str, const char * __restrict __format, va_list) __scanflike(2, 0); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) */ - - - -/* Additional functionality provided by: - * POSIX.1-2008 - */ - -#if __DARWIN_C_LEVEL >= 200809L -#include - -__BEGIN_DECLS -int dprintf(int, const char * __restrict, ...) __printflike(2, 3) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -int vdprintf(int, const char * __restrict, va_list) __printflike(2, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -ssize_t getdelim(char ** __restrict __linep, size_t * __restrict __linecapp, int __delimiter, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -ssize_t getline(char ** __restrict __linep, size_t * __restrict __linecapp, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -FILE *fmemopen(void * __restrict __buf, size_t __size, const char * __restrict __mode) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); -FILE *open_memstream(char **__bufp, size_t *__sizep) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200809L */ - - - -/* Darwin extensions */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -__BEGIN_DECLS -extern __const int sys_nerr; /* perror(3) external variables */ -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 *) __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); - - -/* - * Stdio function-access interface. - */ -FILE *funopen(const void *, - int (* _Nullable)(void *, char *, int), - int (* _Nullable)(void *, const char *, int), - fpos_t (* _Nullable)(void *, fpos_t, int), - int (* _Nullable)(void *)); -__END_DECLS -#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) -#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) - -#define feof_unlocked(p) __sfeof(p) -#define ferror_unlocked(p) __sferror(p) -#define clearerr_unlocked(p) __sclearerr(p) -#define fileno_unlocked(p) __sfileno(p) - -#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 /* _STDIO_H_ */ diff --git a/lib/libc/include/any-macos-any/stdlib.h b/lib/libc/include/any-macos-any/stdlib.h index 116ea2165371..26bdf4f0db6b 100644 --- a/lib/libc/include/any-macos-any/stdlib.h +++ b/lib/libc/include/any-macos-any/stdlib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2002 - 2008 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2002 - 2008, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -55,328 +55,8 @@ * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 */ -#ifndef _STDLIB_H_ -#define _STDLIB_H_ - -#include -#include - -#include <_types.h> -#if !defined(_ANSI_SOURCE) -#include -#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -#include -#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ -#endif /* !_ANSI_SOURCE */ - -/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: - * _GCC_SIZE_T */ -#include - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -#include -#include -#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - -#include - -typedef struct { - int quot; /* quotient */ - int rem; /* remainder */ -} div_t; - -typedef struct { - long quot; /* quotient */ - long rem; /* remainder */ -} ldiv_t; - -#if !__DARWIN_NO_LONG_LONG -typedef struct { - long long quot; - long long rem; -} lldiv_t; -#endif /* !__DARWIN_NO_LONG_LONG */ - -#include - -#define EXIT_FAILURE 1 -#define EXIT_SUCCESS 0 - -#define RAND_MAX 0x7fffffff - -#ifdef _USE_EXTENDED_LOCALES_ -#include <_xlocale.h> -#endif /* _USE_EXTENDED_LOCALES_ */ - -#ifndef MB_CUR_MAX -#ifdef _USE_EXTENDED_LOCALES_ -#define MB_CUR_MAX (___mb_cur_max()) -#ifndef MB_CUR_MAX_L -#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) -#endif /* !MB_CUR_MAX_L */ -#else /* !_USE_EXTENDED_LOCALES_ */ -extern int __mb_cur_max; -#define MB_CUR_MAX __mb_cur_max -#endif /* _USE_EXTENDED_LOCALES_ */ -#endif /* MB_CUR_MAX */ - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) \ - && defined(_USE_EXTENDED_LOCALES_) && !defined(MB_CUR_MAX_L) -#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) -#endif - -#include - -__BEGIN_DECLS -void abort(void) __cold __dead2; -int abs(int) __pure2; -int atexit(void (* _Nonnull)(void)); -double atof(const char *); -int atoi(const char *); -long atol(const char *); -#if !__DARWIN_NO_LONG_LONG -long long - atoll(const char *); -#endif /* !__DARWIN_NO_LONG_LONG */ -void *bsearch(const void *__key, const void *__base, size_t __nel, - size_t __width, int (* _Nonnull __compar)(const void *, const void *)); -/* calloc is now declared in _malloc.h */ -div_t div(int, int) __pure2; -void exit(int) __dead2; -/* free is now declared in _malloc.h */ -char *getenv(const char *); -long labs(long) __pure2; -ldiv_t ldiv(long, long) __pure2; -#if !__DARWIN_NO_LONG_LONG -long long - llabs(long long); -lldiv_t lldiv(long long, long long); -#endif /* !__DARWIN_NO_LONG_LONG */ -/* malloc is now declared in _malloc.h */ -int mblen(const char *__s, size_t __n); -size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); -int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); -/* posix_memalign is now declared in _malloc.h */ -void qsort(void *__base, size_t __nel, size_t __width, - int (* _Nonnull __compar)(const void *, const void *)); -int rand(void) __swift_unavailable("Use arc4random instead."); -/* realloc is now declared in _malloc.h */ -void srand(unsigned) __swift_unavailable("Use arc4random instead."); -double strtod(const char *, char **) __DARWIN_ALIAS(strtod); -float strtof(const char *, char **) __DARWIN_ALIAS(strtof); -long strtol(const char *__str, char **__endptr, int __base); -long double - strtold(const char *, char **); -#if !__DARWIN_NO_LONG_LONG -long long - strtoll(const char *__str, char **__endptr, int __base); -#endif /* !__DARWIN_NO_LONG_LONG */ -unsigned long - strtoul(const char *__str, char **__endptr, int __base); -#if !__DARWIN_NO_LONG_LONG -unsigned long long - strtoull(const char *__str, char **__endptr, int __base); -#endif /* !__DARWIN_NO_LONG_LONG */ - -__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); - - -size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); -int wctomb(char *, wchar_t); - -#ifndef _ANSI_SOURCE -void _Exit(int) __dead2; -long a64l(const char *); -double drand48(void); -char *ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ -double erand48(unsigned short[3]); -char *fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */ -char *gcvt(double, int, char *); /* LEGACY */ -int getsubopt(char **, char * const *, char **); -int grantpt(int); -#if __DARWIN_UNIX03 -char *initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */ -#else /* !__DARWIN_UNIX03 */ -char *initstate(unsigned long, char *, long); -#endif /* __DARWIN_UNIX03 */ -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."); -long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); -int posix_openpt(int); -char *ptsname(int); - -#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); -#endif - -int putenv(char *) __DARWIN_ALIAS(putenv); -long random(void) __swift_unavailable("Use arc4random instead."); -int rand_r(unsigned *) __swift_unavailable("Use arc4random instead."); -#if (__DARWIN_UNIX03 && !defined(_POSIX_C_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(_DARWIN_BETTER_REALPATH) -char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath); -#else /* (!__DARWIN_UNIX03 || _POSIX_C_SOURCE) && !_DARWIN_C_SOURCE && !_DARWIN_BETTER_REALPATH */ -char *realpath(const char * __restrict, char * __restrict) __DARWIN_ALIAS(realpath); -#endif /* (__DARWIN_UNIX03 && _POSIX_C_SOURCE) || _DARWIN_C_SOURCE || _DARWIN_BETTER_REALPATH */ -unsigned short - *seed48(unsigned short[3]); -int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv); -#if __DARWIN_UNIX03 -void setkey(const char *) __DARWIN_ALIAS(setkey); -#else /* !__DARWIN_UNIX03 */ -int setkey(const char *); -#endif /* __DARWIN_UNIX03 */ -char *setstate(const char *); -void srand48(long); -#if __DARWIN_UNIX03 -void srandom(unsigned); -#else /* !__DARWIN_UNIX03 */ -void srandom(unsigned long); -#endif /* __DARWIN_UNIX03 */ -int unlockpt(int); -#if __DARWIN_UNIX03 -int unsetenv(const char *) __DARWIN_ALIAS(unsetenv); -#else /* !__DARWIN_UNIX03 */ -void unsetenv(const char *); -#endif /* __DARWIN_UNIX03 */ -#endif /* !_ANSI_SOURCE */ -__END_DECLS - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -#include -#include -#include -#include <_types/_uint32_t.h> - -__BEGIN_DECLS -uint32_t arc4random(void); -void arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/) - __OSX_DEPRECATED(10.0, 10.12, "use arc4random_stir") - __IOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") - __TVOS_DEPRECATED(2.0, 10.0, "use arc4random_stir") - __WATCHOS_DEPRECATED(1.0, 3.0, "use arc4random_stir"); -void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -void arc4random_stir(void); -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 *) __bsearch_noescape) - __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); -#endif /* __BLOCKS__ */ - - /* getcap(3) functions */ -char *cgetcap(char *, const char *, int); -int cgetclose(void); -int cgetent(char **, char **, const char *); -int cgetfirst(char **, char **); -int cgetmatch(const char *, const char *); -int cgetnext(char **, char **); -int cgetnum(char *, const char *, long *); -int cgetset(const char *); -int cgetstr(char *, const char *, char **); -int cgetustr(char *, const char *, char **); - -int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED; -char *devname(dev_t, mode_t); -char *devname_r(dev_t, mode_t, char *buf, int len); -char *getbsize(int *, long *); -int getloadavg(double [], int); -const char - *getprogname(void); -void setprogname(const char *); - -#ifdef __BLOCKS__ -#if __has_attribute(noescape) -#define __sort_noescape __attribute__((__noescape__)) -#else -#define __sort_noescape -#endif -#endif /* __BLOCKS__ */ - -int heapsort(void *__base, size_t __nel, size_t __width, - int (* _Nonnull __compar)(const void *, const void *)); -#ifdef __BLOCKS__ -int heapsort_b(void *__base, size_t __nel, size_t __width, - int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) - __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); -#endif /* __BLOCKS__ */ -int mergesort(void *__base, size_t __nel, size_t __width, - int (* _Nonnull __compar)(const void *, const void *)); -#ifdef __BLOCKS__ -int mergesort_b(void *__base, size_t __nel, size_t __width, - int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) - __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); -#endif /* __BLOCKS__ */ -void psort(void *__base, size_t __nel, size_t __width, - int (* _Nonnull __compar)(const void *, const void *)) - __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); -#ifdef __BLOCKS__ -void psort_b(void *__base, size_t __nel, size_t __width, - int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) - __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); -#endif /* __BLOCKS__ */ -void psort_r(void *__base, size_t __nel, size_t __width, void *, - int (* _Nonnull __compar)(void *, const void *, const void *)) - __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); -#ifdef __BLOCKS__ -void qsort_b(void *__base, size_t __nel, size_t __width, - int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape) - __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2); -#endif /* __BLOCKS__ */ -void qsort_r(void *__base, size_t __nel, size_t __width, void *, - int (* _Nonnull __compar)(void *, const void *, const void *)); -int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - unsigned __endbyte); -int rpmatch(const char *) - __API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0)); -int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table, - unsigned __endbyte); -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); -unsigned long long - strtouq(const char *__str, char **__endptr, int __base); -#endif /* !__DARWIN_NO_LONG_LONG */ -extern char *suboptarg; /* getsubopt(3) external variable */ -/* valloc is now declared in _malloc.h */ -__END_DECLS -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ - -__BEGIN_DECLS -/* Poison the following routines if -fshort-wchar is set */ -#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU -#pragma GCC poison mbstowcs mbtowc wcstombs wctomb -#endif -__END_DECLS +#include <_stdlib.h> #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* _STDLIB_H_ */ diff --git a/lib/libc/include/any-macos-any/string.h b/lib/libc/include/any-macos-any/string.h index f0c7fc602e44..f1a4deae626c 100644 --- a/lib/libc/include/any-macos-any/string.h +++ b/lib/libc/include/any-macos-any/string.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, 2010 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2007, 2010, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -55,143 +55,8 @@ * @(#)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); - -__OSX_AVAILABLE(11.0) __IOS_AVAILABLE(14.0) -__TVOS_AVAILABLE(14.0) __WATCHOS_AVAILABLE(7.0) -int strsignal_r(int __sig, char *__strsignalbuf, size_t __buflen); -__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 */ - +#include <_string.h> #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_ */ diff --git a/lib/libc/include/any-macos-any/strings.h b/lib/libc/include/any-macos-any/strings.h index c0e915f8ac35..4b1e363f9b37 100644 --- a/lib/libc/include/any-macos-any/strings.h +++ b/lib/libc/include/any-macos-any/strings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, 2010 Apple Inc. All rights reserved. + * Copyright (c) 2000, 2007, 2010, 2023 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -58,44 +58,11 @@ #ifndef _STRINGS_H_ #define _STRINGS_H_ -#include <_types.h> +#include <_strings.h> -#include -#include -#include - -__BEGIN_DECLS -/* Removed in Issue 7 */ -#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L -int bcmp(const void *, const void *, size_t) __POSIX_C_DEPRECATED(200112L); -void bcopy(const void *, void *, size_t) __POSIX_C_DEPRECATED(200112L); -void bzero(void *, size_t) __POSIX_C_DEPRECATED(200112L); -char *index(const char *, int) __POSIX_C_DEPRECATED(200112L); -char *rindex(const char *, int) __POSIX_C_DEPRECATED(200112L); -#endif - -int ffs(int); -int strcasecmp(const char *, const char *); -int strncasecmp(const char *, const char *, size_t); -__END_DECLS - -/* Darwin extensions */ #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -__BEGIN_DECLS -int ffsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); -int ffsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0); -int fls(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); -int flsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); -int flsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0); -__END_DECLS - #include #endif -#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus) -/* Security checking functions. */ -#include -#endif - #endif /* _STRINGS_H_ */ diff --git a/lib/libc/include/any-macos-any/sys/__endian.h b/lib/libc/include/any-macos-any/sys/__endian.h new file mode 100644 index 000000000000..51819a7ce5f9 --- /dev/null +++ b/lib/libc/include/any-macos-any/sys/__endian.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2004, 2006, 2023 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) 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) 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. + */ + +#ifndef _SYS___ENDIAN_H_ +#define _SYS___ENDIAN_H_ + +/* + * 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 */ + +#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 + +#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ +#endif /* !_SYS___ENDIAN_H_ */ diff --git a/lib/libc/include/any-macos-any/sys/_endian.h b/lib/libc/include/any-macos-any/sys/_endian.h index 11d37e5cc1a1..c3b9235d4ff0 100644 --- a/lib/libc/include/any-macos-any/sys/_endian.h +++ b/lib/libc/include/any-macos-any/sys/_endian.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004, 2006, 2023 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -91,7 +91,7 @@ #define _SYS__ENDIAN_H_ #include -#include +#include /* * Macros for network/external number representation conversion. @@ -118,12 +118,12 @@ __END_DECLS #define ntohll(x) ((__uint64_t)(x)) #define htonll(x) ((__uint64_t)(x)) -#define NTOHL(x) (x) -#define NTOHS(x) (x) -#define NTOHLL(x) (x) -#define HTONL(x) (x) -#define HTONS(x) (x) -#define HTONLL(x) (x) +#define NTOHL(x) (x) = (x) +#define NTOHS(x) (x) = (x) +#define NTOHLL(x) (x) = (x) +#define HTONL(x) (x) = (x) +#define HTONS(x) (x) = (x) +#define HTONLL(x) (x) = (x) #endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */ #else /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */ diff --git a/lib/libc/include/any-macos-any/sys/_symbol_aliasing.h b/lib/libc/include/any-macos-any/sys/_symbol_aliasing.h index ff03eb81cd83..b3f27c5ebf15 100644 --- a/lib/libc/include/any-macos-any/sys/_symbol_aliasing.h +++ b/lib/libc/include/any-macos-any/sys/_symbol_aliasing.h @@ -413,6 +413,18 @@ #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_6(x) #endif +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150700 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_7(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_7(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 150800 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_8(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_15_8(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 @@ -449,12 +461,66 @@ #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_5(x) #endif +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160600 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_6(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_6(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160700 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_7(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_7(x) +#endif + #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170000 #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_0(x) x #else #define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_0(x) #endif +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170100 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_1(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170200 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_2(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_2(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170300 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_3(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_3(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170400 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_4(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_4(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170500 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_5(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_17_5(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 180000 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_18_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_18_0(x) +#endif + +#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 180100 +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_18_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_18_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 @@ -731,6 +797,18 @@ #define __DARWIN_ALIAS_STARTING_MAC___MAC_12_5(x) #endif +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120600 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_6(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_6(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120700 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_7(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_12_7(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 @@ -767,9 +845,63 @@ #define __DARWIN_ALIAS_STARTING_MAC___MAC_13_4(x) #endif +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130500 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_5(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_5(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130600 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_6(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_6(x) +#endif + #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140000 #define __DARWIN_ALIAS_STARTING_MAC___MAC_14_0(x) x #else #define __DARWIN_ALIAS_STARTING_MAC___MAC_14_0(x) #endif +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140100 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_1(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140200 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_2(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_2(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140300 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_3(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_3(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140400 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_4(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_4(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140500 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_5(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_14_5(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 150000 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_15_0(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_15_0(x) +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 150100 +#define __DARWIN_ALIAS_STARTING_MAC___MAC_15_1(x) x +#else +#define __DARWIN_ALIAS_STARTING_MAC___MAC_15_1(x) +#endif + diff --git a/lib/libc/include/any-macos-any/sys/_types.h b/lib/libc/include/any-macos-any/sys/_types.h index 43be468d7b3a..3752de0f2e34 100644 --- a/lib/libc/include/any-macos-any/sys/_types.h +++ b/lib/libc/include/any-macos-any/sys/_types.h @@ -32,13 +32,25 @@ #include #include +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_TYPES 1 +#else +#define USE_CLANG_TYPES 0 +#endif + +#if USE_CLANG_TYPES +#include +#endif + /* * Type definitions; takes common type definitions that must be used * in multiple header files due to [XSI], removes them from the system * space, and puts them in the implementation space. */ -#ifdef __cplusplus +#if USE_CLANG_TYPES +#define __DARWIN_NULL NULL +#elif defined(__cplusplus) #ifdef __GNUG__ #define __DARWIN_NULL __null #else /* ! __GNUG__ */ @@ -50,7 +62,7 @@ #endif /* __GNUG__ */ #else /* ! __cplusplus */ #define __DARWIN_NULL ((void *)0) -#endif /* __cplusplus */ +#endif typedef __int64_t __darwin_blkcnt_t; /* total blocks */ typedef __int32_t __darwin_blksize_t; /* preferred block size */ @@ -77,6 +89,8 @@ typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */ typedef unsigned char __darwin_uuid_t[16]; typedef char __darwin_uuid_string_t[37]; +#undef USE_CLANG_TYPES + #include #if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3) diff --git a/lib/libc/include/any-macos-any/sys/_types/_caddr_t.h b/lib/libc/include/any-macos-any/sys/_types/_caddr_t.h index 159e186d39fd..6422b9524580 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_caddr_t.h +++ b/lib/libc/include/any-macos-any/sys/_types/_caddr_t.h @@ -29,3 +29,4 @@ #define _CADDR_T typedef char * caddr_t; #endif /* _CADDR_T */ + diff --git a/lib/libc/include/any-macos-any/sys/_types/_fd_clr.h b/lib/libc/include/any-macos-any/sys/_types/_fd_clr.h index eeb65b362738..23fc4c25ef7b 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_fd_clr.h +++ b/lib/libc/include/any-macos-any/sys/_types/_fd_clr.h @@ -26,5 +26,6 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef FD_CLR +#include #define FD_CLR(n, p) __DARWIN_FD_CLR(n, p) #endif /* FD_CLR */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_fd_copy.h b/lib/libc/include/any-macos-any/sys/_types/_fd_copy.h index d0e9c1ec9aaa..365ff08049d6 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_fd_copy.h +++ b/lib/libc/include/any-macos-any/sys/_types/_fd_copy.h @@ -26,5 +26,6 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef FD_COPY +#include #define FD_COPY(f, t) __DARWIN_FD_COPY(f, t) #endif /* FD_COPY */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_fd_isset.h b/lib/libc/include/any-macos-any/sys/_types/_fd_isset.h index e3b3d9856112..1377bda0718e 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_fd_isset.h +++ b/lib/libc/include/any-macos-any/sys/_types/_fd_isset.h @@ -26,5 +26,6 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef FD_ISSET +#include #define FD_ISSET(n, p) __DARWIN_FD_ISSET(n, p) #endif /* FD_ISSET */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_fd_set.h b/lib/libc/include/any-macos-any/sys/_types/_fd_set.h index 67f4fa4df33d..41ed3c854125 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_fd_set.h +++ b/lib/libc/include/any-macos-any/sys/_types/_fd_set.h @@ -26,5 +26,6 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef FD_SET +#include #define FD_SET(n, p) __DARWIN_FD_SET(n, p) #endif /* FD_SET */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_fd_setsize.h b/lib/libc/include/any-macos-any/sys/_types/_fd_setsize.h index c5c3ec9d8f75..53ba6616f985 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_fd_setsize.h +++ b/lib/libc/include/any-macos-any/sys/_types/_fd_setsize.h @@ -26,5 +26,6 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef FD_SETSIZE +#include #define FD_SETSIZE __DARWIN_FD_SETSIZE #endif /* FD_SETSIZE */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_fd_zero.h b/lib/libc/include/any-macos-any/sys/_types/_fd_zero.h index 8363df3bd729..25d267df697c 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_fd_zero.h +++ b/lib/libc/include/any-macos-any/sys/_types/_fd_zero.h @@ -26,5 +26,6 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef FD_ZERO +#include #define FD_ZERO(p) __DARWIN_FD_ZERO(p) #endif /* FD_ZERO */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_intptr_t.h b/lib/libc/include/any-macos-any/sys/_types/_intptr_t.h index 0f494b9e5c2f..2076ef7ccc1e 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_intptr_t.h +++ b/lib/libc/include/any-macos-any/sys/_types/_intptr_t.h @@ -27,7 +27,7 @@ */ #ifndef _INTPTR_T #define _INTPTR_T -#include /* __darwin_intptr_t */ +#include /* __darwin_intptr_t */ typedef __darwin_intptr_t intptr_t; #endif /* _INTPTR_T */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_null.h b/lib/libc/include/any-macos-any/sys/_types/_null.h index 9c21571ea479..09b43fd95a84 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_null.h +++ b/lib/libc/include/any-macos-any/sys/_types/_null.h @@ -25,7 +25,30 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_STDDEF 1 +#else +#define USE_CLANG_STDDEF 0 +#endif + +#if USE_CLANG_STDDEF + +#ifndef __NULL +#define __NULL + +#define __need_NULL +#include +#undef __need_NULL + +#endif /* __NULL */ + +#else + #ifndef NULL #include /* __DARWIN_NULL */ #define NULL __DARWIN_NULL #endif /* NULL */ + +#endif + +#undef USE_CLANG_STDDEF diff --git a/lib/libc/include/any-macos-any/sys/_types/_offsetof.h b/lib/libc/include/any-macos-any/sys/_types/_offsetof.h index fa831a51101b..66ef1c785e4f 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_offsetof.h +++ b/lib/libc/include/any-macos-any/sys/_types/_offsetof.h @@ -25,6 +25,29 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_STDDEF 1 +#else +#define USE_CLANG_STDDEF 0 +#endif + +#if USE_CLANG_STDDEF + +#ifndef __OFFSETOF +#define __OFFSETOF + +#define __need_offsetof +#include +#undef __need_offsetof + +#endif /* __OFFSETOF */ + +#else + #ifndef offsetof #define offsetof(type, field) __offsetof(type, field) #endif /* offsetof */ + +#endif + +#undef USE_CLANG_STDDEF diff --git a/lib/libc/include/any-macos-any/sys/_types/_ptrdiff_t.h b/lib/libc/include/any-macos-any/sys/_types/_ptrdiff_t.h index 31a065770fd1..91824218637f 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_ptrdiff_t.h +++ b/lib/libc/include/any-macos-any/sys/_types/_ptrdiff_t.h @@ -26,8 +26,31 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_STDDEF 1 +#else +#define USE_CLANG_STDDEF 0 +#endif + +#if USE_CLANG_STDDEF + +#ifndef __PTRDIFF_T +#define __PTRDIFF_T + +#define __need_ptrdiff_t +#include +#undef __need_ptrdiff_t + +#endif /* __PTRDIFF_T */ + +#else + #ifndef _PTRDIFF_T #define _PTRDIFF_T #include /* __darwin_ptrdiff_t */ typedef __darwin_ptrdiff_t ptrdiff_t; #endif /* _PTRDIFF_T */ + +#endif + +#undef USE_CLANG_STDDEF diff --git a/lib/libc/include/any-macos-any/sys/_types/_rsize_t.h b/lib/libc/include/any-macos-any/sys/_types/_rsize_t.h index 6aa2f6b320f2..178c40e7de3e 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_rsize_t.h +++ b/lib/libc/include/any-macos-any/sys/_types/_rsize_t.h @@ -25,8 +25,31 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_STDDEF 1 +#else +#define USE_CLANG_STDDEF 0 +#endif + +#if USE_CLANG_STDDEF + +#ifndef __RSIZE_T +#define __RSIZE_T + +#define __need_rsize_t +#include +#undef __need_rsize_t + +#endif /* __RSIZE_T */ + +#else + #ifndef _RSIZE_T #define _RSIZE_T #include /* __darwin_size_t */ typedef __darwin_size_t rsize_t; #endif /* _RSIZE_T */ + +#endif + +#undef USE_CLANG_STDDEF diff --git a/lib/libc/include/any-macos-any/sys/_types/_size_t.h b/lib/libc/include/any-macos-any/sys/_types/_size_t.h index a14a8885fa6c..72d844c1e77a 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_size_t.h +++ b/lib/libc/include/any-macos-any/sys/_types/_size_t.h @@ -25,8 +25,32 @@ * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_STDDEF 1 +#else +#define USE_CLANG_STDDEF 0 +#endif + +#if USE_CLANG_STDDEF + +#ifndef __SIZE_T +#define __SIZE_T + +#define __need_size_t +#include +#undef __need_size_t + +#endif /* __SIZE_T */ + +#else + #ifndef _SIZE_T #define _SIZE_T #include /* __darwin_size_t */ typedef __darwin_size_t size_t; #endif /* _SIZE_T */ + +#endif + + +#undef USE_CLANG_STDDEF diff --git a/lib/libc/include/any-macos-any/sys/_types/_va_list.h b/lib/libc/include/any-macos-any/sys/_types/_va_list.h index f7687baea9ee..e1448498bc43 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_va_list.h +++ b/lib/libc/include/any-macos-any/sys/_types/_va_list.h @@ -28,6 +28,22 @@ #ifndef _VA_LIST_T #define _VA_LIST_T + +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_STDARG 1 +#else +#define USE_CLANG_STDARG 0 +#endif + +#if USE_CLANG_STDARG +#define __need_va_list +#include +#undef __need_va_list +#else #include /* __darwin_va_list */ typedef __darwin_va_list va_list; +#endif + +#undef USE_CLANG_STDARG + #endif /* _VA_LIST_T */ diff --git a/lib/libc/include/any-macos-any/sys/_types/_wchar_t.h b/lib/libc/include/any-macos-any/sys/_types/_wchar_t.h index d67cfcdd23d5..125810c6e221 100644 --- a/lib/libc/include/any-macos-any/sys/_types/_wchar_t.h +++ b/lib/libc/include/any-macos-any/sys/_types/_wchar_t.h @@ -26,6 +26,25 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ +#if defined(__has_feature) && __has_feature(modules) +#define USE_CLANG_STDDEF 1 +#else +#define USE_CLANG_STDDEF 0 +#endif + +#if USE_CLANG_STDDEF + +#ifndef __WCHAR_T +#define __WCHAR_T + +#define __need_wchar_t +#include +#undef __need_wchar_t + +#endif /* __WCHAR_T */ + +#else + /* wchar_t is a built-in type in C++ */ #ifndef __cplusplus #ifndef _WCHAR_T @@ -34,3 +53,7 @@ typedef __darwin_wchar_t wchar_t; #endif /* _WCHAR_T */ #endif /* __cplusplus */ + +#endif + +#undef USE_CLANG_STDDEF diff --git a/lib/libc/include/any-macos-any/sys/attr.h b/lib/libc/include/any-macos-any/sys/attr.h index af8fff6bf5e3..f68a28a0b251 100644 --- a/lib/libc/include/any-macos-any/sys/attr.h +++ b/lib/libc/include/any-macos-any/sys/attr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2018 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2018, 2023 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -249,6 +249,12 @@ typedef struct vol_capabilities_attr { * VOL_CAP_FMT_SEALED: When set, this volume is cryptographically sealed. * Any modifications to volume data or metadata will be detected and may * render the volume unusable. + * + * VOL_CAP_FMT_CLONE_MAPPING: When set, this volume supports full clone tracking. + * See ATTR_CMNEXT_CLONE_REFCNT and ATTR_CMNEXT_CLONEID for more details. + * Other features like extended directory statistics, for fast directory sizing, + * and attribution tags may be supported as well. + * See VOL_CAP_INT_ATTRIBUTION_TAG for more details related to tagging. */ #define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001 #define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002 @@ -276,6 +282,7 @@ typedef struct vol_capabilities_attr { #define VOL_CAP_FMT_SHARED_SPACE 0x00800000 #define VOL_CAP_FMT_VOL_GROUPS 0x01000000 #define VOL_CAP_FMT_SEALED 0x02000000 +#define VOL_CAP_FMT_CLONE_MAPPING 0x04000000 /* * VOL_CAP_INT_SEARCHFS: When set, the volume implements the @@ -349,6 +356,13 @@ typedef struct vol_capabilities_attr { * * VOL_CAP_INT_RENAME_SECLUDE: When set, the volume supports a * seclude rename operation. + * + * VOL_CAP_INT_ATTRIBUTION_TAG: When set, the volume supports establishing + * an owner relationship between a file (excluding small files) and a process + * on the first read/write/truncate/clone operation. + * + * VOL_CAP_INT_PUNCHHOLE: When set, the volume supports the F_PUNCHHOLE + * fcntl. */ #define VOL_CAP_INT_SEARCHFS 0x00000001 #define VOL_CAP_INT_ATTRLIST 0x00000002 @@ -371,6 +385,8 @@ typedef struct vol_capabilities_attr { #define VOL_CAP_INT_RENAME_EXCL 0x00080000 #define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 #define VOL_CAP_INT_RENAME_SECLUDE 0x00200000 +#define VOL_CAP_INT_ATTRIBUTION_TAG 0x00400000 +#define VOL_CAP_INT_PUNCHHOLE 0x00800000 typedef struct vol_attributes_attr { attribute_set_t validattr; @@ -597,4 +613,6 @@ struct searchstate { #define FST_EOF (-1) /* end-of-file offset */ #endif /* __APPLE_API_UNSTABLE */ + + #endif /* !_SYS_ATTR_H_ */ diff --git a/lib/libc/include/any-macos-any/sys/cdefs.h b/lib/libc/include/any-macos-any/sys/cdefs.h index 4abb3b91cc71..317f7d435143 100644 --- a/lib/libc/include/any-macos-any/sys/cdefs.h +++ b/lib/libc/include/any-macos-any/sys/cdefs.h @@ -97,6 +97,9 @@ #ifndef __has_attribute #define __has_attribute(x) 0 #endif +#ifndef __has_cpp_attribute +#define __has_cpp_attribute(x) 0 +#endif #ifndef __has_extension #define __has_extension(x) 0 #endif @@ -322,6 +325,19 @@ #define __swift_unavailable(_msg) #endif +/* + * Attributes to support Swift concurrency. + */ +#if __has_attribute(__swift_attr__) +#define __swift_unavailable_from_async(_msg) __attribute__((__swift_attr__("@_unavailableFromAsync(message: \"" _msg "\")"))) +#define __swift_nonisolated __attribute__((__swift_attr__("nonisolated"))) +#define __swift_nonisolated_unsafe __attribute__((__swift_attr__("nonisolated(unsafe)"))) +#else +#define __swift_unavailable_from_async(_msg) +#define __swift_nonisolated +#define __swift_nonisolated_unsafe +#endif + /* * __abortlike is the attribute to put on functions like abort() that are * typically used to mark assertions. These optimize the codegen @@ -478,6 +494,94 @@ #endif #endif // __alloc_size +/* + * Facilities below assist adoption of -Wunsafe-buffer-usage, an off-by-default + * Clang compiler warning that helps the developer minimize unsafe, raw + * buffer manipulation in the code that may lead to buffer overflow + * vulnerabilities. + * + * They are primarily designed for modern C++ code where -Wunsafe-buffer-usage + * comes with automatic fix-it hints that help the developer transform + * their code to use modern C++ containers, which may be made bounds-safe by + * linking against a version of the C++ standard library that offers + * bounds-checked containers. + * They can be used in plain C, but -fbounds-safety is the preferred solution + * for plain C (see also ). + * + * Attribute __unsafe_buffer_usage can be used to label functions that should be + * avoided as they may perform or otherwise introduce unsafe buffer + * manipulation operations. + * + * Calls to such functions are flagged by -Wunsafe-buffer-usage, similarly to + * how unchecked buffer manipulation operations are flagged when observed + * by the compiler directly: + * + * // An unsafe function that needs to be avoided. + * __unsafe_buffer_usage + * void foo(int *buf, size_t size); + * + * // A safe alternative to foo(). + * void foo(std::span buf); + * + * void bar(size_t idx) { + * int array[5]; + * + * // Direct unsafe buffer manipulation through subscript operator: + * array[idx] = 3; // warning [-Wunsafe-buffer-usage] + * // Unsafe buffer manipulation through function foo(): + * foo(array, 5); // warning [-Wunsafe-buffer-usage] + * // Checked buffer manipulation, with bounds information automatically + * // preserved for the purposes of runtime checks in standard library: + * foo(array); // no warning + * } + * + * While annotating a function as __unsafe_buffer_usage has an effect similar + * to annotating it as __deprecated, the __unsafe_buffer_usage attribute + * should be used whenever the resulting warning needs to be controlled + * by the -Wunsafe-buffer-usage flag (which is turned off in codebases that + * don't attempt to achieve bounds safety this way) as opposed to -Wdeprecated + * (enabled in most codebases). + * + * The attribute does NOT suppress -Wunsafe-buffer-usage warnings inside + * the function's body; it simply introduces new warnings at each call site + * to help the developers avoid the function entirely. Most of the time + * it does not make sense to annotate a function as __unsafe_buffer_usage + * without providing the users with a safe alternative. + * + * Pragmas __unsafe_buffer_usage_begin and __unsafe_buffer_usage_end + * annotate a range of code as intentionally containing unsafe buffer + * operations. They suppress -Wunsafe-buffer-usage warnings + * for unsafe operations in range: + * + * __unsafe_buffer_usage_begin + * array[idx] = 3; // warning suppressed + * foo(array, 5); // warning suppressed + * __unsafe_buffer_usage_end + * + * These pragmas are NOT a way to mass-annotate functions with the attribute + * __unsafe_buffer_usage. Functions declared within the pragma range + * do NOT get annotated automatically. In some rare situations it makes sense + * to do all three: put the attribute on the function, put pragmas inside + * the body of the function, and put pragmas around some call sites. + */ +#if __has_cpp_attribute(clang::unsafe_buffer_usage) +#define __has_safe_buffers 1 +#define __unsafe_buffer_usage [[clang::unsafe_buffer_usage]] +#elif __has_attribute(unsafe_buffer_usage) +#define __has_safe_buffers 1 +#define __unsafe_buffer_usage __attribute__((__unsafe_buffer_usage__)) +#else +#define __has_safe_buffers 0 +#define __unsafe_buffer_usage +#endif +#if __has_safe_buffers +#define __unsafe_buffer_usage_begin _Pragma("clang unsafe_buffer_usage begin") +#define __unsafe_buffer_usage_end _Pragma("clang unsafe_buffer_usage end") +#else +#define __unsafe_buffer_usage_begin +#define __unsafe_buffer_usage_end +#endif + /* * COMPILATION ENVIRONMENTS -- see compat(5) for additional detail * @@ -870,7 +974,9 @@ #define __single #define __unsafe_indexable #define __counted_by(N) +#define __counted_by_or_null(N) #define __sized_by(N) +#define __sized_by_or_null(N) #define __ended_by(E) #define __terminated_by(T) #define __null_terminated @@ -888,6 +994,8 @@ /* __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 __unsafe_forge_terminated_by(T, P, E) ((T)(P)) +#define __unsafe_forge_null_terminated(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) @@ -900,6 +1008,10 @@ /* this is a write-once variable; not useful without pointer checks. */ #define __unsafe_late_const + +#define __ptrcheck_unavailable +#define __ptrcheck_unavailable_r(REPLACEMENT) + #endif /* !__has_include() */ @@ -978,4 +1090,22 @@ +#if defined(KERNEL_PRIVATE) && \ + __has_attribute(xnu_data_size) && \ + __has_attribute(xnu_returns_data_pointer) +/* + * Annotate function parameters to specify that they semantically + * represent the size of a data-only backing storage. + */ +# define __xnu_data_size __attribute__((xnu_data_size)) +/* + * Annotate function declarations to specify that the pointer they return + * points to a data-only backing storage. + */ +# define __xnu_returns_data_pointer __attribute__((xnu_returns_data_pointer)) +#else +# define __xnu_data_size +# define __xnu_returns_data_pointer +#endif + #endif /* !_CDEFS_H_ */ diff --git a/lib/libc/include/any-macos-any/sys/clonefile.h b/lib/libc/include/any-macos-any/sys/clonefile.h index bba879a23f14..5b34440fd568 100644 --- a/lib/libc/include/any-macos-any/sys/clonefile.h +++ b/lib/libc/include/any-macos-any/sys/clonefile.h @@ -33,6 +33,7 @@ #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 */ +#define CLONE_NOFOLLOW_ANY 0x0008 /* Don't follow any symbolic links in the path */ #include diff --git a/lib/libc/include/any-macos-any/sys/constrained_ctypes.h b/lib/libc/include/any-macos-any/sys/constrained_ctypes.h index 496e7bb2f475..54b9f876c26f 100644 --- a/lib/libc/include/any-macos-any/sys/constrained_ctypes.h +++ b/lib/libc/include/any-macos-any/sys/constrained_ctypes.h @@ -375,21 +375,6 @@ * }; * * - * 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. diff --git a/lib/libc/include/any-macos-any/sys/dirent.h b/lib/libc/include/any-macos-any/sys/dirent.h index 9a107a016c22..0b019683d513 100644 --- a/lib/libc/include/any-macos-any/sys/dirent.h +++ b/lib/libc/include/any-macos-any/sys/dirent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2008 Apple Inc. All rights reserved. + * Copyright (c) 2000-2008, 2023 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * diff --git a/lib/libc/include/any-macos-any/sys/event.h b/lib/libc/include/any-macos-any/sys/event.h index ac5cd5fa67c9..e379ba88a0cf 100644 --- a/lib/libc/include/any-macos-any/sys/event.h +++ b/lib/libc/include/any-macos-any/sys/event.h @@ -78,7 +78,7 @@ #define EVFILT_VM (-12) /* Virtual memory events */ #define EVFILT_EXCEPT (-15) /* Exception events */ -#define EVFILT_SYSCOUNT 17 +#define EVFILT_SYSCOUNT 18 #define EVFILT_THREADMARKER EVFILT_SYSCOUNT /* Internal use only */ #pragma pack(4) diff --git a/lib/libc/include/any-macos-any/sys/fcntl.h b/lib/libc/include/any-macos-any/sys/fcntl.h index 20c29ce678a5..963b1fa34ebf 100644 --- a/lib/libc/include/any-macos-any/sys/fcntl.h +++ b/lib/libc/include/any-macos-any/sys/fcntl.h @@ -338,6 +338,8 @@ #define F_ATTRIBUTION_TAG 111 /* Based on flags, query/set/delete a file's attribution tag */ +#define F_ADDSIGS_MAIN_BINARY 113 /* add detached signatures for main binary -- development only */ + // FS-specific fcntl()'s numbers begin at 0x00010000 and go up #define FCNTL_FS_SPECIFIC_BASE 0x00010000 diff --git a/lib/libc/include/any-macos-any/sys/mman.h b/lib/libc/include/any-macos-any/sys/mman.h index ba6204636791..91cf985f73fa 100644 --- a/lib/libc/include/any-macos-any/sys/mman.h +++ b/lib/libc/include/any-macos-any/sys/mman.h @@ -211,6 +211,7 @@ #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) */ +#define MADV_ZERO 11 /* zero pages without faulting in additional pages */ /* * Return bits from mincore diff --git a/lib/libc/include/any-macos-any/sys/mount.h b/lib/libc/include/any-macos-any/sys/mount.h index 47488a9aeefb..d05a58255ffc 100644 --- a/lib/libc/include/any-macos-any/sys/mount.h +++ b/lib/libc/include/any-macos-any/sys/mount.h @@ -383,7 +383,8 @@ struct netfs_status { #define VQ_NEARLOWDISK 0x2000 /* Above lowdisk and below desired disk space */ #define VQ_DESIRED_DISK 0x4000 /* the desired disk space */ #define VQ_FREE_SPACE_CHANGE 0x8000 /* free disk space has significantly changed */ -#define VQ_FLAG10000 0x10000 /* placeholder */ +#define VQ_PURGEABLE_SPACE_CHANGE 0x10000 /* purgeable disk space has significantly changed */ +#define VQ_FLAG20000 0x20000 /* placeholder */ @@ -407,7 +408,7 @@ typedef struct fhandle fhandle_t; * cryptexes. We need to make sure we do not use the reserved values in each for a new authentication type. */ // bump up the version for any change that has kext dependency -#define CRYPTEX_AUTH_STRUCT_VERSION 1 +#define CRYPTEX_AUTH_STRUCT_VERSION 2 OS_ENUM(graftdmg_type, uint32_t, GRAFTDMG_CRYPTEX_BOOT = 1, GRAFTDMG_CRYPTEX_PREBOOT = 2, @@ -416,8 +417,9 @@ OS_ENUM(graftdmg_type, uint32_t, // Reserved: CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5, GRAFTDMG_CRYPTEX_PDI_NONCE = 6, GRAFTDMG_CRYPTEX_EFFECTIVE_AP = 7, + GRAFTDMG_CRYPTEX_MOBILE_ASSET = 8, // Update this when a new type is added - GRAFTDMG_CRYPTEX_MAX = 7); + GRAFTDMG_CRYPTEX_MAX = 8); OS_ENUM(cryptex_auth_type, uint32_t, // Reserved: GRAFTDMG_CRYPTEX_BOOT = 1, @@ -426,9 +428,10 @@ OS_ENUM(cryptex_auth_type, uint32_t, CRYPTEX1_AUTH_ENV_GENERIC = 4, CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5, CRYPTEX_AUTH_PDI_NONCE = 6, - // Reserved: GRAFTDMG_CRYPTEX_EFFECTIVE_AP = 7 + // Reserved: GRAFTDMG_CRYPTEX_EFFECTIVE_AP = 7, + CRYPTEX_AUTH_MOBILE_ASSET = 8, // Update this when a new type is added - CRYPTEX_AUTH_MAX = 7); + CRYPTEX_AUTH_MAX = 8); __BEGIN_DECLS diff --git a/lib/libc/include/any-macos-any/sys/proc_info.h b/lib/libc/include/any-macos-any/sys/proc_info.h index 6356ff0c327d..967e21223073 100644 --- a/lib/libc/include/any-macos-any/sys/proc_info.h +++ b/lib/libc/include/any-macos-any/sys/proc_info.h @@ -232,6 +232,18 @@ struct proc_workqueueinfo { #define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1 #define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2 #define WQ_FLAGS_AVAILABLE 0x4 +/* + * WQ_EXCEEDED_COOPERATIVE_THREAD_LIMIT is set if wq has scheduled cooperative + * threads upto the cooperative thread pool limit and there is still more work + * pending in the cooperative pool that require a thread. + */ +#define WQ_EXCEEDED_COOPERATIVE_THREAD_LIMIT 0x8 +/* + * WQ_EXCEEDED_ACTIVE_CONSTRAINED_THREAD_LIMIT is set when wq has pending thread + * requests for the constrained thread pool; but, has failed the allowance check + * because of active thread limit. + */ +#define WQ_EXCEEDED_ACTIVE_CONSTRAINED_THREAD_LIMIT 0x10 struct proc_fileinfo { uint32_t fi_openflags; diff --git a/lib/libc/include/any-macos-any/sys/queue.h b/lib/libc/include/any-macos-any/sys/queue.h index 4ae79ffc2392..2470343d0912 100644 --- a/lib/libc/include/any-macos-any/sys/queue.h +++ b/lib/libc/include/any-macos-any/sys/queue.h @@ -118,30 +118,30 @@ * For details on the use of these macros, see the queue(3) manual page. * * - * SLIST LIST STAILQ TAILQ CIRCLEQ - * _HEAD + + + + + - * _HEAD_INITIALIZER + + + + - - * _ENTRY + + + + + - * _INIT + + + + + - * _EMPTY + + + + + - * _FIRST + + + + + - * _NEXT + + + + + - * _PREV - - - + + - * _LAST - - + + + - * _FOREACH + + + + + - * _FOREACH_SAFE + + + + - - * _FOREACH_REVERSE - - - + - - * _FOREACH_REVERSE_SAFE - - - + - - * _INSERT_HEAD + + + + + - * _INSERT_BEFORE - + - + + - * _INSERT_AFTER + + + + + - * _INSERT_TAIL - - + + + - * _CONCAT - - + + - - * _REMOVE_AFTER + - + - - - * _REMOVE_HEAD + - + - - - * _REMOVE_HEAD_UNTIL - - + - - - * _REMOVE + + + + + - * _SWAP - + + + - + * SLIST LIST STAILQ TAILQ CIRCLEQ + * _HEAD + + + + + + * _HEAD_INITIALIZER + + + + - + * _ENTRY + + + + + + * _INIT + + + + + + * _EMPTY + + + + + + * _FIRST + + + + + + * _NEXT + + + + + + * _PREV - - - + + + * _LAST - - + + + + * _FOREACH + + + + + + * _FOREACH_SAFE + + + + - + * _FOREACH_REVERSE - - - + - + * _FOREACH_REVERSE_SAFE - - - + - + * _INSERT_HEAD + + + + + + * _INSERT_BEFORE - + - + + + * _INSERT_AFTER + + + + + + * _INSERT_TAIL - - + + + + * _CONCAT - - + + - + * _REMOVE_AFTER + - + - - + * _REMOVE_HEAD + - + - - + * _REMOVE_HEAD_UNTIL - - + - - + * _REMOVE + + + + + + * _SWAP - + + + - * */ #ifdef QUEUE_MACRO_DEBUG diff --git a/lib/libc/include/any-macos-any/sys/resource.h b/lib/libc/include/any-macos-any/sys/resource.h index 038f2556981a..995007869c50 100644 --- a/lib/libc/include/any-macos-any/sys/resource.h +++ b/lib/libc/include/any-macos-any/sys/resource.h @@ -104,7 +104,7 @@ typedef __uint64_t rlim_t; #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define PRIO_DARWIN_THREAD 3 /* Second argument is always 0 (current thread) */ #define PRIO_DARWIN_PROCESS 4 /* Second argument is a PID */ - +/* Additional private parameters to getpriority()/setpriority() are in resource_private.h */ /* * Range limitations for the value of the third parameter to setpriority(). @@ -409,7 +409,12 @@ struct rusage_info_v6 { uint64_t ri_pcycles; uint64_t ri_energy_nj; uint64_t ri_penergy_nj; - uint64_t ri_reserved[14]; + uint64_t ri_secure_time_in_system; + uint64_t ri_secure_ptime_in_system; + uint64_t ri_neural_footprint; + uint64_t ri_lifetime_max_neural_footprint; + uint64_t ri_interval_max_neural_footprint; + uint64_t ri_reserved[9]; }; typedef struct rusage_info_v6 rusage_info_current; @@ -496,7 +501,7 @@ struct proc_rlimit_control_wakeupmon { int32_t wm_rate; }; - +/* Additional private I/O policies are in resource_private.h */ /* I/O type */ #define IOPOL_TYPE_DISK 0 @@ -527,7 +532,6 @@ struct proc_rlimit_control_wakeupmon { #define IOPOL_APPLICATION IOPOL_STANDARD #define IOPOL_NORMAL IOPOL_IMPORTANT - #define IOPOL_ATIME_UPDATES_DEFAULT 0 #define IOPOL_ATIME_UPDATES_OFF 1 @@ -576,4 +580,6 @@ int setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPH int setrlimit(int, const struct rlimit *) __DARWIN_ALIAS(setrlimit); __END_DECLS + + #endif /* !_SYS_RESOURCE_H_ */ diff --git a/lib/libc/include/any-macos-any/sys/socket.h b/lib/libc/include/any-macos-any/sys/socket.h index 377e17cb6eca..56710ac6a320 100644 --- a/lib/libc/include/any-macos-any/sys/socket.h +++ b/lib/libc/include/any-macos-any/sys/socket.h @@ -78,8 +78,6 @@ #include #include - - #include /* @@ -189,6 +187,7 @@ #define SO_RESOLVER_SIGNATURE 0x1131 /* A signed data blob from the system resolver */ +#define SO_BINDTODEVICE 0x1134 /* bind socket to a network device (max valid option length IFNAMSIZ) */ /* When adding new socket-options, you need to make sure MPTCP supports these as well! */ @@ -346,7 +345,6 @@ struct so_np_extensions { #define SONPX_SETOPTSHUT 0x000000001 /* flag for allowing setsockopt after shutdown */ - #endif #endif @@ -416,11 +414,7 @@ struct so_np_extensions { struct sockaddr { __uint8_t sa_len; /* total length */ sa_family_t sa_family; /* [XSI] address family */ -#if __has_ptrcheck - char sa_data[__counted_by(sa_len - 2)]; -#else - char sa_data[14]; /* [XSI] addr value (actually smaller or larger) */ -#endif + char sa_data[14]; /* [XSI] addr value */ }; __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr, sockaddr); @@ -530,10 +524,7 @@ __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage); */ #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) #define NET_MAXID AF_MAX -#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ - -#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * PF_ROUTE - Routing table * @@ -557,9 +548,6 @@ __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage); #define NET_RT_MAXID 11 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ - - - /* * Maximum queue length specifiable by listen. */ @@ -570,17 +558,15 @@ __CCT_DECLARE_CONSTRAINED_PTR_TYPES(struct sockaddr_storage, sockaddr_storage); * Used value-result for recvmsg, value only for sendmsg. */ struct msghdr { - void *msg_name; /* [XSI] optional address */ + void *__sized_by(msg_namelen) msg_name; /* [XSI] optional address */ socklen_t msg_namelen; /* [XSI] size of address */ struct iovec *msg_iov; /* [XSI] scatter/gather array */ int msg_iovlen; /* [XSI] # elements in msg_iov */ - void *msg_control; /* [XSI] ancillary data, see below */ + void *__sized_by(msg_controllen) msg_control; /* [XSI] ancillary data, see below */ socklen_t msg_controllen; /* [XSI] ancillary data buffer len */ int msg_flags; /* [XSI] flags on received message */ }; - - #define MSG_OOB 0x1 /* process out-of-band data */ #define MSG_PEEK 0x2 /* peek at incoming message */ #define MSG_DONTROUTE 0x4 /* send without using routing tables */ @@ -694,7 +680,6 @@ struct cmsgcred { #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ #define SCM_TIMESTAMP_MONOTONIC 0x04 /* timestamp (uint64_t) */ - #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* @@ -718,7 +703,6 @@ struct sf_hdtr { #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - __BEGIN_DECLS int accept(int, struct sockaddr * __restrict, socklen_t * __restrict) @@ -762,4 +746,5 @@ int disconnectx(int, sae_associd_t, sae_connid_t); __END_DECLS + #endif /* !_SYS_SOCKET_H_ */ diff --git a/lib/libc/include/any-macos-any/sys/sockio.h b/lib/libc/include/any-macos-any/sys/sockio.h index 1a19bb707c31..5f32086f4a01 100644 --- a/lib/libc/include/any-macos-any/sys/sockio.h +++ b/lib/libc/include/any-macos-any/sys/sockio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Apple Inc. All rights reserved. + * Copyright (c) 2000-2023 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -66,6 +66,7 @@ #include +#include #include /* Socket ioctl's. */ @@ -77,9 +78,6 @@ #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 */ @@ -140,7 +138,6 @@ */ #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 */ @@ -165,7 +162,6 @@ #define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */ - #define SIOCGIFMAC _IOWR('i', 130, struct ifreq) /* deprecated */ #define SIOCSIFMAC _IOW('i', 131, struct ifreq) /* deprecated */ #define SIOCSIFKPI _IOW('i', 134, struct ifreq) /* set interface kext param - root only */ @@ -178,5 +174,7 @@ #define SIOCSIF6LOWPAN _IOW('i', 196, struct ifreq) /* set 6LOWPAN config */ #define SIOCGIF6LOWPAN _IOWR('i', 197, struct ifreq) /* get 6LOWPAN config */ +#define SIOCGIFDIRECTLINK _IOWR('i', 222, struct ifreq) /* get DIRECTLINK */ + #endif /* !_SYS_SOCKIO_H_ */ diff --git a/lib/libc/include/any-macos-any/sys/sysctl.h b/lib/libc/include/any-macos-any/sys/sysctl.h index 49d3ca77e163..1618902ef508 100644 --- a/lib/libc/include/any-macos-any/sys/sysctl.h +++ b/lib/libc/include/any-macos-any/sys/sysctl.h @@ -640,13 +640,15 @@ extern struct loadavg averunnable; * In general is is better to use mach's or higher level timing services, but this value * is needed to convert the PPC Time Base registers to real time. * - * hw.cpufrequency - These values provide the current, min and max cpu frequency. The min and max are for - * hw.cpufrequency_max - all power management modes. The current frequency is the max frequency in the current mode. - * hw.cpufrequency_min - All frequencies are in Hz. + * hw.cpufrequency, hw.busfrequency and their min/max versions are deprecated because frequency isn't consistent. * - * hw.busfrequency - These values provide the current, min and max bus frequency. The min and max are for - * hw.busfrequency_max - all power management modes. The current frequency is the max frequency in the current mode. - * hw.busfrequency_min - All frequencies are in Hz. + * hw.cpufrequency - (deprecated) These values provide the current, min and max cpu frequency. The min and max are for + * hw.cpufrequency_max - (deprecated) all power management modes. The current frequency is the max frequency in the current mode. + * hw.cpufrequency_min - (deprecated) All frequencies are in Hz. + * + * hw.busfrequency - (deprecated) These values provide the current, min and max bus frequency. The min and max are for + * hw.busfrequency_max - (deprecated) all power management modes. The current frequency is the max frequency in the current mode. + * hw.busfrequency_min - (deprecated) All frequencies are in Hz. * * hw.cputype - These values provide the mach-o cpu type and subtype. A complete list is in * hw.cpusubtype - These values should be used to determine what processor family the running cpu is from so that @@ -790,9 +792,11 @@ extern struct loadavg averunnable; __BEGIN_DECLS -int sysctl(int *, u_int, void *, size_t *, void *, size_t); -int sysctlbyname(const char *, void *, size_t *, void *, size_t); -int sysctlnametomib(const char *, int *, size_t *); +int sysctl(int *, u_int, void *__sized_by(*oldlenp), size_t *oldlenp, + void *__sized_by(newlen), size_t newlen); +int sysctlbyname(const char *, void *__sized_by(*oldlenp), size_t *oldlenp, + void *__sized_by(newlen), size_t newlen); +int sysctlnametomib(const char *, int *__counted_by(*sizep), size_t *sizep); __END_DECLS diff --git a/lib/libc/include/any-macos-any/sys/syslimits.h b/lib/libc/include/any-macos-any/sys/syslimits.h index 1c2aa9a18c3e..31e6e578cba9 100644 --- a/lib/libc/include/any-macos-any/sys/syslimits.h +++ b/lib/libc/include/any-macos-any/sys/syslimits.h @@ -88,6 +88,10 @@ #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 */ +/* + * NOTE: Many filesystems (including HFS & APFS) may support names longer than `NAME_MAX` bytes. + * See manpage for `getdirentries` and `readdir` for details. + */ #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) diff --git a/lib/libc/include/any-macos-any/sys/un.h b/lib/libc/include/any-macos-any/sys/un.h index 6d91a9ad8805..82e7c7446161 100644 --- a/lib/libc/include/any-macos-any/sys/un.h +++ b/lib/libc/include/any-macos-any/sys/un.h @@ -102,5 +102,4 @@ struct sockaddr_un { (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ - #endif /* !_SYS_UN_H_ */ diff --git a/lib/libc/include/any-macos-any/tgmath.h b/lib/libc/include/any-macos-any/tgmath.h index f47381394868..4cdf86e55b67 100644 --- a/lib/libc/include/any-macos-any/tgmath.h +++ b/lib/libc/include/any-macos-any/tgmath.h @@ -49,6 +49,7 @@ static double _TG_ATTRSp __tg_promote(long); static double _TG_ATTRSp __tg_promote(unsigned long); static double _TG_ATTRSp __tg_promote(long long); static double _TG_ATTRSp __tg_promote(unsigned long long); +static _Float16 _TG_ATTRSp __tg_promote(_Float16); static float _TG_ATTRSp __tg_promote(float); static double _TG_ATTRSp __tg_promote(double); static long double _TG_ATTRSp __tg_promote(long double); @@ -502,6 +503,10 @@ static long double _Complex // sqrt +static _Float16 + _TG_ATTRS + __tg_sqrt(_Float16 __x) {return __sqrtf16(__x);} + static float _TG_ATTRS __tg_sqrt(float __x) {return sqrtf(__x);} @@ -531,6 +536,10 @@ static long double _Complex // fabs +static _Float16 + _TG_ATTRS + __tg_fabs(_Float16 __x) {return __fabsf16(__x);} + static float _TG_ATTRS __tg_fabs(float __x) {return fabsf(__x);} @@ -595,6 +604,10 @@ static long double // ceil +static _Float16 + _TG_ATTRS + __tg_ceil(_Float16 __x) {return __ceilf16(__x);} + static float _TG_ATTRS __tg_ceil(float __x) {return ceilf(__x);} @@ -612,6 +625,10 @@ static long double // copysign +static _Float16 + _TG_ATTRS + __tg_copysign(_Float16 __x, _Float16 __y) {return __copysignf16(__x, __y);} + static float _TG_ATTRS __tg_copysign(float __x, float __y) {return copysignf(__x, __y);} @@ -716,6 +733,10 @@ static long double // floor +static _Float16 + _TG_ATTRS + __tg_floor(_Float16 __x) {return __floorf16(__x);} + static float _TG_ATTRS __tg_floor(float __x) {return floorf(__x);} @@ -733,6 +754,11 @@ static long double // fma +static _Float16 + _TG_ATTRS + __tg_fma(_Float16 __x, _Float16 __y, _Float16 __z) + {return __fmaf16(__x, __y, __z);} + static float _TG_ATTRS __tg_fma(float __x, float __y, float __z) @@ -756,6 +782,10 @@ static long double // fmax +static _Float16 + _TG_ATTRS + __tg_fmax(_Float16 __x, _Float16 __y) {return __fmaxf16(__x, __y);} + static float _TG_ATTRS __tg_fmax(float __x, float __y) {return fmaxf(__x, __y);} @@ -774,6 +804,10 @@ static long double // fmin +static _Float16 + _TG_ATTRS + __tg_fmin(_Float16 __x, _Float16 __y) {return __fminf16(__x, __y);} + static float _TG_ATTRS __tg_fmin(float __x, float __y) {return fminf(__x, __y);} @@ -827,6 +861,10 @@ static long double // hypot +static _Float16 + _TG_ATTRS + __tg_hypot(_Float16 __x, _Float16 __y) {return __hypotf16(__x, __y);} + static float _TG_ATTRS __tg_hypot(float __x, float __y) {return hypotf(__x, __y);} @@ -894,6 +932,10 @@ static long double #undef lgamma #define lgamma(__x) __tg_lgamma(__tg_promote1((__x))(__x)) +/* 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) + // llrint static long long @@ -928,6 +970,8 @@ static long long #undef llround #define llround(__x) __tg_llround(__tg_promote1((__x))(__x)) +#endif /* !(__DARWIN_NO_LONG_LONG) */ + // log10 static float @@ -1049,6 +1093,10 @@ static long double // nextafter +static _Float16 + _TG_ATTRS + __tg_nextafter(_Float16 __x, _Float16 __y) {return __nextafterf16(__x, __y);} + static float _TG_ATTRS __tg_nextafter(float __x, float __y) {return nextafterf(__x, __y);} @@ -1125,6 +1173,10 @@ static long double // rint +static _Float16 + _TG_ATTRS + __tg_rint(_Float16 __x) {return __rintf16(__x);} + static float _TG_ATTRS __tg_rint(float __x) {return rintf(__x);} @@ -1142,6 +1194,10 @@ static long double // round +static _Float16 + _TG_ATTRS + __tg_round(_Float16 __x) {return __roundf16(__x);} + static float _TG_ATTRS __tg_round(float __x) {return roundf(__x);} @@ -1210,6 +1266,10 @@ static long double // trunc +static _Float16 + _TG_ATTRS + __tg_trunc(_Float16 __x) {return __truncf16(__x);} + static float _TG_ATTRS __tg_trunc(float __x) {return truncf(__x);} diff --git a/lib/libc/include/any-macos-any/time.h b/lib/libc/include/any-macos-any/time.h index 990d1e9369df..021eaf854ae3 100644 --- a/lib/libc/include/any-macos-any/time.h +++ b/lib/libc/include/any-macos-any/time.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000, 2023 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -60,149 +60,8 @@ * @(#)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 ((clock_t)1000000) /* [XSI] */ -#else /* !__DARWIN_UNIX03 */ -#include /* Include file containing CLK_TCK. */ - -#define CLOCKS_PER_SEC ((clock_t)(__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 +#include <_time.h> #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* !_TIME_H_ */ diff --git a/lib/libc/include/any-macos-any/unistd.h b/lib/libc/include/any-macos-any/unistd.h index a468bc30a05d..58cf62af6221 100644 --- a/lib/libc/include/any-macos-any/unistd.h +++ b/lib/libc/include/any-macos-any/unistd.h @@ -653,15 +653,7 @@ char *fflagstostr(unsigned long); int getdomainname(char *, int); int getgrouplist(const char *, int, int *, int *); __END_DECLS -#if defined(__has_include) -#if __has_include() -#include -#else #include -#endif -#else -#include -#endif __BEGIN_DECLS mode_t getmode(const void *, mode_t); int getpeereid(int, uid_t *, gid_t *); diff --git a/lib/libc/include/any-macos-any/vis.h b/lib/libc/include/any-macos-any/vis.h index b8ff23c42630..f56ed668e018 100644 --- a/lib/libc/include/any-macos-any/vis.h +++ b/lib/libc/include/any-macos-any/vis.h @@ -57,6 +57,7 @@ #ifndef _VIS_H_ #define _VIS_H_ +#include #include <_types.h> #include @@ -109,31 +110,40 @@ #include __BEGIN_DECLS + +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of vis(3), it is highly recommended you use nvis(3) instead.", macos(10.0,14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) char *vis(char *, int, int, int); char *nvis(char *, size_t, int, int, int); +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of svis(3), it is highly recommended you use snvis(3) instead.", macos(10.0, 14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) char *svis(char *, int, int, int, const char *); char *snvis(char *, size_t, int, int, int, const char *); +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of strvis(3), it is highly recommended you use strnvis(3) instead.", macos(10.0, 14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) int strvis(char *, const char *, int); int stravis(char **, const char *, int); int strnvis(char *, size_t, const char *, int); +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of strsvis(3), it is highly recommended you use strsnvis(3) instead.", macos(10.0, 14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) int strsvis(char *, const char *, int, const char *); int strsnvis(char *, size_t, const char *, int, const char *); +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of strvisx(3), it is highly recommended you use strnvisx(3) instead.", macos(10.0, 14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) int strvisx(char *, const char *, size_t, int); int strnvisx(char *, size_t, const char *, size_t, int); int strenvisx(char *, size_t, const char *, size_t, int, int *); +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of strsvisx(3), it is highly recommended you use strsnvisx(3) instead.", macos(10.0, 14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) int strsvisx(char *, const char *, size_t, int, const char *); int strsnvisx(char *, size_t, const char *, size_t, int, const char *); int strsenvisx(char *, size_t, const char *, size_t , int, const char *, int *); +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of strunvis(3), it is highly recommended you use strnunvis(3) instead.", macos(10.0, 14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) int strunvis(char *, const char *); int strnunvis(char *, size_t, const char *); +__API_DEPRECATED("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of strunvisx(3), it is highly recommended you use strnunvisx(3) instead.", macos(10.0, 14.4), ios(2.0,17.4), watchos(1.0,10.4), tvos(9.0,17.4)) int strunvisx(char *, const char *, int); int strnunvisx(char *, size_t, const char *, int); diff --git a/lib/libc/include/any-macos-any/wchar.h b/lib/libc/include/any-macos-any/wchar.h index 38f84f8bb50e..a470955543e1 100644 --- a/lib/libc/include/any-macos-any/wchar.h +++ b/lib/libc/include/any-macos-any/wchar.h @@ -64,168 +64,8 @@ * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $ */ -#ifndef _WCHAR_H_ -#define _WCHAR_H_ - -#include <_types.h> -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifndef WCHAR_MIN -#define WCHAR_MIN __DARWIN_WCHAR_MIN -#endif - -#ifndef WCHAR_MAX -#define WCHAR_MAX __DARWIN_WCHAR_MAX -#endif - -#include -#include -#include -#include <_wctype.h> - - -/* Initially added in Issue 4 */ -__BEGIN_DECLS -wint_t btowc(int); -wint_t fgetwc(FILE *); -wchar_t *fgetws(wchar_t * __restrict, int, FILE * __restrict); -wint_t fputwc(wchar_t, FILE *); -int fputws(const wchar_t * __restrict, FILE * __restrict); -int fwide(FILE *, int); -int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...); -int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...); -wint_t getwc(FILE *); -wint_t getwchar(void); -size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); -size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, - mbstate_t * __restrict); -int mbsinit(const mbstate_t *); -size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, - mbstate_t * __restrict); -wint_t putwc(wchar_t, FILE *); -wint_t putwchar(wchar_t); -int swprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict, ...); -int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); -wint_t ungetwc(wint_t, FILE *); -int vfwprintf(FILE * __restrict, const wchar_t * __restrict, - __darwin_va_list); -int vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict, - __darwin_va_list); -int vwprintf(const wchar_t * __restrict, __darwin_va_list); -size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); -wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict); -wchar_t *wcschr(const wchar_t *, wchar_t); -int wcscmp(const wchar_t *, const wchar_t *); -int wcscoll(const wchar_t *, const wchar_t *); -wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); -size_t wcscspn(const wchar_t *, const wchar_t *); -size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, - const struct tm * __restrict) __DARWIN_ALIAS(wcsftime); -size_t wcslen(const wchar_t *); -wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t); -int wcsncmp(const wchar_t *, const wchar_t *, size_t); -wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t); -wchar_t *wcspbrk(const wchar_t *, const wchar_t *); -wchar_t *wcsrchr(const wchar_t *, wchar_t); -size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t, - mbstate_t * __restrict); -size_t wcsspn(const wchar_t *, const wchar_t *); -wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict); -size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t); -int wctob(wint_t); -double wcstod(const wchar_t * __restrict, wchar_t ** __restrict); -wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict, - wchar_t ** __restrict); -long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int); -unsigned long - wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int); -wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); -int wmemcmp(const wchar_t *, const wchar_t *, size_t); -wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); -wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); -wchar_t *wmemset(wchar_t *, wchar_t, size_t); -int wprintf(const wchar_t * __restrict, ...); -int wscanf(const wchar_t * __restrict, ...); -int wcswidth(const wchar_t *, size_t); -int wcwidth(wchar_t); -__END_DECLS - - - -/* Additional functionality provided by: - * POSIX.1-2001 - * ISO C99 - */ - -#if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) -__BEGIN_DECLS -int vfwscanf(FILE * __restrict, const wchar_t * __restrict, - __darwin_va_list); -int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, - __darwin_va_list); -int vwscanf(const wchar_t * __restrict, __darwin_va_list); -float wcstof(const wchar_t * __restrict, wchar_t ** __restrict); -long double - wcstold(const wchar_t * __restrict, wchar_t ** __restrict); -#if !__DARWIN_NO_LONG_LONG -long long - wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int); -unsigned long long - wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int); -#endif /* !__DARWIN_NO_LONG_LONG */ -__END_DECLS -#endif - - - -/* Additional functionality provided by: - * POSIX.1-2008 - */ - -#if __DARWIN_C_LEVEL >= 200809L -__BEGIN_DECLS -size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, - size_t, mbstate_t * __restrict); -wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -wchar_t *wcsdup(const wchar_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -int wcscasecmp(const wchar_t *, const wchar_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -size_t wcsnlen(const wchar_t *, size_t) __pure __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, - size_t, mbstate_t * __restrict); -FILE *open_wmemstream(wchar_t ** __bufp, size_t * __sizep) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); -__END_DECLS -#endif /* __DARWIN_C_LEVEL >= 200809L */ - - - -/* Darwin extensions */ - -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -__BEGIN_DECLS -wchar_t *fgetwln(FILE * __restrict, size_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); -size_t wcslcat(wchar_t *, const wchar_t *, size_t); -size_t wcslcpy(wchar_t *, const wchar_t *, size_t); -__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 fgetws fputwc fputws fwprintf fwscanf mbrtowc mbsnrtowcs mbsrtowcs putwc putwchar swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf vwprintf vwscanf wcrtomb wcscat wcschr wcscmp wcscoll wcscpy wcscspn wcsftime wcsftime wcslcat wcslcpy wcslen wcsncat wcsncmp wcsncpy wcsnrtombs wcspbrk wcsrchr wcsrtombs wcsspn wcsstr wcstod wcstof wcstok wcstol wcstold wcstoll wcstoul wcstoull wcswidth wcsxfrm wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset wprintf wscanf -#endif +#include <_wchar.h> #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* !_WCHAR_H_ */ diff --git a/lib/libc/include/any-macos-any/wctype.h b/lib/libc/include/any-macos-any/wctype.h index c270cc60d6fb..4e87dd901ca9 100644 --- a/lib/libc/include/any-macos-any/wctype.h +++ b/lib/libc/include/any-macos-any/wctype.h @@ -28,103 +28,8 @@ * $FreeBSD: /repoman/r/ncvs/src/include/wctype.h,v 1.10 2002/08/21 16:19:55 mike Exp $ */ -#ifndef _WCTYPE_H_ -#define _WCTYPE_H_ - -#include -#include <_types.h> -#include <_types/_wctrans_t.h> - -#define __DARWIN_WCTYPE_TOP_inline __header_inline - #include <_wctype.h> -#include - -/* - * Use inline functions if we are allowed to and the compiler supports them. - */ -#if !defined(_DONT_USE_CTYPE_INLINE_) && \ - (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) - -__DARWIN_WCTYPE_TOP_inline int -iswblank(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_B)); -} - -#if !defined(_ANSI_SOURCE) -__DARWIN_WCTYPE_TOP_inline int -iswascii(wint_t _wc) -{ - return ((_wc & ~0x7F) == 0); -} - -__DARWIN_WCTYPE_TOP_inline int -iswhexnumber(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_X)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswideogram(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_I)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswnumber(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_D)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswphonogram(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_Q)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswrune(wint_t _wc) -{ - return (__istype(_wc, 0xFFFFFFF0L)); -} - -__DARWIN_WCTYPE_TOP_inline int -iswspecial(wint_t _wc) -{ - return (__istype(_wc, _CTYPE_T)); -} -#endif /* !_ANSI_SOURCE */ - -#else /* not using inlines */ - -__BEGIN_DECLS -int iswblank(wint_t); - -#if !defined(_ANSI_SOURCE) -wint_t iswascii(wint_t); -wint_t iswhexnumber(wint_t); -wint_t iswideogram(wint_t); -wint_t iswnumber(wint_t); -wint_t iswphonogram(wint_t); -wint_t iswrune(wint_t); -wint_t iswspecial(wint_t); -#endif -__END_DECLS - -#endif /* using inlines */ - -__BEGIN_DECLS -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -wint_t nextwctype(wint_t, wctype_t); -#endif -wint_t towctrans(wint_t, wctrans_t); -wctrans_t - wctrans(const char *); -__END_DECLS #ifdef _USE_EXTENDED_LOCALES_ #include #endif /* _USE_EXTENDED_LOCALES_ */ - -#endif /* _WCTYPE_H_ */ diff --git a/lib/libc/include/any-macos-any/xlocale.h b/lib/libc/include/any-macos-any/xlocale.h index f5824b3b1a65..83ee54de3830 100644 --- a/lib/libc/include/any-macos-any/xlocale.h +++ b/lib/libc/include/any-macos-any/xlocale.h @@ -21,62 +21,14 @@ * @APPLE_LICENSE_HEADER_END@ */ -#ifndef _XLOCALE_H_ -#define _XLOCALE_H_ - -#include - -#ifndef _USE_EXTENDED_LOCALES_ -#define _USE_EXTENDED_LOCALES_ -#endif /* _USE_EXTENDED_LOCALES_ */ - -#include <_locale.h> #include <_xlocale.h> -#define LC_ALL_MASK ( LC_COLLATE_MASK \ - | LC_CTYPE_MASK \ - | LC_MESSAGES_MASK \ - | LC_MONETARY_MASK \ - | LC_NUMERIC_MASK \ - | LC_TIME_MASK ) -#define LC_COLLATE_MASK (1 << 0) -#define LC_CTYPE_MASK (1 << 1) -#define LC_MESSAGES_MASK (1 << 2) -#define LC_MONETARY_MASK (1 << 3) -#define LC_NUMERIC_MASK (1 << 4) -#define LC_TIME_MASK (1 << 5) - -#define _LC_NUM_MASK 6 -#define _LC_LAST_MASK (1 << (_LC_NUM_MASK - 1)) - -#define LC_GLOBAL_LOCALE ((locale_t)-1) -#define LC_C_LOCALE ((locale_t)NULL) - -#ifdef MB_CUR_MAX -#undef MB_CUR_MAX -#define MB_CUR_MAX (___mb_cur_max()) -#ifndef MB_CUR_MAX_L -#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) -#endif /* !MB_CUR_MAX_L */ -#endif /* MB_CUR_MAX */ - -__BEGIN_DECLS -extern const locale_t _c_locale; - -locale_t duplocale(locale_t); -int freelocale(locale_t); -struct lconv * localeconv_l(locale_t); -locale_t newlocale(int, __const char *, locale_t); -__const char * querylocale(int, locale_t); -locale_t uselocale(locale_t); -__END_DECLS - #ifdef _CTYPE_H_ #include #endif /* _CTYPE_H_ */ -#ifdef __WCTYPE_H_ -#include -#endif /* __WCTYPE_H_ */ +#ifdef ___WCTYPE_H_ +#include +#endif /* ___WCTYPE_H_ */ #ifdef _INTTYPES_H_ #include #endif /* _INTTYPES_H_ */ @@ -107,5 +59,3 @@ __END_DECLS #ifdef _WCTYPE_H_ #include #endif /* _WCTYPE_H_ */ - -#endif /* _XLOCALE_H_ */ diff --git a/lib/libc/include/any-macos-any/xlocale/__wctype.h b/lib/libc/include/any-macos-any/xlocale/___wctype.h similarity index 96% rename from lib/libc/include/any-macos-any/xlocale/__wctype.h rename to lib/libc/include/any-macos-any/xlocale/___wctype.h index 224638273909..52c488a5e565 100644 --- a/lib/libc/include/any-macos-any/xlocale/__wctype.h +++ b/lib/libc/include/any-macos-any/xlocale/___wctype.h @@ -21,10 +21,10 @@ * @APPLE_LICENSE_HEADER_END@ */ -#ifndef _XLOCALE___WCTYPE_H_ -#define _XLOCALE___WCTYPE_H_ +#ifndef _XLOCALE____WCTYPE_H_ +#define _XLOCALE____WCTYPE_H_ -#include <__wctype.h> +#include <___wctype.h> #include #if !defined(_DONT_USE_CTYPE_INLINE_) && \ @@ -140,4 +140,4 @@ wctype_t wctype_l(const char *, locale_t); __END_DECLS -#endif /* _XLOCALE___WCTYPE_H_ */ +#endif /* _XLOCALE____WCTYPE_H_ */ diff --git a/lib/libc/include/any-macos-any/xlocale/_ctype.h b/lib/libc/include/any-macos-any/xlocale/_ctype.h index 99fe94ddd8e0..5fb364c217b8 100644 --- a/lib/libc/include/any-macos-any/xlocale/_ctype.h +++ b/lib/libc/include/any-macos-any/xlocale/_ctype.h @@ -25,7 +25,7 @@ #define _XLOCALE__CTYPE_H_ #include <_ctype.h> -#include <_xlocale.h> +#include <__xlocale.h> /* * Use inline functions if we are allowed to and the compiler supports them. diff --git a/lib/libc/include/any-macos-any/xlocale/_inttypes.h b/lib/libc/include/any-macos-any/xlocale/_inttypes.h index 8a7f563e378d..8b417d0de24e 100644 --- a/lib/libc/include/any-macos-any/xlocale/_inttypes.h +++ b/lib/libc/include/any-macos-any/xlocale/_inttypes.h @@ -27,7 +27,7 @@ #include #include #include /* wchar_t */ -#include <_xlocale.h> +#include <__xlocale.h> __BEGIN_DECLS intmax_t strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, diff --git a/lib/libc/include/any-macos-any/xlocale/_langinfo.h b/lib/libc/include/any-macos-any/xlocale/_langinfo.h index 0190cf6b6c49..d2e8c2698997 100644 --- a/lib/libc/include/any-macos-any/xlocale/_langinfo.h +++ b/lib/libc/include/any-macos-any/xlocale/_langinfo.h @@ -26,7 +26,7 @@ #include #include <_types/_nl_item.h> -#include <_xlocale.h> +#include <__xlocale.h> __BEGIN_DECLS char *nl_langinfo_l(nl_item, locale_t); diff --git a/lib/libc/include/any-macos-any/xlocale/_monetary.h b/lib/libc/include/any-macos-any/xlocale/_monetary.h index cf1046868c69..1eae3f86b82f 100644 --- a/lib/libc/include/any-macos-any/xlocale/_monetary.h +++ b/lib/libc/include/any-macos-any/xlocale/_monetary.h @@ -28,7 +28,7 @@ #include <_types.h> #include #include -#include <_xlocale.h> +#include <__xlocale.h> __BEGIN_DECLS ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...) diff --git a/lib/libc/include/any-macos-any/xlocale/_regex.h b/lib/libc/include/any-macos-any/xlocale/_regex.h index 8f4fcf374dfc..4a8d89b58e39 100644 --- a/lib/libc/include/any-macos-any/xlocale/_regex.h +++ b/lib/libc/include/any-macos-any/xlocale/_regex.h @@ -26,8 +26,8 @@ #ifndef _REGEX_H_ #include <_regex.h> -#endif // _REGEX_H_ -#include <_xlocale.h> +#include <__xlocale.h> +#endif __BEGIN_DECLS diff --git a/lib/libc/include/any-macos-any/xlocale/_stdio.h b/lib/libc/include/any-macos-any/xlocale/_stdio.h index f9272ff76c38..49bdbcaacf83 100644 --- a/lib/libc/include/any-macos-any/xlocale/_stdio.h +++ b/lib/libc/include/any-macos-any/xlocale/_stdio.h @@ -25,7 +25,7 @@ #define _XLOCALE__STDIO_H_ #include <_stdio.h> -#include <_xlocale.h> +#include <__xlocale.h> __BEGIN_DECLS diff --git a/lib/libc/include/any-macos-any/xlocale/_stdlib.h b/lib/libc/include/any-macos-any/xlocale/_stdlib.h index add77d696f14..d664e24429f4 100644 --- a/lib/libc/include/any-macos-any/xlocale/_stdlib.h +++ b/lib/libc/include/any-macos-any/xlocale/_stdlib.h @@ -27,7 +27,7 @@ #include #include #include -#include <_xlocale.h> +#include <__xlocale.h> __BEGIN_DECLS double atof_l(const char *, locale_t); diff --git a/lib/libc/include/any-macos-any/xlocale/_string.h b/lib/libc/include/any-macos-any/xlocale/_string.h index 8aa73fac4512..0c9bddf5bd04 100644 --- a/lib/libc/include/any-macos-any/xlocale/_string.h +++ b/lib/libc/include/any-macos-any/xlocale/_string.h @@ -26,7 +26,7 @@ #include #include -#include <_xlocale.h> +#include <__xlocale.h> __BEGIN_DECLS int strcoll_l(const char *, const char *, locale_t); diff --git a/lib/libc/include/any-macos-any/xlocale/_time.h b/lib/libc/include/any-macos-any/xlocale/_time.h index c2c0965446d3..ee94572265e2 100644 --- a/lib/libc/include/any-macos-any/xlocale/_time.h +++ b/lib/libc/include/any-macos-any/xlocale/_time.h @@ -27,7 +27,7 @@ #include #include #include <_types.h> -#include <_xlocale.h> +#include <__xlocale.h> __BEGIN_DECLS size_t strftime_l(char * __restrict, size_t, const char * __restrict, diff --git a/lib/libc/include/any-macos-any/xlocale/_wchar.h b/lib/libc/include/any-macos-any/xlocale/_wchar.h index b8eb41e0966b..f3ed34c7cff0 100644 --- a/lib/libc/include/any-macos-any/xlocale/_wchar.h +++ b/lib/libc/include/any-macos-any/xlocale/_wchar.h @@ -25,7 +25,7 @@ #define _XLOCALE__WCHAR_H_ #include <_stdio.h> -#include <_xlocale.h> +#include <__xlocale.h> #include #include #include /* wchar_t */ diff --git a/lib/libc/include/any-macos-any/xlocale/_wctype.h b/lib/libc/include/any-macos-any/xlocale/_wctype.h index 2b0c6846f704..2a900cfd149b 100644 --- a/lib/libc/include/any-macos-any/xlocale/_wctype.h +++ b/lib/libc/include/any-macos-any/xlocale/_wctype.h @@ -24,7 +24,7 @@ #ifndef _XLOCALE__WCTYPE_H_ #define _XLOCALE__WCTYPE_H_ -#include <__wctype.h> +#include <___wctype.h> #include <_types/_wctrans_t.h> #include diff --git a/lib/libc/include/any-macos-any/xpc/activity.h b/lib/libc/include/any-macos-any/xpc/activity.h index dc98cce2e8bd..b1684861eb2f 100644 --- a/lib/libc/include/any-macos-any/xpc/activity.h +++ b/lib/libc/include/any-macos-any/xpc/activity.h @@ -33,7 +33,8 @@ __BEGIN_DECLS * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_INTERVAL; @@ -41,7 +42,8 @@ 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_REPEATING; @@ -50,7 +52,8 @@ const char * const XPC_ACTIVITY_REPEATING; * An integer property indicating the number of seconds to delay before * beginning the activity. */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_DELAY; @@ -59,44 +62,54 @@ const char * const XPC_ACTIVITY_DELAY; * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_GRACE_PERIOD; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_1_MIN; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_5_MIN; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_15_MIN; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_30_MIN; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_1_HOUR; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_4_HOURS; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_8_HOURS; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_1_DAY; -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const int64_t XPC_ACTIVITY_INTERVAL_7_DAYS; @@ -104,7 +117,8 @@ 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_PRIORITY; @@ -121,7 +135,8 @@ const char * const XPC_ACTIVITY_PRIORITY; * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_PRIORITY_MAINTENANCE; @@ -138,7 +153,8 @@ const char * const XPC_ACTIVITY_PRIORITY_MAINTENANCE; * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_PRIORITY_UTILITY; @@ -148,7 +164,8 @@ const char * const XPC_ACTIVITY_PRIORITY_UTILITY; * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_ALLOW_BATTERY; @@ -160,7 +177,8 @@ const char * const XPC_ACTIVITY_ALLOW_BATTERY; * idle despite the fact that the display itself is still powered. Defaults to * false. */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const char * const XPC_ACTIVITY_REQUIRE_SCREEN_SLEEP; // bool @@ -174,7 +192,8 @@ const char * const XPC_ACTIVITY_REQUIRE_SCREEN_SLEEP; // bool * interrupted by system sleep should set this. * Setting this property can impact battery life. */ -__API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0)) +API_AVAILABLE(macos(12.0)) +API_UNAVAILABLE(ios, watchos) XPC_EXPORT const char * const XPC_ACTIVITY_PREVENT_DEVICE_SLEEP; // bool @@ -205,7 +224,8 @@ const char * const XPC_ACTIVITY_REQUIRE_HDD_SPINNING; // bool * A type representing the XPC activity object. */ #define XPC_TYPE_ACTIVITY (&_xpc_type_activity) -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_TYPE(_xpc_type_activity); @@ -241,7 +261,8 @@ typedef void (^xpc_activity_handler_t)(xpc_activity_t activity); * activity using the same identifier (for example, an activity taken from a * launchd property list). */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT const xpc_object_t XPC_ACTIVITY_CHECK_IN; @@ -280,7 +301,8 @@ const xpc_object_t XPC_ACTIVITY_CHECK_IN; * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 XPC_NONNULL3 void xpc_activity_register(const char *identifier, xpc_object_t criteria, @@ -294,7 +316,8 @@ xpc_activity_register(const char *identifier, xpc_object_t criteria, * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_WARN_RESULT XPC_RETURNS_RETAINED XPC_NONNULL1 xpc_object_t _Nullable xpc_activity_copy_criteria(xpc_activity_t activity); @@ -305,7 +328,8 @@ xpc_activity_copy_criteria(xpc_activity_t activity); * @abstract * Modifies the execution criteria of an activity. */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 void xpc_activity_set_criteria(xpc_activity_t activity, xpc_object_t criteria); @@ -386,7 +410,8 @@ typedef long xpc_activity_state_t; * @abstract * Returns the current state of an activity. */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 xpc_activity_state_t xpc_activity_get_state(xpc_activity_t activity); @@ -401,7 +426,8 @@ xpc_activity_get_state(xpc_activity_t activity); * 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) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 bool xpc_activity_set_state(xpc_activity_t activity, xpc_activity_state_t state); @@ -424,7 +450,8 @@ xpc_activity_set_state(xpc_activity_t activity, xpc_activity_state_t state); * @return * Returns true if the activity should be deferred. */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 bool xpc_activity_should_defer(xpc_activity_t activity); @@ -447,7 +474,8 @@ xpc_activity_should_defer(xpc_activity_t activity); * @param identifier * The identifier of the activity to unregister. */ -__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) +API_AVAILABLE(macos(10.9)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_NONNULL1 void xpc_activity_unregister(const char *identifier); diff --git a/lib/libc/include/any-macos-any/xpc/connection.h b/lib/libc/include/any-macos-any/xpc/connection.h index c7d3abab9a04..36f20bae9cc7 100644 --- a/lib/libc/include/any-macos-any/xpc/connection.h +++ b/lib/libc/include/any-macos-any/xpc/connection.h @@ -89,7 +89,7 @@ const struct _xpc_dictionary_s _xpc_error_termination_imminent; */ #define XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT \ XPC_GLOBAL_OBJECT(_xpc_error_peer_code_signing_requirement) -__API_AVAILABLE(macos(12.0)) +__API_AVAILABLE(macos(12.0), macCatalyst(15.0)) XPC_EXPORT const struct _xpc_dictionary_s _xpc_error_peer_code_signing_requirement; @@ -198,7 +198,8 @@ xpc_connection_create(const char * _Nullable name, * because the Mach namespace is not queried for the service name until the * connection has been activated. See {@link xpc_connection_activate()}. */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +API_AVAILABLE(macos(10.7), macCatalyst(5.0)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT XPC_NONNULL1 xpc_connection_t xpc_connection_create_mach_service(const char *name, @@ -668,7 +669,8 @@ xpc_connection_get_egid(xpc_connection_t connection); * away, but there are no guarantees as to the timing of this notification's * delivery either at the kernel layer or at the XPC layer. */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +API_AVAILABLE(macos(10.7)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT pid_t xpc_connection_get_pid(xpc_connection_t connection); @@ -683,7 +685,8 @@ xpc_connection_get_pid(xpc_connection_t connection); * @result * The audit session ID of the remote peer at the time the connection was made. */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +API_AVAILABLE(macos(10.7)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT au_asid_t xpc_connection_get_asid(xpc_connection_t connection); @@ -778,17 +781,222 @@ xpc_connection_set_finalizer_f(xpc_connection_t 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. + * `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/documentation/technotes/tn3127-inside-code-signing-requirements */ -__API_AVAILABLE(macos(12.0)) +__API_AVAILABLE(macos(12.0), macCatalyst(15.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT int xpc_connection_set_peer_code_signing_requirement(xpc_connection_t connection, const char *requirement); +/*! + * @function xpc_connection_set_peer_entitlement_exists_requirement + * Requires that the connection peer has the specified entitlement + * + * @param connection + * The connection object which is to be modified + * + * @param entitlement + * The entitlement the peer must have + * It is safe to deallocate the entitlement string after calling `xpc_connection_set_peer_entitlement_exists_requirement` + * + * @result + * 0 on success, non-zero on error + * + * @discussion + * This function will return an error promptly if the entitlement requirement is invalid. + * + * It is a programming error to call multiple of the `xpc_connection_set_peer_*_requirement` family of functions on the same + * connection. If more complex combinations of requirements are required, use + * `xpc_connection_set_peer_lightweight_code_requirement`. + * + * All messages received on this connection will be checked to ensure that they come from a peer who satisfies the + * 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. + */ +API_AVAILABLE(macos(14.4), ios(17.4)) +API_UNAVAILABLE(tvos, watchos) +XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT +int +xpc_connection_set_peer_entitlement_exists_requirement(xpc_connection_t connection, const char *entitlement); + +/*! + * @function xpc_connection_set_peer_entitlement_matches_value_requirement + * Requires that the connection peer has the specified entitlement with the matching value + * + * @param connection + * The connection object which is to be modified + * + * @param entitlement + * The entitlement the peer must have + * It is safe to deallocate the entitlement string after calling `xpc_connection_set_peer_entitlement_matches_value_requirement` + * + * @param value + * The value that the entitlement must match + * It is safe to deallocate the value object after calling + * `xpc_connection_set_peer_entitlement_matches_value_requirement`. + * Valid xpc types for this object are `XPC_TYPE_BOOL`, `XPC_TYPE_STRING` and `XPC_TYPE_INT64`. + * + * @result + * 0 on success, non-zero on error + * + * @discussion + * This function will return an error promptly if the entitlement requirement is invalid. + * + * It is a programming error to call multiple of the `xpc_connection_set_peer_*_requirement` family of functions on the same + * connection. If more complex combinations of requirements are required, use + * `xpc_connection_set_peer_lightweight_code_requirement`. + * + * All messages received on this connection will be checked to ensure that they come from a peer who satisfies the + * 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. + */ +API_AVAILABLE(macos(14.4), ios(17.4)) +API_UNAVAILABLE(tvos, watchos) +XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT +int +xpc_connection_set_peer_entitlement_matches_value_requirement(xpc_connection_t connection, const char *entitlement, xpc_object_t value); + +/*! + * @function xpc_connection_set_peer_team_identity_requirement + * Requires that the connection peer has the specified identity and is signed with the same team identifier + * as the current process + * + * @param connection + * The connection object which is to be modified + * + * @param signing_identifier + * The optional signing identifier the peer must have + * It is safe to deallocate the signing identifier string after calling `xpc_connection_set_peer_identity_requirement` + * + * @result + * 0 on success, non-zero on error + * + * @discussion + * This function will return an error promptly if the identity requirement is invalid. + * + * The peer process must be signed as either a Testflight app or an App store app, + * or be signed by an apple issued development certificate, an enterprise distributed + * certificate (embedded only), or a Developer ID certificate (macOS only) + * + * It is a programming error to call multiple of the `xpc_connection_set_peer_*_requirement` family of functions on the same + * connection. If more complex combinations of requirements are required, use + * `xpc_connection_set_peer_lightweight_code_requirement`. + * + * All messages received on this connection will be checked to ensure that they come from a peer who satisfies the + * 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. + */ +API_AVAILABLE(macos(14.4), ios(17.4)) +API_UNAVAILABLE(tvos, watchos) +XPC_EXPORT XPC_NONNULL1 XPC_WARN_RESULT +int +xpc_connection_set_peer_team_identity_requirement(xpc_connection_t connection, const char * _Nullable signing_identifier); + +/*! + * @function xpc_connection_set_peer_platform_identity_requirement + * Requires that the connection peer has the specified identity and is signed by Apple + * + * @param connection + * The connection object which is to be modified + * + * @param signing_identifier + * The optional signing identifier the peer must have. If not specified, this function ensures that the peer is signed by Apple + * It is safe to deallocate the signing identifier string after calling `xpc_connection_set_peer_identity_requirement` + * + * @result + * 0 on success, non-zero on error + * + * @discussion + * This function will return an error promptly if the identity requirement is invalid. + * + * The peer process must be signed by Apple. Use `xpc_connection_set_peer_identity_requirement` if the peer + * is not part of the OS. + * + * It is a programming error to call multiple of the `xpc_connection_set_peer_*_requirement` family of functions on the same + * connection. If more complex combinations of requirements are required, use + * `xpc_connection_set_peer_lightweight_code_requirement`. + * + * All messages received on this connection will be checked to ensure that they come from a peer who satisfies the + * 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. + */ +API_AVAILABLE(macos(14.4), ios(17.4)) +API_UNAVAILABLE(tvos, watchos) +XPC_EXPORT XPC_NONNULL1 XPC_WARN_RESULT +int +xpc_connection_set_peer_platform_identity_requirement(xpc_connection_t connection, const char * _Nullable signing_identifier); + +/*! + * @function xpc_connection_set_peer_lightweight_code_requirement + * Requires that the connection peer has the specified lightweight code requirement + * + * @param connection + * The connection object which is to be modified + * + * @param lwcr + * The lightweight code requirement the peer must have + * It is safe to deallocate the lightweight code requirement object after calling `xpc_connection_set_peer_lightweight_code_requirement` + * + * @result + * 0 on success, non-zero on error + * + * @discussion + * This function will return an error promptly if the lightweight code requirement is invalid. + * + * The lightweight code requirement must be an `xpc_dictionary_t` equivalent of an LWCR constraint (see + * https://developer.apple.com/documentation/security/defining_launch_environment_and_library_constraints + * for details on the contents of the dictionary) + * + * The lightweight code requirement in the example below uses the $or operator to require that an + * executable’s either signed with the Team ID 8XCUU22SN2, or is an operating system executable: + * ```c + * xpc_object_t or_val = xpc_dictionary_create_empty(); + * xpc_dictionary_set_string(or_val, "team-identifier", "8XCUU22SN2"); + * xpc_dictionary_set_int64(or_val, "validation-category", 1); + * + * xpc_object_t lwcr = xpc_dictionary_create_empty(); + * xpc_dictionary_set_value(lwcr, "$or", or_val); + * + * xpc_connection_set_peer_lightweight_code_requirement(connection, lwcr); + * ``` + * + * It is a programming error to call multiple of the `xpc_connection_set_peer_*_requirement` family of functions on the same + * connection. + * + * All messages received on this connection will be checked to ensure that they come from a peer who satisfies the + * 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. + */ +API_AVAILABLE(macos(14.4), ios(17.4)) +API_UNAVAILABLE(tvos, watchos) +XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT +int +xpc_connection_set_peer_lightweight_code_requirement(xpc_connection_t connection, xpc_object_t lwcr); + +/*! + * @function xpc_connection_copy_invalidation_reason + * Returns a description of why the connection was invalidated. + * + * @param connection + * The connection object to inspect + * + * @result + * Null if the connection has not been invalidated, otherwise a description for why the connection was invalidated. + */ +API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0)) +XPC_EXPORT XPC_NONNULL1 XPC_WARN_RESULT +char * _Nullable +xpc_connection_copy_invalidation_reason(xpc_connection_t connection); __END_DECLS XPC_ASSUME_NONNULL_END diff --git a/lib/libc/include/any-macos-any/xpc/listener.h b/lib/libc/include/any-macos-any/xpc/listener.h index 3a0c8cabfe1c..6cf34d2c82b5 100644 --- a/lib/libc/include/any-macos-any/xpc/listener.h +++ b/lib/libc/include/any-macos-any/xpc/listener.h @@ -36,11 +36,19 @@ OS_OBJECT_DECL_CLASS(xpc_listener); * Indicates that the listener should not be activated during its creation. The * returned listener must be manually activated using * {@link xpc_listener_activate} before it can be used. + * + * @const XPC_LISTENER_CREATE_FORCE_MACH + * Optional key to indicate to the runtime that this listener is for a Mach Service + * + * @const XPC_LISTENER_CREATE_FORCE_XPCSERVICE + * Optional key to indicate to the runtime that this listener is for a XPCService endpoint */ XPC_SWIFT_NOEXPORT XPC_FLAGS_ENUM(xpc_listener_create_flags, uint64_t, XPC_LISTENER_CREATE_NONE XPC_SWIFT_NAME("none") = 0, XPC_LISTENER_CREATE_INACTIVE XPC_SWIFT_NAME("inactive") = (1 << 0), + XPC_LISTENER_CREATE_FORCE_MACH XPC_SWIFT_NAME("mach") = ( 1 << 1), + XPC_LISTENER_CREATE_FORCE_XPCSERVICE XPC_SWIFT_NAME("xpcservice") = ( 1 << 2), ); #pragma mark Handlers @@ -59,7 +67,8 @@ typedef void (^xpc_listener_incoming_session_handler_t)(xpc_session_t peer); * should be disposed of with free(3) when done. This will return NULL if a * string description could not be generated. */ -API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0), watchos(10.0)) +API_AVAILABLE(macos(14.0), macCatalyst(17.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT XPC_WARN_RESULT char * _Nullable xpc_listener_copy_description(xpc_listener_t listener); @@ -107,7 +116,8 @@ xpc_listener_copy_description(xpc_listener_t listener); * or cancel the session using `xpc_session_cancel`. Failure to take one of * these two actions will result in an API misuse crash. */ -API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0), watchos(10.0)) +API_AVAILABLE(macos(14.0), macCatalyst(17.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_listener_t _Nullable xpc_listener_create(const char * service, @@ -136,7 +146,8 @@ xpc_listener_create(const char * service, * activated. Releasing the last reference on an inactive listener that was * created with an xpc_listener_create() is undefined. */ -API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0), watchos(10.0)) +API_AVAILABLE(macos(14.0), macCatalyst(17.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT bool xpc_listener_activate(xpc_listener_t listener, @@ -157,7 +168,8 @@ xpc_listener_activate(xpc_listener_t listener, * to be explicitly cancelled and the process can safely terminate * without cancelling the listener. */ -API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0), watchos(10.0)) +API_AVAILABLE(macos(14.0), macCatalyst(17.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT void xpc_listener_cancel(xpc_listener_t listener); @@ -176,11 +188,42 @@ xpc_listener_cancel(xpc_listener_t listener); * @discussion * The peer session will be cancelled and cannot be used after it has been rejected */ -API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0), watchos(10.0)) +API_AVAILABLE(macos(14.0), macCatalyst(17.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT void xpc_listener_reject_peer(xpc_session_t peer, const char *reason); +/*! + * @function xpc_listener_set_peer_code_signing_requirement + * Requires that the listener peer satisfies a code signing requirement. + * + * @param listener + * The listener 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_listener_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_listener_set_peer_code_signing_requirement` more than once per listener. + * + * All messages received on this listener will be checked to ensure they come from a peer who satisfies + * the code signing requirement. Requests that do not satisfy the requirement are dropped. + * + * @see https://developer.apple.com/documentation/technotes/tn3127-inside-code-signing-requirements + */ +API_AVAILABLE(macos(14.4)) +API_UNAVAILABLE(ios, tvos, watchos) +XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT +int +xpc_listener_set_peer_code_signing_requirement(xpc_listener_t listener, const char *requirement); + __END_DECLS XPC_ASSUME_NONNULL_END diff --git a/lib/libc/include/any-macos-any/xpc/session.h b/lib/libc/include/any-macos-any/xpc/session.h index 895ba45b9573..344669ed4dd0 100644 --- a/lib/libc/include/any-macos-any/xpc/session.h +++ b/lib/libc/include/any-macos-any/xpc/session.h @@ -14,6 +14,20 @@ XPC_ASSUME_NONNULL_BEGIN __BEGIN_DECLS +/*! + * @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. + * + */ +OS_OBJECT_DECL_CLASS(xpc_session); + #pragma mark Constants /*! * @typedef xpc_session_create_flags_t @@ -94,7 +108,8 @@ xpc_session_copy_description(xpc_session_t session); * 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)) +API_AVAILABLE(macos(13.0), macCatalyst(16.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_session_t _Nullable xpc_session_create_xpc_service(const char *name, @@ -139,7 +154,8 @@ xpc_session_create_xpc_service(const char *name, * bootstrap or is otherwise unavailable. * */ -API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0)) +API_AVAILABLE(macos(13.0), macCatalyst(16.0)) +API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_session_t _Nullable xpc_session_create_mach_service(const char *mach_service, @@ -367,6 +383,42 @@ void xpc_session_send_message_with_reply_async(xpc_session_t session, xpc_object_t message, xpc_session_reply_handler_t reply_handler); +/*! + * @function xpc_session_set_peer_code_signing_requirement + * Requires that the session peer satisfies a code signing requirement. + * + * @param session + * The session 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_session_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_session_set_peer_code_signing_requirement` more than once per session. + * + * All messages received on this session will be checked to ensure they come from a peer who satisfies + * the code signing requirement. When message or a reply is received on the session and the peer does + * not satisfy the requirement the session will be cancelled. + * + * @see https://developer.apple.com/documentation/technotes/tn3127-inside-code-signing-requirements + */ +API_AVAILABLE(macos(14.4)) +API_UNAVAILABLE(ios, tvos, watchos) +XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT +int +xpc_session_set_peer_code_signing_requirement(xpc_session_t session, const char *requirement); + +/* This is included for compatibility and should not be used in new code */ +#define XPC_TYPE_SESSION (&_xpc_type_session) +XPC_EXPORT +XPC_TYPE(_xpc_type_session); + __END_DECLS XPC_ASSUME_NONNULL_END diff --git a/lib/libc/include/any-macos-any/xpc/xpc.h b/lib/libc/include/any-macos-any/xpc/xpc.h index 8f1ac0c866fe..83742c6f0126 100644 --- a/lib/libc/include/any-macos-any/xpc/xpc.h +++ b/lib/libc/include/any-macos-any/xpc/xpc.h @@ -325,23 +325,6 @@ __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 * @@ -367,7 +350,9 @@ XPC_ASSUME_NONNULL_END #include #endif // __BLOCKS__ #undef __XPC_INDIRECT__ +#if __has_include() #include +#endif // __has_include() #endif // !defined(__XPC_BUILDING_XPC__) || !__XPC_BUILDING_XPC__ XPC_ASSUME_NONNULL_BEGIN __BEGIN_DECLS @@ -2342,6 +2327,32 @@ void xpc_dictionary_set_connection(xpc_object_t xdict, const char *key, xpc_connection_t connection); +/*! + * @function xpc_dictionary_set_mach_send + * + * @abstract + * Inserts a send right into a dictionary. + * + * @param xdict + * The dictionary which is to be manipulated. + * + * @param key + * The key for which the primitive value shall be set. + * + * @param p + * The port to insert. After calling this method, the XPC object + * corresponding to the primitive value inserted may be safely retrieved + * with {@link xpc_dictionary_copy_mach_send()}. + * + * @discussion + * The XPC runtime sends the port with disposition `MACH_MSG_TYPE_COPY_SEND` + */ +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 +void +xpc_dictionary_set_mach_send(xpc_object_t xdict, const char *key, + mach_port_t p); + #pragma mark Dictionary Primitive Getters /*! * @function xpc_dictionary_get_bool @@ -2625,6 +2636,33 @@ XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL xpc_object_t _Nullable xpc_dictionary_get_array(xpc_object_t xdict, const char *key); +/*! + * @function xpc_dictionary_copy_mach_send + * + * @abstract + * Returns a send right to the mach port. + * + * @param xdict + * The dictionary object which is to be examined. + * + * @param key + * The key whose value is to be obtained. + * + * @result + * The object for the specified key within the dictionary. `MACH_PORT_NULL` + * if there is no value associated with the specified key, if the given object + * was not an XPC dictionary, or if the object for the specified key is not a send + * right. + * + * @discussion + * The XPC runtime will copy the send right using `mach_port_mod_refs` + * before returning the port + */ +__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 XPC_NONNULL2 +mach_port_t +xpc_dictionary_copy_mach_send(xpc_object_t xdict, const char *key); + #pragma mark Runtime /*! * @function xpc_main @@ -2637,7 +2675,8 @@ xpc_dictionary_get_array(xpc_object_t xdict, const char *key); * @param handler * The handler with which to accept new connections. */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +API_AVAILABLE(macos(10.7), macCatalyst(5.0)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_NORETURN XPC_NONNULL1 void xpc_main(xpc_connection_handler_t handler); @@ -2673,7 +2712,8 @@ xpc_main(xpc_connection_handler_t handler); * connection's event handler, no more messages will be delivered to the * connection. */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +API_AVAILABLE(macos(10.7)) +API_UNAVAILABLE(ios) XPC_TRANSACTION_DEPRECATED XPC_EXPORT void @@ -2690,7 +2730,8 @@ xpc_transaction_begin(void); * See the discussion for {@link xpc_transaction_begin()} for details regarding * the XPC runtime's idle-exit policy. */ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +API_AVAILABLE(macos(10.7)) +API_UNAVAILABLE(ios) XPC_TRANSACTION_DEPRECATED XPC_EXPORT void @@ -2725,7 +2766,8 @@ xpc_transaction_end(void); * between the event handler running and the process exiting. */ #if __BLOCKS__ -__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) +API_AVAILABLE(macos(10.7)) +API_UNAVAILABLE(ios) XPC_EXPORT XPC_NONNULL1 XPC_NONNULL3 void xpc_set_event_stream_handler(const char *stream,