view lphobos/std/stdarg.d @ 983:6e68054cfc20

Fix out-ouf-source build for runtime as well. To build out-of-source, follow these steps: # [[Insert LLVM build instructions here]] mkdir my_build_dir cd my_build_dir svn co http://svn.dsource.org/projects/tango/trunk tango ccmake <PATH_TO_SOURCE> # (Regular ccmake stuff, press 'c' a few times followed by 'g') make make runtime # add `PWD`/bin to PATH closes #213
author Frits van Bommel <fvbommel wxs.nl>
date Thu, 19 Feb 2009 11:01:34 +0100
parents eef8ac26c66c
children
line wrap: on
line source


/*
 * Placed in public domain.
 * Written by Hauke Duden and Walter Bright
 */

/* This is for use with variable argument lists with extern(D) linkage. */

/* Modified for LDC (LLVM D Compiler) by Tomas Lindquist Olsen, 2007 */

module std.stdarg;

alias void* va_list;

T va_arg(T)(ref va_list vp)
{
    size_t size = T.sizeof > size_t.sizeof ? size_t.sizeof : T.sizeof;
    va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) &  ~(size - 1));
    vp = vptmp + T.sizeof;
    return *cast(T*)vptmp;
}