Skip to content

Commit

Permalink
better match intel pseudocode
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIronBorn committed Jun 29, 2018
1 parent a71eb28 commit be0b786
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions coresimd/ppsv/api/rotates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ macro_rules! impl_vector_rotates {
const LANE_WIDTH: $elem_ty = ::mem::size_of::<$elem_ty>() as $elem_ty * 8;
// Protect against undefined behavior for over-long bit shifts
let n = n % LANE_WIDTH;
(self << n) | (self >> ((LANE_WIDTH - n) % LANE_WIDTH))
(self << n) | (self >> (LANE_WIDTH - n))
}

/// Shifts the bits of each lane to the right by the specified amount in
Expand All @@ -31,7 +31,7 @@ macro_rules! impl_vector_rotates {
const LANE_WIDTH: $elem_ty = ::mem::size_of::<$elem_ty>() as $elem_ty * 8;
// Protect against undefined behavior for over-long bit shifts
let n = n % LANE_WIDTH;
(self >> n) | (self << ((LANE_WIDTH - n) % LANE_WIDTH))
(self >> n) | (self << (LANE_WIDTH - n))
}
}
};
Expand Down

0 comments on commit be0b786

Please sign in to comment.