Skip to content

Commit

Permalink
Indentation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
monarchdodra committed Oct 20, 2013
1 parent 97e1fb8 commit f0f2c6f
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions std/algorithm.d
Expand Up @@ -1942,19 +1942,20 @@ if (isMutable!T && !is(typeof(T.init.proxySwap(T.init))))
{
static if (!isAssignable!T || hasElaborateAssign!T)
{
if (&lhs != &rhs) {
// For structs with non-trivial assignment, move memory directly
// First check for undue aliasing
assert(!pointsTo(lhs, rhs) && !pointsTo(rhs, lhs)
&& !pointsTo(lhs, lhs) && !pointsTo(rhs, rhs));
// Swap bits
ubyte[T.sizeof] t = void;
auto a = (cast(ubyte*) &lhs)[0 .. T.sizeof];
auto b = (cast(ubyte*) &rhs)[0 .. T.sizeof];
t[] = a[];
a[] = b[];
b[] = t[];
}
if (&lhs != &rhs)
{
// For structs with non-trivial assignment, move memory directly
// First check for undue aliasing
assert(!pointsTo(lhs, rhs) && !pointsTo(rhs, lhs)
&& !pointsTo(lhs, lhs) && !pointsTo(rhs, rhs));
// Swap bits
ubyte[T.sizeof] t = void;
auto a = (cast(ubyte*) &lhs)[0 .. T.sizeof];
auto b = (cast(ubyte*) &rhs)[0 .. T.sizeof];
t[] = a[];
a[] = b[];
b[] = t[];
}
}
else
{
Expand Down

0 comments on commit f0f2c6f

Please sign in to comment.