Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- a/tango/tango/core/Vararg.d Sat Jun 14 06:13:35 2008 +0200 +++ b/tango/tango/core/Vararg.d Sat Jun 14 17:28:13 2008 +0200 @@ -36,10 +36,13 @@ */ 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; +// 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; + T* arg = cast(T*) vp; + vp = cast(va_list) ( cast(void*) vp + ( ( T.sizeof + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) ); + return *arg; } } else