mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 06:30:28 +03:00
phobos 0.99
This commit is contained in:
parent
f86a362105
commit
5b1e376698
10 changed files with 332 additions and 15 deletions
|
@ -95,7 +95,19 @@ bit[] _d_arraycopybit(bit[] from, bit[] to)
|
|||
if (cast(void *)to + nbytes <= cast(void *)from ||
|
||||
cast(void *)from + nbytes <= cast(void *)to)
|
||||
{
|
||||
memcpy(cast(void *)to, cast(void *)from, nbytes);
|
||||
nbytes = to.length / 8;
|
||||
if (nbytes)
|
||||
memcpy(cast(void *)to, cast(void *)from, nbytes);
|
||||
|
||||
if (to.length & 7)
|
||||
{
|
||||
/* Copy trailing bits.
|
||||
*/
|
||||
static ubyte[8] masks = [0,1,3,7,0x0F,0x1F,0x3F,0x7F];
|
||||
ubyte mask = masks[to.length & 7];
|
||||
(cast(ubyte*)to)[nbytes] &= ~mask;
|
||||
(cast(ubyte*)to)[nbytes] |= (cast(ubyte*)from)[nbytes] & mask;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue