Skip to content

Commit b14cbc7

Browse files
committed
Make some inlined fns const.
The previous commit made a large number of functions const. Make the function that we can const.
1 parent 90fa2d5 commit b14cbc7

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/api/config/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl EncoderConfig {
186186

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

192192
// `compute_distortion_scale` computes a scaling factor for the distortion

src/asm/aarch64/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ declare_asm_dist_fn![
5959
const DIST_FNS_LENGTH: usize = 32;
6060

6161
#[inline]
62-
fn to_index(bsize: BlockSize) -> usize {
62+
const fn to_index(bsize: BlockSize) -> usize {
6363
bsize as usize & (DIST_FNS_LENGTH - 1)
6464
}
6565

src/asm/x86/dist/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ declare_asm_dist_fn![
113113
const DIST_FNS_LENGTH: usize = 32;
114114

115115
#[inline]
116-
fn to_index(bsize: BlockSize) -> usize {
116+
const fn to_index(bsize: BlockSize) -> usize {
117117
bsize as usize & (DIST_FNS_LENGTH - 1)
118118
}
119119

src/asm/x86/transform/forward.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ struct I32X8 {
6565
impl I32X8 {
6666
#[target_feature(enable = "avx2")]
6767
#[inline]
68-
unsafe fn vec(self) -> __m256i {
68+
const unsafe fn vec(self) -> __m256i {
6969
self.data
7070
}
7171

7272
#[target_feature(enable = "avx2")]
7373
#[inline]
74-
unsafe fn new(a: __m256i) -> I32X8 {
74+
const unsafe fn new(a: __m256i) -> I32X8 {
7575
I32X8 { data: a }
7676
}
7777
}

src/rdo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl From<DistortionScale> for f64 {
558558

559559
impl RawDistortion {
560560
#[inline]
561-
pub fn new(dist: u64) -> Self {
561+
pub const fn new(dist: u64) -> Self {
562562
Self(dist)
563563
}
564564
}

0 commit comments

Comments
 (0)