Skip to content

Instantly share code, notes, and snippets.

@flaper87
Created January 12, 2014 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flaper87/8384731 to your computer and use it in GitHub Desktop.
Save flaper87/8384731 to your computer and use it in GitHub Desktop.
Emulating unpack_from('>I', ...) in the worst way possible
fn get_int(s: &str) -> u32 {
let mut result = 0 as u32;
for b in s.as_bytes().iter() {
result = (result<<8) | *b as u32;
}
result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment