Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / playground.rs
Created April 15, 2016 12:26
Shared via Rust Playground
macro_rules! item {
( $i:item ) => ( #[derive(Debug)] $i )
}
macro_rules! vertex_struct {
( $name:ident { $( $n:ident : $t:ty ),* }) => ( item! { struct $name { $( $n: $t ),* } })
}
macro_rules! constant_struct {
( $name:ident $( $body:tt )* ) => ( item! { struct $name $( $body )* })
anonymous
anonymous / playground.rs
Created December 28, 2015 12:38
Shared via Rust Playground
// Illustrate different aliasing behaviour between raw pointers and borrows.
// Inspect ASM or LLVM IR in release mode to see the difference.
#[inline(never)]
fn alias(a: *mut u32, b: *mut u32) {
unsafe {
*a += *b;
*b += *a;
}
}
anonymous
anonymous / untrusted-lvl17-solution.js
Created June 21, 2014 12:26
Solution to level 17 in Untrusted: http://alex.nisnevich.com/untrusted/
/***************
* pointers.js *
***************
*
* You! How are you still alive?
*
* Well, no matter. Good luck getting through this
* maze of rooms - you'll never see me or the Algorithm again!
*/