mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Make wimpy factor argument parsing logic common (#155)
This commit is contained in:
committed by
Kévin Petit
parent
8d209840be
commit
c1cd117265
@@ -441,25 +441,7 @@ static int ParseArgs( int argc, const char **argv )
|
||||
gWimpyMode ^= 1;
|
||||
break;
|
||||
case '[':
|
||||
// wimpy reduction factor can be set with the option -[2^n]
|
||||
// Default factor is 128, and n practically can be from 1 to 12
|
||||
{
|
||||
const char *arg_temp = strchr(&arg[1], ']');
|
||||
if (arg_temp != 0)
|
||||
{
|
||||
int new_factor = atoi(&arg[1]);
|
||||
arg = arg_temp; // Advance until ']'
|
||||
if (new_factor && !(new_factor & (new_factor - 1)))
|
||||
{
|
||||
vlog(" WimpyReduction factor changed from %d to %d \n", gWimpyReductionFactor, new_factor);
|
||||
gWimpyReductionFactor = new_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog(" Error in WimpyReduction factor, must be power of 2 \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
parseWimpyReductionFactor(arg, gWimpyReductionFactor);
|
||||
break;
|
||||
case 'z':
|
||||
gForceFTZ ^= 1;
|
||||
|
||||
@@ -251,25 +251,7 @@ static int ParseArgs( int argc, const char **argv )
|
||||
gWimpyMode = true;
|
||||
break;
|
||||
case '[':
|
||||
// wimpy reduction factor can be set with the option -[2^n]
|
||||
// Default factor is 512, and n practically can be from 1 to 12
|
||||
{
|
||||
const char *arg_temp = strchr(&arg[1], ']');
|
||||
if (arg_temp != 0)
|
||||
{
|
||||
int new_factor = atoi(&arg[1]);
|
||||
arg = arg_temp; // Advance until ']'
|
||||
if (new_factor && !(new_factor & (new_factor - 1)))
|
||||
{
|
||||
vlog(" WimpyReduction factor changed from %d to %d \n", gWimpyReductionFactor, new_factor);
|
||||
gWimpyReductionFactor = new_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog(" Error in WimpyReduction factor, must be power of 2 \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
parseWimpyReductionFactor( arg, gWimpyReductionFactor);
|
||||
break;
|
||||
default:
|
||||
vlog_error( " <-- unknown flag: %c (0x%2.2x)\n)", *arg, *arg );
|
||||
|
||||
@@ -1039,24 +1039,7 @@ static int ParseArgs( int argc, const char **argv )
|
||||
break;
|
||||
|
||||
case '[':
|
||||
// wimpy reduction factor can be set with the option -[2^n]
|
||||
// Default factor is 32, and n practically can be from 1 to 10
|
||||
{
|
||||
const char *arg_temp = strchr(&arg[1], ']');
|
||||
if( arg_temp != 0)
|
||||
{
|
||||
int new_factor = atoi(&arg[1]);
|
||||
arg=arg_temp; // Advance until ']'
|
||||
if(new_factor && !(new_factor & (new_factor - 1)))
|
||||
{
|
||||
vlog( " WimpyReduction factor changed from %d to %d \n",gWimpyReductionFactor, new_factor);
|
||||
gWimpyReductionFactor = new_factor;
|
||||
}else
|
||||
{
|
||||
vlog( " Error in WimpyReduction factor %d, must be power of 2 \n",gWimpyReductionFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
parseWimpyReductionFactor(arg, gWimpyReductionFactor);
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
|
||||
@@ -605,25 +605,7 @@ int main(int argc, char* argv[])
|
||||
s_wimpy_mode = true;
|
||||
break;
|
||||
case '[':
|
||||
// wimpy reduction factor can be set with the option -[2^n]
|
||||
// Default factor is 256, and n practically can be from 1 to 12
|
||||
{
|
||||
const char *arg_temp = strchr(&arg[1], ']');
|
||||
if (arg_temp != 0)
|
||||
{
|
||||
int new_factor = atoi(&arg[1]);
|
||||
arg = arg_temp; // Advance until ']'
|
||||
if (new_factor && !(new_factor & (new_factor - 1)))
|
||||
{
|
||||
vlog(" WimpyReduction factor changed from %d to %d \n", s_wimpy_reduction_factor, new_factor);
|
||||
s_wimpy_reduction_factor = new_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog(" Error in WimpyReduction factor must be power of 2 \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
parseWimpyReductionFactor(arg, s_wimpy_reduction_factor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user