mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-05-02 08:21:29 +02:00
[svn r293] Fixed: object.TypeInfo_Struct implementation was incorrect.
This commit is contained in:
@@ -761,7 +761,7 @@ class TypeInfo_Struct : TypeInfo
|
|||||||
// A sorry hash algorithm.
|
// A sorry hash algorithm.
|
||||||
// Should use the one for strings.
|
// Should use the one for strings.
|
||||||
// BUG: relies on the GC not moving objects
|
// BUG: relies on the GC not moving objects
|
||||||
for (size_t i = 0; i < init.length; i++)
|
for (size_t i = 0; i < m_init.length; i++)
|
||||||
{ h = h * 9 + *cast(ubyte*)p;
|
{ h = h * 9 + *cast(ubyte*)p;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@@ -769,7 +769,7 @@ class TypeInfo_Struct : TypeInfo
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
int equals(void *p2, void *p1)
|
int equals(void *p1, void *p2)
|
||||||
{ int c;
|
{ int c;
|
||||||
|
|
||||||
if (p1 == p2)
|
if (p1 == p2)
|
||||||
@@ -780,11 +780,11 @@ class TypeInfo_Struct : TypeInfo
|
|||||||
c = (*xopEquals)(p1, p2);
|
c = (*xopEquals)(p1, p2);
|
||||||
else
|
else
|
||||||
// BUG: relies on the GC not moving objects
|
// BUG: relies on the GC not moving objects
|
||||||
c = (memcmp(p1, p2, init.length) == 0);
|
c = (memcmp(p1, p2, m_init.length) == 0);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int compare(void *p2, void *p1)
|
int compare(void *p1, void *p2)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
@@ -798,7 +798,7 @@ class TypeInfo_Struct : TypeInfo
|
|||||||
c = (*xopCmp)(p1, p2);
|
c = (*xopCmp)(p1, p2);
|
||||||
else
|
else
|
||||||
// BUG: relies on the GC not moving objects
|
// BUG: relies on the GC not moving objects
|
||||||
c = memcmp(p1, p2, init.length);
|
c = memcmp(p1, p2, m_init.length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c = -1;
|
c = -1;
|
||||||
@@ -808,7 +808,7 @@ class TypeInfo_Struct : TypeInfo
|
|||||||
|
|
||||||
size_t tsize()
|
size_t tsize()
|
||||||
{
|
{
|
||||||
return init.length;
|
return m_init.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void[] init() { return m_init; }
|
void[] init() { return m_init; }
|
||||||
@@ -816,7 +816,7 @@ class TypeInfo_Struct : TypeInfo
|
|||||||
uint flags() { return m_flags; }
|
uint flags() { return m_flags; }
|
||||||
|
|
||||||
char[] name;
|
char[] name;
|
||||||
void[] m_init; // initializer; init.ptr == null if 0 initialize
|
void[] m_init; // initializer; never null
|
||||||
|
|
||||||
hash_t function(void*) xtoHash;
|
hash_t function(void*) xtoHash;
|
||||||
int function(void*,void*) xopEquals;
|
int function(void*,void*) xopEquals;
|
||||||
|
|||||||
Reference in New Issue
Block a user