Skip to content

Commit

Permalink
simplified macros a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrh committed Jun 20, 2016
1 parent 5f98afc commit d78f621
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,28 @@
#[cfg(not(feature="unsafe"))]
macro_rules! fast_ref {
(($slice : expr)[$index: expr]) => (
&(&$slice)[$index]
&($slice)[$index]
);
}

#[cfg(not(feature="unsafe"))]
macro_rules! fast_inner {
(($slice : expr)[$index: expr]) => (
(&$slice)[$index]
($slice)[$index]
);
}

#[cfg(not(feature="unsafe"))]
macro_rules! fast_inner {
(($slice : expr)[$index: expr]) => (
(&$slice)[$index]
($slice)[$index]
);
}
/*
#[cfg(not(feature="unsafe"))]
macro_rules! fast_slice {
(($slice : expr)[$index: expr]) => (
($slice.slice())[$index]
);
}
#[cfg(not(feature="unsafe"))]
macro_rules! fast_slice_mut {
(($slice : expr)[$index: expr]) => (
($slice.slice_mut())[$index]
);
}
*/

#[cfg(not(feature="unsafe"))]
macro_rules! fast {
(($slice : expr)[$index: expr]) => (
(&$slice)[$index]
($slice)[$index]
);
(($slice : expr)[$start: expr ; $end : expr]) => (
&($slice)[$start .. $end]
Expand All @@ -60,7 +45,7 @@ macro_rules! fast_uninitialized {
#[cfg(not(feature="unsafe"))]
macro_rules! fast_mut {
(($slice : expr)[$index: expr]) => (
*&mut($slice)[$index]
($slice)[$index]
);
(($slice : expr)[$start: expr ; $end : expr]) => (
&mut $slice[$start..$end]
Expand Down

0 comments on commit d78f621

Please sign in to comment.