Skip to content

Commit

Permalink
micro optimize repeat function
Browse files Browse the repository at this point in the history
  • Loading branch information
andjo403 committed Apr 5, 2020
1 parent 17572d4 commit dc0b0de
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/raw/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ pub const BITMASK_MASK: BitMaskWord = 0x8080_8080_8080_8080_u64 as GroupWord;
/// Helper function to replicate a byte across a `GroupWord`.
#[inline]
fn repeat(byte: u8) -> GroupWord {
let repeat = GroupWord::from(byte);
let repeat = repeat | repeat.wrapping_shl(8);
let repeat = repeat | repeat.wrapping_shl(16);
// This last line is a no-op with a 32-bit GroupWord
repeat | repeat.wrapping_shl(32)
GroupWord::from_ne_bytes([byte; Group::WIDTH])
}

/// Abstraction over a group of control bytes which can be scanned in
Expand Down

0 comments on commit dc0b0de

Please sign in to comment.