Mercurial > projects > ldc
annotate lphobos/std/stdarg.d @ 228:52d1e9d27dc6 trunk
[svn r244] added another asm test.
author | lindquist |
---|---|
date | Sat, 07 Jun 2008 19:20:15 +0200 |
parents | 5825d48b27d1 |
children | eef8ac26c66c |
rev | line source |
---|---|
65 | 1 |
2 /* | |
3 * Placed in public domain. | |
4 * Written by Hauke Duden and Walter Bright | |
5 */ | |
6 | |
7 /* This is for use with variable argument lists with extern(D) linkage. */ | |
8 | |
131 | 9 /* Modified for LLVMDC (LLVM D Compiler) by Tomas Lindquist Olsen, 2007 */ |
10 | |
65 | 11 module std.stdarg; |
12 | |
13 alias void* va_list; | |
14 | |
131 | 15 T va_arg(T)(ref va_list vp) |
65 | 16 { |
131 | 17 size_t size = T.sizeof > size_t.sizeof ? size_t.sizeof : T.sizeof; |
18 va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) & ~(size - 1)); | |
70
fb265a6efea1
[svn r74] Fixed passing types with different alignment to D-style variadic functions.
lindquist
parents:
65
diff
changeset
|
19 vp = vptmp + T.sizeof; |
65 | 20 return *cast(T*)vptmp; |
21 } |