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
/* | |
* ptarget.h | |
* | |
* Coded by Stefan Vogt, revised Feb 18, 2011. | |
* Released under the FreeBSD license. | |
* http://www.byteproject.net | |
* | |
* header for compiler and OS detection | |
* | |
*/ |
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
pub fn reverse_string(s: &mut Vec<char>) { | |
if s.len() <= 1 { | |
return; | |
} | |
let mut i = 0; | |
let mut j = s.len() - 1; | |
while i != j && i < j { | |
s.swap(i, j); | |
i += 1; | |
j -= 1; |