comparison runtime/internal/ldc/vararg.d @ 665:d8a1481eaa0c

Renames.
author Christian Kamm <kamm incasoftware de>
date Mon, 06 Oct 2008 22:56:54 +0200
parents runtime/internal/llvmdc/vararg.d@6aaa3d3c1183
children
comparison
equal deleted inserted replaced
664:eef8ac26c66c 665:d8a1481eaa0c
1 /*
2 * This module holds the implementation of special vararg templates for D style var args.
3 *
4 * Provides the functions tango.core.Vararg expects to be present!
5 */
6
7 module ldc.Vararg;
8
9 // Check for the right compiler
10 version(LDC)
11 {
12 // OK
13 }
14 else
15 {
16 static assert(false, "This module is only valid for LDC");
17 }
18
19 alias void* va_list;
20
21 void va_start(T) ( out va_list ap, inout T parmn )
22 {
23 // not needed !
24 }
25
26 T va_arg(T)(ref va_list vp)
27 {
28 T* arg = cast(T*) vp;
29 // ldc always aligns to size_t.sizeof in vararg lists
30 vp = cast(va_list) ( cast(void*) vp + ( ( T.sizeof + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) );
31 return *arg;
32 }
33
34 void va_end( va_list ap )
35 {
36 // not needed !
37 }
38
39 void va_copy( out va_list dst, va_list src )
40 {
41 // seems pretty useless !
42 dst = src;
43 }