view lphobos/typeinfo1/ti_cdouble.d @ 715:30b42a283c8e

Removed TypeOpaque from DMD. Changed runtime functions taking opaque[] to void[]. Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[]. Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86. Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing. Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way... Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8. Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 22 Oct 2008 14:55:33 +0200
parents 79c9ac745fbc
children
line wrap: on
line source


// cdouble

module typeinfo1.ti_cdouble;

class TypeInfo_r : TypeInfo
{
    char[] toString() { return "cdouble"; }

    hash_t getHash(void *p)
    {
	return (cast(uint *)p)[0] + (cast(uint *)p)[1] +
	       (cast(uint *)p)[2] + (cast(uint *)p)[3];
    }

    static int _equals(cdouble f1, cdouble f2)
    {
	return f1 == f2;
    }

    static int _compare(cdouble f1, cdouble f2)
    {   int result;

	if (f1.re < f2.re)
	    result = -1;
	else if (f1.re > f2.re)
	    result = 1;
	else if (f1.im < f2.im)
	    result = -1;
	else if (f1.im > f2.im)
	    result = 1;
	else
	    result = 0;
        return result;
    }

    int equals(void *p1, void *p2)
    {
	return _equals(*cast(cdouble *)p1, *cast(cdouble *)p2);
    }

    int compare(void *p1, void *p2)
    {
	return _compare(*cast(cdouble *)p1, *cast(cdouble *)p2);
    }

    size_t tsize()
    {
	return cdouble.sizeof;
    }

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

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

    void[] init()
    {	static cdouble r;

	return (cast(cdouble *)&r)[0 .. 1];
    }
}