Skip to content

Commit

Permalink
feat: remove i32 and f32 header parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Jul 8, 2022
1 parent fcd5468 commit 75099eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
## [Unreleased]
### Added

* Support for boolean header card values
* (`fitsio`) Support for boolean header card values

### Changed

* Some more types are deriving `Eq` thanks to a clippy lint
* (`fitsio`) Some more types are deriving `Eq` thanks to a clippy lint

### Removed

* (`fitsio`) **BREAKING CHANGE** Removed the ability to read `i32` and `f32` header values. Instead, please use the `i64` and `f64` equivalents. This is because there is a bug in reading `i32` values in that they are read as "logical" i.e. 0 or 1. This led me to decide that we don't need to differentiate between `x32` and `x64` types for header values. See the [conversation here](https://github.com/mindriot101/rust-fitsio/issues/167) [#170](https://github.com/mindriot101/rust-fitsio/pull/170)

## [0.20.0]
### Added

Expand Down
4 changes: 1 addition & 3 deletions fitsio/src/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,18 @@ macro_rules! reads_key_impl {
};
}

reads_key_impl!(i32, fits_read_key_log);
#[cfg(all(target_pointer_width = "64", not(target_os = "windows")))]
reads_key_impl!(i64, fits_read_key_lng);
#[cfg(any(target_pointer_width = "32", target_os = "windows"))]
reads_key_impl!(i64, fits_read_key_lnglng);
reads_key_impl!(f32, fits_read_key_flt);
reads_key_impl!(f64, fits_read_key_dbl);

impl ReadsKey for bool {
fn read_key(f: &mut FitsFile, name: &str) -> Result<Self>
where
Self: Sized,
{
let int_value = i32::read_key(f, name)?;
let int_value = i64::read_key(f, name)?;
Ok(int_value > 0)
}
}
Expand Down

0 comments on commit 75099eb

Please sign in to comment.