view runtime/internal/typeinfo/ti_ushort.d @ 1480:b3ba2c6ff038

Use `llvm.memset` instead of `_d_array_init_i1` and `_d_array_init_i8`. This exposes what's happening to LLVM, and memset is probably faster than the runtime functions we were using anyway.
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 07 Jun 2009 13:57:59 +0200
parents 44f08170f4ef
children
line wrap: on
line source


// ushort

module typeinfo.ti_ushort;

class TypeInfo_t : TypeInfo
{
    char[] toString() { return "ushort"; }

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

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

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

    size_t tsize()
    {
	return ushort.sizeof;
    }

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

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