Mercurial > projects > ldc
view test/assign.d @ 237:a168a2c3ea48 trunk
[svn r253] Removed -inlineasm option. inline asm is now enabled by default unless the new -noasm option is passed.
Tried adding a stack trace print when compiler crashes, not sure it's working though.
Changed data layouts to match that of llvm-gcc.
Fixed casting function pointers.
Added support checks in AsmStatement.
author | lindquist |
---|---|
date | Sun, 08 Jun 2008 19:09:24 +0200 |
parents | c53b6e3fe49a |
children |
line wrap: on
line source
module assign; // this is taken from std.intrinsic from gdc int mybtc(uint *p, uint bitnum) { uint * q = p + (bitnum / (uint.sizeof*8)); uint mask = 1 << (bitnum & ((uint.sizeof*8) - 1)); int result = *q & mask; *q ^= mask; return result ? -1 : 0; } void main() { uint i = 0xFFFF_FFFF; int r = mybtc(&i, 31); assert(r); assert(i == 0x7FFF_FFFF); r = mybtc(&i, 31); assert(!r); assert(i == 0xFFFF_FFFF); }