Skip to content

Instantly share code, notes, and snippets.

View yuriks's full-sized avatar

Yuri Kunde Schlesner yuriks

View GitHub Profile
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); }
#pragma once
#include <type_traits>
#include <tuple>
#include <cstddef>
namespace detail {
template <typename T, size_t Index, typename... Tuple>
class find_type_impl;
struct PinInput {
d: u8,
wait: bool,
interrupt: bool,
nmi: bool,
reset: bool,
busrq: bool,
}
struct PinOutput {
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) };
#![allow(dead_code)]
use std::default::Default;
struct PinInput {
d: u8,
wait: bool,
interrupt: bool,
nmi: bool,
reset: bool,
busrq: bool,
#![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;
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)
}
};
#![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,
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() }
}
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)
}