Skip to content

Instantly share code, notes, and snippets.

View gchatelet's full-sized avatar

Guillaume Chatelet gchatelet

  • Google
  • Paris, France
View GitHub Profile
@gchatelet
gchatelet / gist:1330473
Created November 1, 2011 13:17
NULL definition within stddef.h
/* A null pointer constant. */
#if defined (_STDDEF_H) || defined (__need_NULL)
#undef NULL /* in case <stdio.h> has defined it. */
#ifdef __GNUG__
#define NULL __null
#else /* G++ */
#ifndef __cplusplus
#define NULL ((void *)0)
#else /* C++ */
@gchatelet
gchatelet / gist:1330474
Created November 1, 2011 13:17
NULL definition within stddef.h
/* A null pointer constant. */
#if defined (_STDDEF_H) || defined (__need_NULL)
#undef NULL /* in case <stdio.h> has defined it. */
#ifdef __GNUG__
#define NULL __null
#else /* G++ */
#ifndef __cplusplus
#define NULL ((void *)0)
#else /* C++ */
struct VertexPosUv0 {
glm::vec3 position;
glm::vec2 uv0;
VertexPosUv0(glm::vec3 pos) :
position(pos) {
}
VertexPosUv0(glm::vec3 pos, glm::vec2 uv0) :
position(pos), uv0(uv0) {
}
};
/*
* Pool.h
*
* Created on: Feb 12, 2013
* Author: Guillaume Chatelet
*/
#ifndef POOL_H_
#define POOL_H_
import org.restlet.Application;
import org.restlet.Server;
import org.restlet.data.Protocol;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
public class SimpleServer extends Application {
public static void main(String[] args) throws Exception {
new Server(Protocol.HTTP, 8111, GreetingResource.class).start();
}
#include <algorithm>
#include <chrono>
#include <future>
#include <thread>
#include <vector>
using namespace std;
using namespace std::chrono;
struct StopWatch {
// g++ ~/template_test.cc -c && nm template_test.o
struct A {};
struct B {};
template<typename TC>
struct C {
TC foo(TC) {}
};
version(linux):
extern(C++) {
struct elem9 { }
void foobar9(elem9*, elem9*);
static assert(foobar9.mangleof == "_Z7foobar9P5elem9S0_");
}
extern (C++)
{
// DO NOT EDIT MANUALLY
// This code is autogenerated.
// Have a look at test/cpp_mangling_tools/README.md for more informations.
import core.stdc.config;
version(linux):
static if(ptrdiff_t.sizeof == 8): // Only for 64 bits systems
struct S {}
@gchatelet
gchatelet / gist:a8a2c953c598a1eeaf84c9109064e828
Last active May 7, 2016 21:48
dmd / gdc / ldc assembler for putBlocks function for murmurhash3 x86_64
Code is here:
https://github.com/gchatelet/phobos/blob/murmurhash3/std/digest/murmurhash.d#L97
###############
## dmd putBlock
###############
000000000049e158 <_D3std6digest10murmurhash65__T9putBlocksTS3std6digest10murmurhash20SMurmurHash3_x64_128TG2mZ9putBlocksFNaNbNiNfKS3std6digest10murmurhash20SMurmurHash3_x64_128MxAG2mX9__lambda3FNaNbNiNeKS3std6digest10murmurhash20SMurmurHash3_x64_128MxAG2mXv>:
49e158: 48 83 ec 28 sub $0x28,%rsp
49e15c: 4c 89 24 24 mov %r12,(%rsp)
49e160: 4c 89 6c 24 08 mov %r13,0x8(%rsp)