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
; ModuleID = 'test.rc' | |
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" | |
target triple = "x86_64-unknown-linux-gnu" | |
%struct.Foo = type { [10 x i64] } | |
%tydesc = type { i64, i64, void ({}*, i8*)*, void ({}*, i8*)*, void ({}*, i8*)*, void ({}*, i8*)*, i64, { i8*, i64 } } | |
@_rust_crate_map_toplevel = global { i32, i64, [2 x i64] } { i32 1, i64 ptrtoint ([1 x { i64, i64 }]* @_rust_mod_map to i64), [2 x i64] [i64 ptrtoint (i64* @_rust_crate_map_std_0.9-pre_6c65cf4b443341b1 to i64), i64 0] } | |
@_rust_crate_map_std_0.9-pre_6c65cf4b443341b1 = external global i64 | |
@_rust_mod_map = internal global [1 x { i64, i64 }] zeroinitializer |
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
use std::hashmap::HashMap; | |
#[deriving(Eq,Clone,IterBytes)] | |
pub struct Ident(u32); | |
#[deriving(Clone)] | |
pub struct Pos { | |
col: u16, | |
row: u16 | |
} |
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 is written pseudo-code, so hopefully should be fairly self-evident. | |
; | |
; A few notes about the general maths which I think will be needed: | |
; | |
; Matrices use what is called a "row-major" convention for sizes/indexes, | |
; this just means that a 2x3 matrix has 2 rows and 3 columns, it also | |
; means that for a matrix, M, M[1][2] is the number in the second column | |
; in the first row (I will also use base-1 indexing, since it better | |
; matches mathematical convention) | |
; |
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
fn test() { | |
let x : [u8, ..256]; | |
let val = get_val(); | |
if val == 0 { | |
x = [1, ..256]; | |
return x; | |
} else if val == 3 { | |
x = [3, ..256]; | |
return x; |
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
// Feel free to copy and modify this code if it's useful to you. | |
macro_rules! if_cfg { | |
($(#[cfg($cfg:meta)] $it:item)+ fallback: $els:item) => ( | |
$(#[cfg($cfg)] $it)+ | |
#[cfg(not(any($($cfg),*)))] $els | |
) | |
} | |
if_cfg { | |
#[cfg(target_arch="x86")] |
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
test int::test::bench_add_1000_10 ... bench: 268 ns/iter (+/- 4) | |
test int::test::bench_add_1000_1000 ... bench: 1666 ns/iter (+/- 131) | |
test int::test::bench_add_100_100 ... bench: 205 ns/iter (+/- 33) | |
test int::test::bench_add_10_10 ... bench: 51 ns/iter (+/- 41) | |
test int::test::bench_add_1_1 ... bench: 39 ns/iter (+/- 33) | |
test int::test::bench_div_1000_1000 ... bench: 2359 ns/iter (+/- 4169) | |
test int::test::bench_div_10_10 ... bench: 58 ns/iter (+/- 135) | |
test int::test::bench_div_1_1 ... bench: 62 ns/iter (+/- 26) | |
test int::test::bench_div_20_2 ... bench: 226 ns/iter (+/- 30) | |
test int::test::bench_div_250_250 ... bench: 117 ns/iter (+/- 1094) |
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
extern crate smallvec; | |
use std::collections::VecDeque; | |
use std::io::Read; | |
use smallvec::SmallVec; | |
pub type LexResult<T> = std::result::Result<T, Error>; | |
/** |
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
define void @test() unnamed_addr #0 { | |
entry-block: | |
br label %start | |
start: ; preds = %entry-block | |
%0 = call i32 @bar() | |
br label %bb2 | |
end: ; preds = %bb3 | |
ret void |
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
use std::collections::HashSet; | |
use std::hash::BuildHasherDefault; | |
use std::default::Default; | |
use std::hash::Hasher; | |
pub struct FnvHasher(u64); | |
impl Default for FnvHasher { | |
#[inline] |
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
define i32 @foo() unnamed_addr #0 { | |
entry-block: | |
%a = alloca i32 | |
%temp0 = alloca {} | |
%temp3 = alloca {} | |
br label %start | |
start: ; preds = %entry-block | |
store i32 0, i32* %a | |
br label %bb2 |