Fix line wrap (based on column <= 120)

This commit is contained in:
k-hara 2013-02-23 18:16:01 +09:00
parent acbfceff78
commit e76d200dfa

View file

@ -234,9 +234,8 @@ private template noUnsharedAliasing(T)
private template isSafeTask(F) private template isSafeTask(F)
{ {
enum bool isSafeTask = enum bool isSafeTask =
((functionAttributes!(F) & FunctionAttribute.safe) || (functionAttributes!F & (FunctionAttribute.safe | FunctionAttribute.trusted)) != 0 &&
(functionAttributes!(F) & FunctionAttribute.trusted)) && (functionAttributes!F & FunctionAttribute.ref_) == 0 &&
!(functionAttributes!F & FunctionAttribute.ref_) &&
(isFunctionPointer!F || !hasUnsharedAliasing!F) && (isFunctionPointer!F || !hasUnsharedAliasing!F) &&
allSatisfy!(noUnsharedAliasing, ParameterTypeTuple!F); allSatisfy!(noUnsharedAliasing, ParameterTypeTuple!F);
} }
@ -248,13 +247,13 @@ unittest
alias void function(uint, string) @trusted F3; alias void function(uint, string) @trusted F3;
alias void function(uint, char[]) F4; alias void function(uint, char[]) F4;
static assert(isSafeTask!(F1)); static assert( isSafeTask!(F1));
static assert(!isSafeTask!(F2)); static assert(!isSafeTask!(F2));
static assert(isSafeTask!(F3)); static assert( isSafeTask!(F3));
static assert(!isSafeTask!(F4)); static assert(!isSafeTask!(F4));
alias uint[] function(uint, string) pure @trusted F5; alias uint[] function(uint, string) pure @trusted F5;
static assert(isSafeTask!(F5)); static assert( isSafeTask!(F5));
} }
// This function decides whether Tasks that meet all of the other requirements // This function decides whether Tasks that meet all of the other requirements
@ -371,11 +370,8 @@ private template isRoundRobin(T)
unittest unittest
{ {
static assert(isRoundRobin!( static assert( isRoundRobin!(RoundRobinBuffer!(void delegate(char[]), bool delegate())));
RoundRobinBuffer!(void delegate(char[]), bool delegate()) static assert(!isRoundRobin!(uint));
));
static assert(!isRoundRobin!uint);
} }
// This is the base "class" for all of the other tasks. Using C-style // This is the base "class" for all of the other tasks. Using C-style
@ -1413,8 +1409,7 @@ public:
} }
immutable size_t eightSize = 4 * (this.size + 1); immutable size_t eightSize = 4 * (this.size + 1);
auto ret = (rangeLen / eightSize) + auto ret = (rangeLen / eightSize) + ((rangeLen % eightSize == 0) ? 0 : 1);
((rangeLen % eightSize == 0) ? 0 : 1);
return max(ret, 1); return max(ret, 1);
} }
@ -1672,8 +1667,7 @@ public:
} }
else else
{ {
auto buf = uninitializedArray!(MapType!(Args[0], functions)[]) auto buf = uninitializedArray!(MapType!(Args[0], functions)[])(len);
(len);
alias args args2; alias args args2;
alias Args Args2; alias Args Args2;
} }
@ -2332,15 +2326,13 @@ public:
processes them is in queue. This is checked for at compile time processes them is in queue. This is checked for at compile time
and will result in a static assertion failure. and will result in a static assertion failure.
*/ */
auto asyncBuf(C1, C2) auto asyncBuf(C1, C2)(C1 next, C2 empty, size_t initialBufSize = 0, size_t nBuffers = 100)
(C1 next, C2 empty, size_t initialBufSize = 0, size_t nBuffers = 100)
if(is(typeof(C2.init()) : bool) && if(is(typeof(C2.init()) : bool) &&
ParameterTypeTuple!(C1).length == 1 && ParameterTypeTuple!(C1).length == 1 &&
ParameterTypeTuple!(C2).length == 0 && ParameterTypeTuple!(C2).length == 0 &&
isArray!(ParameterTypeTuple!(C1)[0]) isArray!(ParameterTypeTuple!(C1)[0])
) { ) {
auto roundRobin = RoundRobinBuffer!(C1, C2) auto roundRobin = RoundRobinBuffer!(C1, C2)(next, empty, initialBufSize, nBuffers);
(next, empty, initialBufSize, nBuffers);
return asyncBuf(roundRobin, nBuffers / 2); return asyncBuf(roundRobin, nBuffers / 2);
} }
@ -2455,8 +2447,7 @@ public:
} }
else else
{ {
typeof(adjoin!(staticMap!(binaryFun, functions))(e, e)) typeof(adjoin!(staticMap!(binaryFun, functions))(e, e)) seed = void;
seed = void;
foreach (i, T; seed.Types) foreach (i, T; seed.Types)
{ {
auto p = (cast(void*) &seed.expand[i]) auto p = (cast(void*) &seed.expand[i])
@ -2501,8 +2492,7 @@ public:
alias typeof(seed) E; alias typeof(seed) E;
alias typeof(range) R; alias typeof(range) R;
E reduceOnRange E reduceOnRange(R range, size_t lowerBound, size_t upperBound)
(R range, size_t lowerBound, size_t upperBound)
{ {
// This is for exploiting instruction level parallelism by // This is for exploiting instruction level parallelism by
// using multiple accumulator variables within each thread, // using multiple accumulator variables within each thread,
@ -2599,8 +2589,7 @@ public:
workUnitSize = len; workUnitSize = len;
} }
immutable size_t nWorkUnits = (len / workUnitSize) + immutable size_t nWorkUnits = (len / workUnitSize) + ((len % workUnitSize == 0) ? 0 : 1);
((len % workUnitSize == 0) ? 0 : 1);
assert(nWorkUnits * workUnitSize >= len); assert(nWorkUnits * workUnitSize >= len);
alias Task!(run, typeof(&reduceOnRange), R, size_t, size_t) RTask; alias Task!(run, typeof(&reduceOnRange), R, size_t, size_t) RTask;
@ -2769,8 +2758,7 @@ public:
size_t workerIndex() @property @safe const nothrow size_t workerIndex() @property @safe const nothrow
{ {
immutable rawInd = threadIndex; immutable rawInd = threadIndex;
return (rawInd >= instanceStartIndex && return (rawInd >= instanceStartIndex && rawInd < instanceStartIndex + size) ?
rawInd < instanceStartIndex + size) ?
(rawInd - instanceStartIndex + 1) : 0; (rawInd - instanceStartIndex + 1) : 0;
} }
@ -4386,8 +4374,7 @@ version(parallelismStressTest)
{ {
foreach(j, number; poolInstance.parallel(nestedInner, 1)) foreach(j, number; poolInstance.parallel(nestedInner, 1))
{ {
synchronized writeln synchronized writeln(i, ": ", letter, " ", j, ": ", number);
(i, ": ", letter, " ", j, ": ", number);
} }
} }