1 /*
2 * Copyright (C) 2004-2005 by Digital Mars, www.digitalmars.com
3 * Written by Walter Bright
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, in both source and binary form, subject to the following
12 * restrictions:
13 *
14 * o The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this software
16 * in a product, an acknowledgment in the product documentation would be
17 * appreciated but is not required.
18 * o Altered source versions must be plainly marked as such, and must not
19 * be misrepresented as being the original software.
20 * o This notice may not be removed or altered from any source
21 * distribution.
22 */23 24 modulert.compiler.ldc.typeinfo.ti_Acfloat;
25 26 privateimportrt.compiler.ldc.typeinfo.ti_cfloat;
27 privateimportrt.compiler.util.hash;
28 29 // cfloat[]30 31 classTypeInfo_Aq : TypeInfo_Array32 {
33 overridechar[] toString() { return"cfloat[]"; }
34 35 overridehash_tgetHash(invoid* p) {
36 cfloat[] s = *cast(cfloat[]*)p;
37 size_tlen = s.length;
38 cfloat *str = s.ptr;
39 returnrt_hash_str(str,len*cfloat.sizeof,0);
40 }
41 42 overrideequals_tequals(invoid* p1, invoid* p2)
43 {
44 cfloat[] s1 = *cast(cfloat[]*)p1;
45 cfloat[] s2 = *cast(cfloat[]*)p2;
46 size_tlen = s1.length;
47 48 if (len != s2.length)
49 returnfalse;
50 for (size_tu = 0; u < len; u++)
51 {
52 if (!TypeInfo_q._equals(s1[u], s2[u]))
53 returnfalse;
54 }
55 returntrue;
56 }
57 58 overrideintcompare(invoid* p1, invoid* p2)
59 {
60 cfloat[] s1 = *cast(cfloat[]*)p1;
61 cfloat[] s2 = *cast(cfloat[]*)p2;
62 size_tlen = s1.length;
63 64 if (s2.length < len)
65 len = s2.length;
66 for (size_tu = 0; u < len; u++)
67 {
68 intc = TypeInfo_q._compare(s1[u], s2[u]);
69 if (c)
70 returnc;
71 }
72 if (s1.length < s2.length)
73 return -1;
74 elseif (s1.length > s2.length)
75 return1;
76 return0;
77 }
78 79 overridesize_ttalign()
80 {
81 return (cfloat[]).alignof;
82 }
83 84 overridesize_ttsize()
85 {
86 return (cfloat[]).sizeof;
87 }
88 89 overrideuintflags()
90 {
91 return1;
92 }
93 94 overrideTypeInfonext()
95 {
96 returntypeid(cfloat);
97 }
98 }