Mercurial > projects > ldc
comparison lphobos/internal/arrays.d @ 52:0c77619e803b trunk
[svn r56] Initial support for TypeInfo.
Enums not work.
Several other bugfixes.
author | lindquist |
---|---|
date | Tue, 23 Oct 2007 05:55:12 +0200 |
parents | 8b0e809563df |
children | b688ad419f8c |
comparison
equal
deleted
inserted
replaced
51:61bc1b4ad3c4 | 52:0c77619e803b |
---|---|
83 if (lhs is rhs) | 83 if (lhs is rhs) |
84 return false; | 84 return false; |
85 return memcmp(lhs,rhs,bytesize) != 0; | 85 return memcmp(lhs,rhs,bytesize) != 0; |
86 } | 86 } |
87 | 87 |
88 bool _d_dyn_array_eq(void[] lhs, void[] rhs) | |
89 { | |
90 if (lhs.length != rhs.length) | |
91 return false; | |
92 else if (lhs is rhs) | |
93 return true; | |
94 return memcmp(lhs.ptr,rhs.ptr,lhs.length) == 0; | |
95 } | |
96 | |
97 bool _d_dyn_array_neq(void[] lhs, void[] rhs) | |
98 { | |
99 if (lhs.length != rhs.length) | |
100 return true; | |
101 else if (lhs is rhs) | |
102 return false; | |
103 return memcmp(lhs.ptr,rhs.ptr,lhs.length) != 0; | |
104 } | |
105 | |
106 // for array cast | |
107 size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) | |
108 { | |
109 if (newelemsz == 1) { | |
110 return len*elemsz; | |
111 } | |
112 else if (len % newelemsz) { | |
113 throw new Exception("Bad array cast"); | |
114 } | |
115 return (len*elemsz)/newelemsz; | |
116 } |