diff --git a/src/common/crypto/Algorithm.cpp b/src/common/crypto/Algorithm.cpp index 05c890dc..a3cf48b2 100644 --- a/src/common/crypto/Algorithm.cpp +++ b/src/common/crypto/Algorithm.cpp @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2018 Lee Clagett + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify @@ -176,11 +177,21 @@ void xmrig::Algorithm::parseVariant(const char *variant) void xmrig::Algorithm::parseVariant(int variant) { - if (variant >= VARIANT_AUTO && variant < VARIANT_MAX) { - m_variant = static_cast(variant); - } - else { - assert(false); + assert(variant >= -1 && variant <= 2); + + switch (variant) { + case -1: + case 0: + case 1: + m_variant = static_cast(variant); + break; + + case 2: + m_variant = VARIANT_2; + break; + + default: + break; } } diff --git a/src/common/crypto/Algorithm.h b/src/common/crypto/Algorithm.h index bcf029d8..731fa793 100644 --- a/src/common/crypto/Algorithm.h +++ b/src/common/crypto/Algorithm.h @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2018 Lee Clagett + * Copyright 2018 SChernykh * Copyright 2016-2018 XMRig , * * This program is free software: you can redistribute it and/or modify @@ -22,8 +23,8 @@ * along with this program. If not, see . */ -#ifndef __ALGORITHM_H__ -#define __ALGORITHM_H__ +#ifndef XMRIG_ALGORITHM_H +#define XMRIG_ALGORITHM_H #include