1/** 2 * TypeInfo support code. 3 * 4 * Copyright: Copyright Digital Mars 2004 - 2009. 5 * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). 6 * Authors: Walter Bright 7 */ 8 9/* Copyright Digital Mars 2004 - 2009. 10 * Distributed under the Boost Software License, Version 1.0. 11 * (See accompanying file LICENSE or copy at 12 * http://www.boost.org/LICENSE_1_0.txt) 13 */ 14module rt.typeinfo.ti_double; 15 16private import rt.util.typeinfo; 17 18// double 19 20class TypeInfo_d : TypeInfo 21{ 22 pure: 23 nothrow: 24 @safe: 25 26 alias F = double; 27 28 override string toString() const { return F.stringof; } 29 30 override size_t getHash(scope const void* p) const @trusted 31 { 32 return Floating!F.hashOf(*cast(F*)p); 33 } 34 35 override bool equals(in void* p1, in void* p2) const @trusted 36 { 37 return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); 38 } 39 40 override int compare(in void* p1, in void* p2) const @trusted 41 { 42 return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); 43 } 44 45 override @property size_t tsize() const 46 { 47 return F.sizeof; 48 } 49 50 override void swap(void *p1, void *p2) const @trusted 51 { 52 F t = *cast(F*)p1; 53 *cast(F*)p1 = *cast(F*)p2; 54 *cast(F*)p2 = t; 55 } 56 57 override const(void)[] initializer() const @trusted 58 { 59 static immutable F r; 60 return (&r)[0 .. 1]; 61 } 62 63 override @property size_t talign() const 64 { 65 return F.alignof; 66 } 67 68 version (Windows) 69 { 70 } 71 else version (X86_64) 72 { 73 // 2 means arg to function is passed in XMM registers 74 override @property uint flags() const { return 2; } 75 } 76} 77