Skip to content

Commit

Permalink
Make some inlined fns const.
Browse files Browse the repository at this point in the history
The previous commit made a large number of functions const. Make the
function that we can const.
  • Loading branch information
KyleSiefring committed Jun 16, 2020
1 parent 90fa2d5 commit b14cbc7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/api/config/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl EncoderConfig {

/// Is temporal RDO enabled ?
#[inline]
pub fn temporal_rdo(&self) -> bool {
pub const fn temporal_rdo(&self) -> bool {
// Note: This function is called frequently, unlike most other functions here.

// `compute_distortion_scale` computes a scaling factor for the distortion
Expand Down
2 changes: 1 addition & 1 deletion src/asm/aarch64/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ declare_asm_dist_fn![
const DIST_FNS_LENGTH: usize = 32;

#[inline]
fn to_index(bsize: BlockSize) -> usize {
const fn to_index(bsize: BlockSize) -> usize {
bsize as usize & (DIST_FNS_LENGTH - 1)
}

Expand Down
2 changes: 1 addition & 1 deletion src/asm/x86/dist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ declare_asm_dist_fn![
const DIST_FNS_LENGTH: usize = 32;

#[inline]
fn to_index(bsize: BlockSize) -> usize {
const fn to_index(bsize: BlockSize) -> usize {
bsize as usize & (DIST_FNS_LENGTH - 1)
}

Expand Down
4 changes: 2 additions & 2 deletions src/asm/x86/transform/forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ struct I32X8 {
impl I32X8 {
#[target_feature(enable = "avx2")]
#[inline]
unsafe fn vec(self) -> __m256i {
const unsafe fn vec(self) -> __m256i {
self.data
}

#[target_feature(enable = "avx2")]
#[inline]
unsafe fn new(a: __m256i) -> I32X8 {
const unsafe fn new(a: __m256i) -> I32X8 {
I32X8 { data: a }
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rdo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ impl From<DistortionScale> for f64 {

impl RawDistortion {
#[inline]
pub fn new(dist: u64) -> Self {
pub const fn new(dist: u64) -> Self {
Self(dist)
}
}
Expand Down

0 comments on commit b14cbc7

Please sign in to comment.