Skip to content

Commit

Permalink
use fma in decoding (#148)
Browse files Browse the repository at this point in the history
* use fma

* Update Project.toml

* bump version
  • Loading branch information
ericphanson authored Jan 26, 2024
1 parent 7b0c191 commit ba275fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Onda"
uuid = "e853f5be-6863-11e9-128d-476edb89bfb5"
authors = ["Beacon Biosignals, Inc."]
version = "0.15.4"
version = "0.15.5"

[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Expand Down
6 changes: 3 additions & 3 deletions src/samples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ end
"""
decode(sample_resolution_in_unit, sample_offset_in_unit, sample_data)
Return `sample_resolution_in_unit .* sample_data .+ sample_offset_in_unit`.
Return `fma.(sample_resolution_in_unit, sample_data, sample_offset_in_unit)`.
If:
Expand All @@ -379,7 +379,7 @@ function decode(sample_resolution_in_unit, sample_offset_in_unit, sample_data)
if sample_data isa AbstractArray
isone(sample_resolution_in_unit) && iszero(sample_offset_in_unit) && return sample_data
end
return sample_resolution_in_unit .* sample_data .+ sample_offset_in_unit
return fma.(sample_resolution_in_unit, sample_data, sample_offset_in_unit)
end

"""
Expand All @@ -389,7 +389,7 @@ Similar to `decode(sample_resolution_in_unit, sample_offset_in_unit, sample_data
write decoded values to `result_storage` rather than allocating new storage.
"""
function decode!(result_storage, sample_resolution_in_unit, sample_offset_in_unit, sample_data)
f = x -> sample_resolution_in_unit * x + sample_offset_in_unit
f = x -> fma(sample_resolution_in_unit, x, sample_offset_in_unit)
return broadcast!(f, result_storage, sample_data)
end

Expand Down

2 comments on commit ba275fc

@ericphanson
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/99643

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.15.5 -m "<description of version>" ba275fc744b082ab44729a876f38a50af00a8143
git push origin v0.15.5

Please sign in to comment.