Skip to content

Enable long double for all targets #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions libffi-rs/src/low.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,18 @@ pub use raw::{
/// becomes [`types::void`].
pub mod types {
pub use crate::raw::{
ffi_type_double as double, ffi_type_float as float, ffi_type_pointer as pointer,
ffi_type_sint16 as sint16, ffi_type_sint32 as sint32, ffi_type_sint64 as sint64,
ffi_type_sint8 as sint8, ffi_type_uint16 as uint16, ffi_type_uint32 as uint32,
ffi_type_uint64 as uint64, ffi_type_uint8 as uint8, ffi_type_void as void,
ffi_type_double as double, ffi_type_float as float, ffi_type_longdouble as longdouble,
ffi_type_pointer as pointer, ffi_type_sint16 as sint16, ffi_type_sint32 as sint32,
ffi_type_sint64 as sint64, ffi_type_sint8 as sint8, ffi_type_uint16 as uint16,
ffi_type_uint32 as uint32, ffi_type_uint64 as uint64, ffi_type_uint8 as uint8,
ffi_type_void as void,
};

#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
pub use crate::raw::ffi_type_longdouble as longdouble;

#[cfg(feature = "complex")]
pub use crate::raw::{
ffi_type_complex_double as complex_double, ffi_type_complex_float as complex_float,
ffi_type_complex_longdouble as complex_longdouble,
};

#[cfg(feature = "complex")]
#[cfg(not(all(target_arch = "arm")))]
pub use crate::raw::ffi_type_complex_longdouble as complex_longdouble;
}

/// Type tags used in constructing and inspecting [`ffi_type`]s.
Expand Down
2 changes: 0 additions & 2 deletions libffi-rs/src/middle/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ impl Type {
}

/// Returns the C `long double` (extended-precision floating point) type.
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
pub fn longdouble() -> Self {
Type(unsafe { Unique::new(addr_of_mut!(low::types::longdouble)) })
}
Expand All @@ -406,7 +405,6 @@ impl Type {
///
/// This item is enabled by `#[cfg(feature = "complex")]`.
#[cfg(feature = "complex")]
#[cfg(not(all(target_arch = "arm")))]
pub fn complex_longdouble() -> Self {
Type(unsafe { Unique::new(addr_of_mut!(low::types::complex_longdouble)) })
}
Expand Down
6 changes: 1 addition & 5 deletions libffi-sys-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,8 @@ extern "C" {
pub static mut ffi_type_sint64: ffi_type;
pub static mut ffi_type_float: ffi_type;
pub static mut ffi_type_double: ffi_type;
pub static mut ffi_type_pointer: ffi_type;

#[cfg(not(target_arch = "aarch64"))]
#[cfg(not(all(target_arch = "arm", target_os = "linux", target_env = "gnu")))]
pub static mut ffi_type_longdouble: ffi_type;
pub static mut ffi_type_pointer: ffi_type;

#[cfg(feature = "complex")]
pub static mut ffi_type_complex_float: ffi_type;
Expand All @@ -434,7 +431,6 @@ extern "C" {
pub static mut ffi_type_complex_double: ffi_type;

#[cfg(feature = "complex")]
#[cfg(not(all(target_arch = "arm", target_os = "linux", target_env = "gnu")))]
pub static mut ffi_type_complex_longdouble: ffi_type;

pub fn ffi_raw_call(
Expand Down
Loading