mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-16 11:12:47 -05:00
Relax cn algorithm constants definition.
This commit is contained in:
@@ -24,27 +24,24 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "crypto/common/Algorithm.h"
|
||||
|
||||
|
||||
#include "crypto/cn/CnAlgo.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
@@ -274,9 +271,8 @@ xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
|
||||
return ARGON2;
|
||||
# endif
|
||||
|
||||
case INVALID:
|
||||
case MAX:
|
||||
return UNKNOWN;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return UNKNOWN;
|
||||
@@ -289,9 +285,9 @@ xmrig::Algorithm::Id xmrig::Algorithm::parse(const char *name)
|
||||
return INVALID;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(algorithm_names); i++) {
|
||||
if ((strcasecmp(name, algorithm_names[i].name) == 0) || (algorithm_names[i].shortName != nullptr && strcasecmp(name, algorithm_names[i].shortName) == 0)) {
|
||||
return algorithm_names[i].id;
|
||||
for (const AlgoName &item : algorithm_names) {
|
||||
if ((strcasecmp(name, item.name) == 0) || (item.shortName != nullptr && strcasecmp(name, item.shortName) == 0)) {
|
||||
return item.id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,9 +297,9 @@ xmrig::Algorithm::Id xmrig::Algorithm::parse(const char *name)
|
||||
|
||||
const char *xmrig::Algorithm::name(bool shortName) const
|
||||
{
|
||||
for (size_t i = 0; i < ARRAY_SIZE(algorithm_names); i++) {
|
||||
if (algorithm_names[i].id == m_id) {
|
||||
return (shortName && algorithm_names[i].shortName) ? algorithm_names[i].shortName : algorithm_names[i].name;
|
||||
for (const AlgoName &item : algorithm_names) {
|
||||
if (item.id == m_id) {
|
||||
return (shortName && item.shortName) ? item.shortName : item.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user