This file contains hidden or 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
| let mut iter = args.move_iter().peekable(); | |
| match &mut iter { | |
| i => | |
| loop { | |
| match i.next() { | |
| None => break , | |
| Some(arg) => { | |
| if arg.starts_with("-") { | |
| // TODO | |
| } else { free_args.push(arg); } |
This file contains hidden or 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
| #pragma once | |
| #include <type_traits> | |
| #include <tuple> | |
| #include <cstddef> | |
| namespace detail { | |
| template <typename T, size_t Index, typename... Tuple> | |
| class find_type_impl; |
This file contains hidden or 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
| struct PinInput { | |
| d: u8, | |
| wait: bool, | |
| interrupt: bool, | |
| nmi: bool, | |
| reset: bool, | |
| busrq: bool, | |
| } | |
| struct PinOutput { |
This file contains hidden or 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 decode_instruction(opcode: u8, cycles: &mut [MCycle, ..6]) { | |
| let instr_x = opcode >> 6 & 0b11; | |
| let instr_y = opcode >> 3 & 0b111; | |
| let instr_z = opcode >> 0 & 0b111; | |
| match (instr_x, instr_y, instr_z) { | |
| (0b00, 0b000, 0b000) => { // NOP | |
| cycles[0] = MCycle { alu_op: AluNone, address_src: RegPC, bus: BusFetch }; | |
| }, (0b00, 0b110, 0b110) => { // LD (HL), n | |
| cycles[0] = MCycle { alu_op: AluNone, address_src: RegPC, bus: BusMem(Read) }; |
This file contains hidden or 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
| #![allow(dead_code)] | |
| use std::default::Default; | |
| struct PinInput { | |
| d: u8, | |
| wait: bool, | |
| interrupt: bool, | |
| nmi: bool, | |
| reset: bool, | |
| busrq: bool, |
This file contains hidden or 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
| #![feature(phase)] | |
| #[phase(syntax, link)] extern crate log; | |
| extern crate collections; | |
| extern crate crypto = "rust-crypto"; | |
| use collections::Bitv; | |
| use common::{KiB, BlockId, SequenceId, Packet}; | |
| use std::slice::MutableCloneableVector; |
This file contains hidden or 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
| let mut files = LruCache::new(8); | |
| let file = match files.get(file_info.name) { | |
| Some(f) => f, | |
| None => { | |
| let f = open_file(file_info.name); | |
| files.put(file_info.name, f); | |
| files.get(file_info.name) | |
| } | |
| }; |
This file contains hidden or 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
| #![feature(phase)] | |
| #[phase(syntax, link)] extern crate log; | |
| extern crate collections; | |
| extern crate crypto = "rust-crypto"; | |
| extern crate sync; | |
| use collections::bitv::{Bitv, BitvSet}; | |
| use common::{ | |
| BlockId, |
This file contains hidden or 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::num::{One, Zero, one, zero}; | |
| #[deriving(Eq)] | |
| struct Dual<T> { x: T, dx: T } | |
| impl<T: Zero> Zero for Dual<T> { | |
| fn zero() -> Dual<T> { | |
| Dual { x: zero(), dx: zero() } | |
| } |
This file contains hidden or 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::num::One; | |
| pub trait Pow : Mul<Self, Self> { | |
| fn pow(&self, exponent: &Self) -> Self; | |
| } | |
| pub impl<T: Float> Pow for T { | |
| fn pow(&self, exponent: &T) -> T { | |
| self.powf(*exponent) | |
| } |