view lphobos/typeinfo1/ti_short.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


// short

module typeinfo1.ti_short;

class TypeInfo_s : TypeInfo
{
    char[] toString() { return "short"; }

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

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

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

    size_t tsize()
    {
	return short.sizeof;
    }

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

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