Skip to content

Instantly share code, notes, and snippets.

View retep998's full-sized avatar
๐Ÿ‡
Very fluffy

Peter Atashian retep998

๐Ÿ‡
Very fluffy
  • Massachusetts, USA
View GitHub Profile
#![feature(phase, macro_rules)]
#[phase(plugin)]
extern crate green;
use std::collections::{HashMap, SmallIntMap};
use std::comm::{Receiver, Sender};
use std::io::{Acceptor, BufferedReader, BufferedWriter, BufReader, IoResult, Listener, MemWriter, TcpListener, TcpStream, stdin};
use std::sync::{Arc, RWLock};
@retep998
retep998 / msvc32.asm
Last active August 29, 2015 14:02
Rust vs C++
nl::bench::recurse_sub:
009312E0 push ebp
009312E1 mov ebp,esp
009312E3 and esp,0FFFFFFF8h
009312E6 sub esp,14h
009312E9 mov eax,dword ptr [ebp+8]
009312EC push ebx
009312ED push esi
009312EE push edi
009312EF mov ebx,dword ptr [eax]
; ModuleID = 'test.rc'
target datalayout = "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32"
target triple = "i686-pc-mingw32"
%tydesc = type { i32, i32, void ({}*, i8*)*, void ({}*, i8*)*, void ({}*, i8*)*, void ({}*, i8*)*, i32, { i8*, i32 } }
%str_slice = type { i8*, i32 }
@_rust_crate_map_toplevel = dllexport global { i32, { i32, i32 }, { i32, i32 }, i32* } { i32 2, { i32, i32 } { i32 ptrtoint ([0 x { { i8*, i32 }, i32 }]* @_rust_mod_map to i32), i32 0 }, { i32, i32 } { i32 ptrtoint ([3 x i32]* @_crate_map_child_vectors to i32), i32 3 }, i32* @_ZN4uvio8new_loop19h11261c8c125a261daK4v0.9E }
@str1252 = internal constant [13 x i8] c"Hello World!\00"
@_ZN19_rust_crate_map_std17_3e5aeb837ae1622e4v0.9E = external global i32

Keybase proof

I hereby claim:

  • I am retep998 on github.
  • I am retep998 (https://keybase.io/retep998) on keybase.
  • I have a public key whose fingerprint is 4E05 754D 8D16 BA24 C248 FBFF A827 6CCD 72F3 0C82

To claim this, I am signing this object:

@retep998
retep998 / extra.cpp
Created February 13, 2014 00:49
An example of valid C++ code that results in implementation defined behavior at best, undefined at worst.
#include <iostream>
struct foo {
double bar;
};
void func(foo x) {
std::cout << x.bar;
}
@retep998
retep998 / gcc.s
Last active January 3, 2016 22:29 — forked from kvanbere/in.c
gcc vs msvc asm
0x00000001004010e0 <+0>: cmp rcx,0xfe0
0x00000001004010e7 <+7>: ja 0x10040113f <gc_malloc+95>
0x00000001004010e9 <+9>: mov rdx,QWORD PTR [rip+0x4f28] # 0x406018
0x00000001004010f0 <+16>: xor r11d,r11d
0x00000001004010f3 <+19>: mov r10d,0x1
0x00000001004010f9 <+25>: mov r8,QWORD PTR [rdx+0x18]
0x00000001004010fd <+29>: lea r9,[rcx+r8*1]
0x0000000100401101 <+33>: cmp r9,0xfe0
0x0000000100401108 <+40>: ja 0x100401134 <gc_malloc+84>
0x000000010040110a <+42>: mov rax,r8
@retep998
retep998 / spaceheater.cpp
Created December 12, 2013 00:27
Space Heater
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <string>
#include <iostream>
#include <thread>
#include <random>
#include <algorithm>
@retep998
retep998 / gist:7672754
Created November 27, 2013 09:02
double vs int for iteration
#include <iostream>
#include <chrono>
#include <array>
using namespace std;
using namespace chrono;
std::array<double, 0x1000> a;
void doubletest() {
double sum = 0;
@retep998
retep998 / runtime.cpp
Created November 24, 2013 06:51
Basic runtime example
#include "runtime.hpp"
#include <iostream>
struct special {
void fuck() {
std::cout << "Wheeeeeee" << std::endl;
}
};
template <typename T>
class numerical_iterator {
public:
numerical_iterator() : m_value {} {
}
numerical_iterator(numerical_iterator const & o) : m_value {o.m_value} {
}
numerical_iterator(numerical_iterator && o) : m_value {o.m_value} {