Mercurial > projects > ldc
view druntime/src/compiler/ldc/memset.d @ 1463:a5526b7a5ae6
D2:
Applied function type from D1 frontend that got removed in D2, it's critical for member function type to be correct.
Fixed a bunch of type discrepancies in druntime object.di vs. genobj.d .
Disabled (#if 0) some potentally very large type dumps for -vv .
Updated classinfo and typeinfo generation for D2, almost complete now.
Added finer grained checks for vtbl type mismatching, aids debugging.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Wed, 03 Jun 2009 02:28:48 +0200 |
parents | e0b2d67cfe7c |
children |
line wrap: on
line source
/** * Contains a memset implementation used by compiler-generated code. * * Copyright: Copyright Digital Mars 2004 - 2009. * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>. * Authors: Walter Bright * * Copyright Digital Mars 2004 - 2009. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ module rt.memset; extern (C) { // Functions from the C library. void *memcpy(void *, void *, size_t); } extern (C): short *_memset16(short *p, short value, size_t count) { short *pstart = p; short *ptop; for (ptop = &p[count]; p < ptop; p++) *p = value; return pstart; } int *_memset32(int *p, int value, size_t count) { version (X86) { asm { mov EDI,p ; mov EAX,value ; mov ECX,count ; mov EDX,EDI ; rep ; stosd ; mov EAX,EDX ; } } else { int *pstart = p; int *ptop; for (ptop = &p[count]; p < ptop; p++) *p = value; return pstart; } } long *_memset64(long *p, long value, size_t count) { long *pstart = p; long *ptop; for (ptop = &p[count]; p < ptop; p++) *p = value; return pstart; } cdouble *_memset128(cdouble *p, cdouble value, size_t count) { cdouble *pstart = p; cdouble *ptop; for (ptop = &p[count]; p < ptop; p++) *p = value; return pstart; } real *_memset80(real *p, real value, size_t count) { real *pstart = p; real *ptop; for (ptop = &p[count]; p < ptop; p++) *p = value; return pstart; } creal *_memset160(creal *p, creal value, size_t count) { creal *pstart = p; creal *ptop; for (ptop = &p[count]; p < ptop; p++) *p = value; return pstart; } void *_memsetn(void *p, void *value, int count, size_t sizelem) { void *pstart = p; int i; for (i = 0; i < count; i++) { memcpy(p, value, sizelem); p = cast(void *)(cast(char *)p + sizelem); } return pstart; }