view tango/lib/compiler/llvmdc/typeinfo/ti_dchar.d @ 213:7816aafeea3c trunk

[svn r229] Updated the object.d implementation to the latest Tango. Fixed a bunch of the built-in typeinfos for arrays, they did not inherit TypeInfo_Array. Applied patch to tango/text/convert/Layout.d by fvbommel, closes #47 . Cleaned up some type code. Replaced uses of llvm::Type with LLType (a typedef), same for Value and Constant. Fixed a few cases where typeinfo for user structs could be emitted multiple times, seems to still be some cases of this :/
author lindquist
date Fri, 30 May 2008 19:32:04 +0200
parents 1700239cab2e
children
line wrap: on
line source


// dchar

module typeinfo.ti_dchar;

class TypeInfo_w : TypeInfo
{
    char[] toString() { return "dchar"; }

    hash_t getHash(void *p)
    {
        return *cast(dchar *)p;
    }

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

    int compare(void *p1, void *p2)
    {
        return *cast(dchar *)p1 - *cast(dchar *)p2;
    }

    size_t tsize()
    {
        return dchar.sizeof;
    }

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

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

    void[] init()
    {   static dchar c;

        return (cast(dchar *)&c)[0 .. 1];
    }
}