Skip to content

Instantly share code, notes, and snippets.

View chmike's full-sized avatar

Christophe Meessen chmike

View GitHub Profile
@chmike
chmike / IncrementalStats.h
Created December 12, 2012 09:19
Compute incrementally mean and std dev
#include <cmath>
//! One kibibyte unit size (see http://en.wikipedia.org/wiki/Kibibyte)
const size_t KiB = 1024;
//! One mebibyte unit size (see http://en.wikipedia.org/wiki/Mebibyte)
const size_t MiB = 1024*1024;
//! Convert timeval structure to a double
double toDbl( struct timeval& t )
@chmike
chmike / PrintHex.h
Created December 12, 2012 09:15
Print binary data in haxadecimal
#ifndef PRINTHEX_H
#define PRINTHEX_H
#include <stdio.h>
// Display data in hexadecimal
inline void printHex( const void* data, size_t len, const char* margin )
{
if( len == 0 )
{