forked from MITHaystack/digital_rf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c: Use integer math to calculate file sample bounds.
This fixes writing with certain combinations of sample rates and file cadences when the `long double` sample rate math fails, e.g. when digital_rf is compiled with 64-bit `long double`s. This does away with use of `long double`s for calculations with the sample rate in the C library in `digital_rf_get_subdir_file` to determine file names and sample bounds. The reason for this change is that not all platforms support `long double`s that with at least a 64-bit mantissa. This caused at least one bug on the aarch64 platform which resulted in incorrect file bounds from `digital_rf_get_subdir_file`. By using integer math that is implemented uniformly on all platforms, any bugs in the calculation should be more noticable. This commit also adds two new functions that are only used internally for now: `digital_rf_get_timestamp_floor` and `digital_rf_get_sample_ceil`. These are now used to do the file sample bound calculations. A future commit will expose these externally so that other C users and the Python library can make use of them, but that will require bumping the library version.
- Loading branch information
Showing
2 changed files
with
187 additions
and
28 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