Skip to content

Instantly share code, notes, and snippets.

View xavierd's full-sized avatar

Xavier Deguillard xavierd

  • Facebook
  • San Francisco Bay Area
View GitHub Profile
#[cfg(test)]
mod tests {
use twox_hash::XxHash32;
use std::hash::Hasher;
fn xxhash32<T: AsRef<[u8]>>(buf: T) -> u64 {
let mut xx = XxHash32::default();
xx.write(buf.as_ref());
xx.finish()
}
@xavierd
xavierd / complete.cc
Created December 29, 2010 15:20
Hacking with libclang completion.
#include <clang-c/Index.h>
#include <cstdlib>
#include <iostream>
/*
* Compile with:
* g++ complete.cc -o complete -lclang -L/usr/lib/llvm
* Run with:
* LIBCLANG_TIMING=1 ./complete file.cc line column [clang args...]
*/
let rec fact = function
0 -> 1
| n -> n * fact (n - 1)