Skip to content

Instantly share code, notes, and snippets.

View gnuvince's full-sized avatar

Vincent Foley gnuvince

View GitHub Profile
impl <'a> IntoIterator for &'a Bitmap {
type Item = u16;
type IntoIter = SharedBitmapIterator<'a>;
fn into_iter(self) -> Self::IntoIter {
return SharedBitmapIterator { offset: 0, bitmap: &self };
}
}
impl IntoIterator for Bitmap {
type Item = u16;
extern crate rayon;
use rayon::prelude::*;
use std::time::Instant;
fn collatz(mut x: u64) -> usize {
let mut steps = 0;
while x != 1 {
if x % 2 == 0 {
x /= 2;
iload_0 ; [a]
iconst_1 ; [a, 1]
ieq ; [a==1]
dup ; [a==1, a==1]
jmp_nonzero OR ; [a==1]
drop ; []
iload_1 ; [b]
OR:
istore_2 ; []
iload_2 ; [c]
/* C code */
int add(int x, int y) {
return x+y;
}
void caller() {
int a = add(3, 4);
}
@gnuvince
gnuvince / sob.c
Last active December 29, 2018 16:17
#include <err.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#define CACHE_LINES 64
fn deserialize_deals<'de, D>(de: D) -> ::std::result::Result<HashMap<u8, BTreeSet<String>>, D::Error>
where D: Deserializer<'de>
{
struct DealsVisitor;
impl<'de> Visitor<'de> for DealsVisitor {
type Value = HashMap<u8, BTreeSet<String>>;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Seeded DCSS version 0.23.2 (console) character file.
Game seed: 18127138284784505733
1676291 gotm the Invulnerable (level 27, 271/271 HPs)
Began as a Minotaur Gladiator on July 28, 2019.
Was a High Priest of Trog.
Escaped with the Orb
... and 3 runes on July 30, 2019!