1 2 // cdouble 3 4 module rt.compiler.gdc.typeinfo.ti_cdouble; 5 private import rt.compiler.util.hash; 6 7 class TypeInfo_r : TypeInfo 8 { 9 override char[] toString() { return "cdouble"; } 10 11 override hash_t getHash(in void* p) 12 { 13 return rt_hash_str(p,cdouble.sizeof,0); 14 } 15 16 static equals_t _equals(cdouble f1, cdouble f2) 17 { 18 return f1 == f2; 19 } 20 21 static int _compare(cdouble f1, cdouble f2) 22 { int result; 23 24 if (f1.re < f2.re) 25 result = -1; 26 else if (f1.re > f2.re) 27 result = 1; 28 else if (f1.im < f2.im) 29 result = -1; 30 else if (f1.im > f2.im) 31 result = 1; 32 else 33 result = 0; 34 return result; 35 } 36 37 override equals_t equals(in void* p1, in void* p2) 38 { 39 return _equals(*cast(cdouble *)p1, *cast(cdouble *)p2); 40 } 41 42 override int compare(in void* p1, in void* p2) 43 { 44 return _compare(*cast(cdouble *)p1, *cast(cdouble *)p2); 45 } 46 47 override size_t talign() 48 { 49 return cdouble.alignof; 50 } 51 52 override size_t tsize() 53 { 54 return cdouble.sizeof; 55 } 56 57 override void swap(void *p1, void *p2) 58 { 59 cdouble t; 60 61 t = *cast(cdouble *)p1; 62 *cast(cdouble *)p1 = *cast(cdouble *)p2; 63 *cast(cdouble *)p2 = t; 64 } 65 66 override void[] init() 67 { static cdouble r; 68 69 return (cast(cdouble *)&r)[0 .. 1]; 70 } 71 72 version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2) 73 { 74 return 0; 75 } 76 }