-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use REP MOVSB/STOSB when the ERMSB feature is present (#392)
* Reorganize mem functions This reduces the amount of platform-specific code Signed-off-by: Joe Richey <[email protected]> * Use ERMSB implementations if the feature is set Signed-off-by: Joe Richey <[email protected]> * Add non-aligned benchmarks Signed-off-by: Joe Richey <[email protected]>
- Loading branch information
Showing
5 changed files
with
148 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use super::c_int; | ||
|
||
#[inline(always)] | ||
pub unsafe fn copy_forward(dest: *mut u8, src: *const u8, n: usize) { | ||
let mut i = 0; | ||
while i < n { | ||
*dest.offset(i as isize) = *src.offset(i as isize); | ||
i += 1; | ||
} | ||
} | ||
|
||
#[inline(always)] | ||
pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, n: usize) { | ||
// copy from end | ||
let mut i = n; | ||
while i != 0 { | ||
i -= 1; | ||
*dest.offset(i as isize) = *src.offset(i as isize); | ||
} | ||
} | ||
|
||
#[inline(always)] | ||
pub unsafe fn set_bytes(s: *mut u8, c: u8, n: usize) { | ||
let mut i = 0; | ||
while i < n { | ||
*s.offset(i as isize) = c; | ||
i += 1; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters