Skip to content

Commit

Permalink
added inlining for Bytes get_X functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Walnut356 committed Aug 17, 2023
1 parent b49f3d1 commit 329acdb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,98 +585,122 @@ impl Buf for Bytes {
}
}

#[inline]
fn get_u16(&mut self) -> u16 {
buf_get_impl!(self, u16::from_be_bytes);
}

#[inline]
fn get_u16_le(&mut self) -> u16 {
buf_get_impl!(self, u16::from_le_bytes);
}

#[inline]
fn get_u16_ne(&mut self) -> u16 {
buf_get_impl!(self, u16::from_ne_bytes);
}

#[inline]
fn get_i16(&mut self) -> i16 {
buf_get_impl!(self, i16::from_be_bytes);
}

#[inline]
fn get_i16_le(&mut self) -> i16 {
buf_get_impl!(self, i16::from_le_bytes);
}

#[inline]
fn get_i16_ne(&mut self) -> i16 {
buf_get_impl!(self, i16::from_ne_bytes);
}

#[inline]
fn get_u32(&mut self) -> u32 {
buf_get_impl!(self, u32::from_be_bytes);
}

#[inline]
fn get_u32_le(&mut self) -> u32 {
buf_get_impl!(self, u32::from_le_bytes);
}

#[inline]
fn get_u32_ne(&mut self) -> u32 {
buf_get_impl!(self, u32::from_ne_bytes);
}

#[inline]
fn get_i32(&mut self) -> i32 {
buf_get_impl!(self, i32::from_be_bytes);
}

#[inline]
fn get_i32_le(&mut self) -> i32 {
buf_get_impl!(self, i32::from_le_bytes);
}

#[inline]
fn get_i32_ne(&mut self) -> i32 {
buf_get_impl!(self, i32::from_ne_bytes);
}

#[inline]
fn get_u64(&mut self) -> u64 {
buf_get_impl!(self, u64::from_be_bytes);
}

#[inline]
fn get_u64_le(&mut self) -> u64 {
buf_get_impl!(self, u64::from_le_bytes);
}

#[inline]
fn get_u64_ne(&mut self) -> u64 {
buf_get_impl!(self, u64::from_ne_bytes);
}

#[inline]
fn get_i64(&mut self) -> i64 {
buf_get_impl!(self, i64::from_be_bytes);
}

#[inline]
fn get_i64_le(&mut self) -> i64 {
buf_get_impl!(self, i64::from_le_bytes);
}

#[inline]
fn get_i64_ne(&mut self) -> i64 {
buf_get_impl!(self, i64::from_ne_bytes);
}

#[inline]
fn get_u128(&mut self) -> u128 {
buf_get_impl!(self, u128::from_be_bytes);
}

#[inline]
fn get_u128_le(&mut self) -> u128 {
buf_get_impl!(self, u128::from_le_bytes);
}

#[inline]
fn get_u128_ne(&mut self) -> u128 {
buf_get_impl!(self, u128::from_ne_bytes);
}

#[inline]
fn get_i128(&mut self) -> i128 {
buf_get_impl!(self, i128::from_be_bytes);
}

#[inline]
fn get_i128_le(&mut self) -> i128 {
buf_get_impl!(self, i128::from_le_bytes);
}

#[inline]
fn get_i128_ne(&mut self) -> i128 {
buf_get_impl!(self, i128::from_ne_bytes);
}
Expand Down

0 comments on commit 329acdb

Please sign in to comment.