Skip to content

Commit 8a23181

Browse files
committed
Annotate functions as inline.
1 parent df1fa09 commit 8a23181

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ macro_rules! iter_impl {
8181
/// `From` implementation for `BitIter`.
8282
impl From<$t> for BitIter<$t> {
8383
/// Construct a BitIter value.
84+
#[inline]
8485
fn from(value: $t) -> Self {
8586
Self(value)
8687
}
@@ -90,6 +91,7 @@ macro_rules! iter_impl {
9091
impl Iterator for BitIter<$t> {
9192
type Item = usize;
9293

94+
#[inline]
9395
fn next(&mut self) -> Option<Self::Item> {
9496
if self.0 != 0 {
9597
let trailing = self.0.trailing_zeros() as usize;
@@ -100,15 +102,18 @@ macro_rules! iter_impl {
100102
}
101103
}
102104

105+
#[inline]
103106
fn size_hint(&self) -> (usize, Option<usize>) {
104107
let sz = self.0.count_ones() as usize;
105108
(sz, Some(sz))
106109
}
107110

111+
#[inline]
108112
fn count(self) -> usize {
109113
self.0.count_ones() as usize
110114
}
111115

116+
#[inline]
112117
fn last(self) -> Option<Self::Item> {
113118
if self.0 != 0 {
114119
Some(8 * size_of::<$t>() - 1 - self.0.leading_zeros() as usize)
@@ -117,6 +122,7 @@ macro_rules! iter_impl {
117122
}
118123
}
119124

125+
#[inline]
120126
fn nth(&mut self, n: usize) -> Option<Self::Item> {
121127
let mut i = 0;
122128
while self.0 != 0 && i < n {
@@ -126,10 +132,12 @@ macro_rules! iter_impl {
126132
self.next()
127133
}
128134

135+
#[inline]
129136
fn max(self) -> Option<Self::Item> {
130137
self.last()
131138
}
132139

140+
#[inline]
133141
fn min(self) -> Option<Self::Item> {
134142
if self.0 != 0 {
135143
Some(self.0.trailing_zeros() as usize)
@@ -144,6 +152,7 @@ macro_rules! iter_impl {
144152

145153
/// `DoubleEndedIterator` implementation for `BitIter`.
146154
impl DoubleEndedIterator for BitIter<$t> {
155+
#[inline]
147156
fn next_back(&mut self) -> Option<Self::Item> {
148157
if self.0 != 0 {
149158
let highest = 8 * size_of::<$t>() - 1 - self.0.leading_zeros() as usize;

0 commit comments

Comments
 (0)