From 55af9752cee7ce489864859ee1dfaa9da06fee17 Mon Sep 17 00:00:00 2001 From: GoldsteinE Date: Thu, 20 Apr 2023 15:13:13 +0300 Subject: [PATCH] perf: add #[inline] to check_alignment() --- src/boxed.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/boxed.rs b/src/boxed.rs index 081ffee..1af61c0 100644 --- a/src/boxed.rs +++ b/src/boxed.rs @@ -32,6 +32,7 @@ pub(crate) struct BoxedString { /// /// Returns `true` if aligned to an odd address, `false` if even. The sense of /// the boolean is "does this look like an InlineString? true/false" +#[inline] fn check_alignment(ptr: *const u8) -> bool { ptr.align_offset(2) > 0 } @@ -53,6 +54,7 @@ impl GenericString for BoxedString { impl BoxedString { const MINIMAL_CAPACITY: usize = MAX_INLINE * 2; + #[inline] pub(crate) fn check_alignment(this: &Self) -> bool { check_alignment(this.ptr.as_ptr()) }