MCPcopy Create free account
hub / github.com/chrxh/alien / getCmdLineArgumentFloat

Function getCmdLineArgumentFloat

external/cuda/helper_string.h:217–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217inline float getCmdLineArgumentFloat(const int argc, const char **argv, const char *string_ref)
218{
219 bool bFound = false;
220 float value = -1;
221
222 if (argc >= 1)
223 {
224 for (int i=1; i < argc; i++)
225 {
226 int string_start = stringRemoveDelimiter('-', argv[i]);
227 const char *string_argv = &argv[i][string_start];
228 int length = (int)strlen(string_ref);
229
230 if (!STRNCASECMP(string_argv, string_ref, length))
231 {
232 if (length+1 <= (int)strlen(string_argv))
233 {
234 int auto_inc = (string_argv[length] == '=') ? 1 : 0;
235 value = (float)atof(&string_argv[length + auto_inc]);
236 }
237 else
238 {
239 value = 0.f;
240 }
241
242 bFound = true;
243 continue;
244 }
245 }
246 }
247
248 if (bFound)
249 {
250 return value;
251 }
252 else
253 {
254 return 0;
255 }
256}
257
258inline bool getCmdLineArgumentString(const int argc, const char **argv,
259 const char *string_ref, char **string_retval)

Callers

nothing calls this directly

Calls 1

stringRemoveDelimiterFunction · 0.85

Tested by

no test coverage detected