View ub-if-goldbach-was-wrong.c
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
#include <stdio.h> | |
int bar(unsigned int x) { | |
for (int i = x - 1; i >= 2; i--) | |
for (int s = x; s >= 0; s -= i) | |
if (s == 0) | |
return 0; | |
return 1; | |
} |
View nlp.rs
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
#[derive(Clone, Debug)] | |
pub enum Plural { | |
All, | |
Specific, | |
Exactly(i64), | |
} | |
#[derive(Clone, Debug)] | |
pub enum Logical { | |
And, |
View rtsim2.rs
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
// Top-level rtsim state. The contents of this struct are entirely sufficient to describe the state of the world. | |
struct RtState { | |
temporal: &mut Temporal, | |
agents: &mut Agents, | |
} | |
// Contains tick-by-tick information such as decision tree state, short-term planning, aggro, current activity, etc. | |
// Agents can be both single characters and groups of characters (see `Groups`). | |
struct Agents { ... } |
View graphics-api-mockup.rs
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 graphael::*; | |
use winit::{ | |
event::Event, | |
window::WindowBuilder, | |
event_loop::{ControlFlow, EventLoop}, | |
}; | |
#[derive(Copy, Clone, Pod, Zeroable)] | |
#[repr(C)] | |
pub struct Globals { |
View inference.rs
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 super::*; | |
use std::collections::VecDeque; | |
pub type InferMeta = (Span, TyVar); | |
pub type InferNode<T> = Node<T, InferMeta>; | |
#[derive(Clone, Debug)] | |
pub enum TyInfo { | |
Ref(TyVar), | |
Error, |
View priced_economy.rs
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::BTreeMap as HashMap;//HashMap; | |
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | |
enum Good { | |
Log, // Units: Kg | |
Wood, // Units Kg | |
Meat, // Units: Kg | |
Food, | |
} |
View materialist_economy.rs
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::BTreeMap as HashMap;//HashMap; | |
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | |
enum Good { | |
Log, // Units: Kg | |
Wood, // Units Kg | |
Fish, // Units: Kg | |
Food, | |
} |
View python-lex.rs
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
#[derive(Debug)] | |
enum Token { | |
Num(i64), | |
Paren(Vec<Token>), | |
Block(Vec<Token>), | |
} | |
fn lex(src: &str) -> Result<Vec<Token>, String> { | |
let mut ident_depth = 0; | |
let mut token_stack = vec![(ident_depth, Vec::new())]; |
View breshenham.rs
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 ptr_at(pos: Vec2<isize>) -> *mut Px { ... } | |
type Px = u16; | |
pub unsafe fn line(&mut self, a: Vec2<isize>, b: Vec2<isize>, px: Px) { | |
let delta = b - a; | |
let delta_abs = delta.map(|e| e.abs() as usize); | |
let ptr = ptr_at(a.map(|e| e as usize)); | |
let dx = if delta.x > 0 { 1 } else { -1 }; | |
let dy = if delta.y > 0 { 1 } else { -1 } * WIDTH; |
View block_on.rs
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 super::*; | |
/// Synchronously block until a future completes. | |
/// | |
/// # Safety | |
/// | |
/// No waker provided to the future should ever be polled after the future returns `Poll::Ready`. The waker references | |
/// data on the blocking thread's stack and, as such, access to it after this point is UB because the data is no longer | |
/// a valid pointer. | |
#[allow(unused_unsafe)] // It's a stupid warning anyway. No such thing as unsafe code that's too explicit. |
NewerOlder