Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1215 from denis-sh/style-fixup-pull-1208
Browse files Browse the repository at this point in the history
[Whitespace] Style fixup for pull #1208.
  • Loading branch information
MartinNowak committed Apr 20, 2015
2 parents d8c98b8 + bfc0906 commit e8aa524
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/core/atomic.d
Expand Up @@ -218,15 +218,15 @@ else version( AsmX86_32 )
//
// += -= *= /= %= ^^= &=
// |= ^= <<= >>= >>>= ~=
static if( op == "+=" && __traits(isIntegral, T) && T.sizeof <= 4 && V1.sizeof <= 4) {
static if( op == "+=" && __traits(isIntegral, T) && T.sizeof <= 4 && V1.sizeof <= 4)
{
return cast(T)(atomicFetchAdd!(T)(val, mod) + mod);
}
else
static if( op == "-=" && __traits(isIntegral, T) && T.sizeof <= 4 && V1.sizeof <= 4) {
else static if( op == "-=" && __traits(isIntegral, T) && T.sizeof <= 4 && V1.sizeof <= 4)
{
return cast(T)(atomicFetchSub!(T)(val, mod) - mod);
}
else
static if( op == "+=" || op == "-=" || op == "*=" || op == "/=" ||
else static if( op == "+=" || op == "-=" || op == "*=" || op == "/=" ||
op == "%=" || op == "^^=" || op == "&=" || op == "|=" ||
op == "^=" || op == "<<=" || op == ">>=" || op == ">>>=" ) // skip "~="
{
Expand Down Expand Up @@ -736,15 +736,15 @@ else version( AsmX86_64 )
//
// += -= *= /= %= ^^= &=
// |= ^= <<= >>= >>>= ~=
static if( op == "+=" && __traits(isIntegral, T) && __traits(isIntegral, V1)) {
static if( op == "+=" && __traits(isIntegral, T) && __traits(isIntegral, V1))
{
return cast(T)(atomicFetchAdd!(T)(val, mod) + mod);
}
else
static if( op == "-=" && __traits(isIntegral, T) && __traits(isIntegral, V1)) {
else static if( op == "-=" && __traits(isIntegral, T) && __traits(isIntegral, V1))
{
return cast(T)(atomicFetchSub!(T)(val, mod) - mod);
}
else
static if( op == "+=" || op == "-=" || op == "*=" || op == "/=" ||
else static if( op == "+=" || op == "-=" || op == "*=" || op == "/=" ||
op == "%=" || op == "^^=" || op == "&=" || op == "|=" ||
op == "^=" || op == "<<=" || op == ">>=" || op == ">>>=" ) // skip "~="
{
Expand Down Expand Up @@ -1523,14 +1523,15 @@ version( unittest )
shared byte i8 = 5;
shared short i16 = 6;
shared int i32 = 7;

assert(atomicOp!"+="(u8, 8) == 9);
assert(atomicOp!"+="(u16, 8) == 10);
assert(atomicOp!"+="(u32, 8) == 11);
assert(atomicOp!"+="(i8, 8) == 13);
assert(atomicOp!"+="(i16, 8) == 14);
assert(atomicOp!"+="(i32, 8) == 15);
version( AsmX86_64 ) {
version( AsmX86_64 )
{
shared ulong u64 = 4;
shared long i64 = 8;
assert(atomicOp!"+="(u64, 8) == 12);
Expand All @@ -1553,7 +1554,8 @@ version( unittest )
assert(atomicOp!"-="(i8, 1) == 4);
assert(atomicOp!"-="(i16, 1) == 5);
assert(atomicOp!"-="(i32, 1) == 6);
version( AsmX86_64 ) {
version( AsmX86_64 )
{
shared ulong u64 = 4;
shared long i64 = 8;
assert(atomicOp!"-="(u64, 1) == 3);
Expand Down

0 comments on commit e8aa524

Please sign in to comment.