view tango/lib/compiler/llvmdc/typeinfo/ti_delegate.d @ 314:8d98e42ece93 trunk

[svn r335] The basics of exception handling are in place. Still need to make sure calls are turned into invokes everywhere. (NewExpression for instance) Still some rough edges and corner cases to figure out. Needs testing!
author ChristianK
date Wed, 02 Jul 2008 22:20:18 +0200
parents 1700239cab2e
children
line wrap: on
line source


// delegate

module typeinfo.ti_delegate;

alias void delegate(int) dg;

class TypeInfo_D : TypeInfo
{
    hash_t getHash(void *p)
    {   long l = *cast(long *)p;

        return cast(uint)(l + (l >> 32));
    }

    int equals(void *p1, void *p2)
    {
        return *cast(dg *)p1 == *cast(dg *)p2;
    }

    size_t tsize()
    {
        return dg.sizeof;
    }

    void swap(void *p1, void *p2)
    {
        dg t;

        t = *cast(dg *)p1;
        *cast(dg *)p1 = *cast(dg *)p2;
        *cast(dg *)p2 = t;
    }

    uint flags()
    {
        return 1;
    }
}