-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimize
float
-> f64
conversions on non-abi3
- Loading branch information
1 parent
8f5bc71
commit 853142d
Showing
6 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Optimize conversion of `float` to `f64` (and `PyFloat::value`) on non-abi3 builds. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::{PyFloat_Check, PyObject}; | ||
use std::os::raw::c_double; | ||
|
||
#[repr(C)] | ||
pub struct PyFloatObject { | ||
pub ob_base: PyObject, | ||
pub ob_fval: c_double, | ||
} | ||
|
||
#[inline] | ||
pub unsafe fn _PyFloat_CAST(op: *mut PyObject) -> *mut PyFloatObject { | ||
debug_assert_eq!(PyFloat_Check(op), 1); | ||
op.cast() | ||
} | ||
|
||
#[inline] | ||
pub unsafe fn PyFloat_AS_DOUBLE(op: *mut PyObject) -> c_double { | ||
(*_PyFloat_CAST(op)).ob_fval | ||
} | ||
|
||
// skipped PyFloat_Pack2 | ||
// skipped PyFloat_Pack4 | ||
// skipped PyFloat_Pack8 | ||
|
||
// skipped PyFloat_Unpack2 | ||
// skipped PyFloat_Unpack4 | ||
// skipped PyFloat_Unpack8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters