Mercurial > projects > ldc
view test/assign.d @ 38:27b2f40bdb58 trunk
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
Fiddled a bit the the testing system.
Added a very simple SDL graphics demo.
author | lindquist |
---|---|
date | Wed, 10 Oct 2007 06:16:48 +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); }