view lphobos/typeinfo1/ti_dchar.d @ 978:6a32d2e18175

Fix a latent bug in the asm code. I think that technically, using "*m0" instead of "*0" allows LLVM to pick between using the same memory as output 0 and using a new memory location. (So far I haven't been able to construct a testcase that actually breaks because of this, though)
author Frits van Bommel <fvbommel wxs.nl>
date Wed, 18 Feb 2009 03:38:12 +0100
parents 2c3cd3596187
children
line wrap: on
line source


// dchar

module typeinfo1.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];
    }
}