Mercurial > projects > ldc
comparison tango/tango/core/Vararg.d @ 264:a9dae3da4e87 trunk
[svn r285] Fixed D -> bool LLVM helper for floating point values.
Changed the way D-style varargs are passed, now each param should be aligned to size_t.sizeof.
author | lindquist |
---|---|
date | Sat, 14 Jun 2008 17:28:13 +0200 |
parents | a27941d00351 |
children |
comparison
equal
deleted
inserted
replaced
263:2be09ee06bc7 | 264:a9dae3da4e87 |
---|---|
34 * The next argument in the sequence. The result is undefined if vp | 34 * The next argument in the sequence. The result is undefined if vp |
35 * does not point to a valid argument. | 35 * does not point to a valid argument. |
36 */ | 36 */ |
37 T va_arg(T)(ref va_list vp) | 37 T va_arg(T)(ref va_list vp) |
38 { | 38 { |
39 size_t size = T.sizeof > size_t.sizeof ? size_t.sizeof : T.sizeof; | 39 // size_t size = T.sizeof > size_t.sizeof ? size_t.sizeof : T.sizeof; |
40 va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) & ~(size - 1)); | 40 // va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) & ~(size - 1)); |
41 vp = vptmp + T.sizeof; | 41 // vp = vptmp + T.sizeof; |
42 return *cast(T*)vptmp; | 42 // return *cast(T*)vptmp; |
43 T* arg = cast(T*) vp; | |
44 vp = cast(va_list) ( cast(void*) vp + ( ( T.sizeof + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) ); | |
45 return *arg; | |
43 } | 46 } |
44 } | 47 } |
45 else | 48 else |
46 { | 49 { |
47 /** | 50 /** |