comparison lphobos/internal/arrays.d @ 40:8b0e809563df trunk

[svn r44] Lots of bug fixes. New array literal support New array ~= operator support (for single element) New with statement support More...
author lindquist
date Fri, 19 Oct 2007 07:43:21 +0200
parents c53b6e3fe49a
children 0c77619e803b
comparison
equal deleted inserted replaced
39:fd5e8bbfcb25 40:8b0e809563df
1 module internal.arrays; 1 module internal.arrays;
2 2
3 extern(C): 3 extern(C):
4
5 // per-element array init routines
4 6
5 void _d_array_init_i1(bool* a, size_t n, bool v) 7 void _d_array_init_i1(bool* a, size_t n, bool v)
6 { 8 {
7 auto p = a; 9 auto p = a;
8 auto end = a+n; 10 auto end = a+n;
63 auto p = a; 65 auto p = a;
64 auto end = a+n; 66 auto end = a+n;
65 while (p !is end) 67 while (p !is end)
66 *p++ = v; 68 *p++ = v;
67 } 69 }
70
71 // array comparison routines
72 int memcmp(void*,void*,size_t);
73
74 bool _d_static_array_eq(void* lhs, void* rhs, size_t bytesize)
75 {
76 if (lhs is rhs)
77 return true;
78 return memcmp(lhs,rhs,bytesize) == 0;
79 }
80
81 bool _d_static_array_neq(void* lhs, void* rhs, size_t bytesize)
82 {
83 if (lhs is rhs)
84 return false;
85 return memcmp(lhs,rhs,bytesize) != 0;
86 }
87