mardi 5 juillet 2016

c++ define calculations in the text


headerfile.h

#define NBIT 128
#define DATASIZE 34

#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)


template <unsigned int POWER>
class xzcMutatorECB128
{

#define POWERLIMINT (NBIT * DATASIZE * 0.7)
#define MSG2 "xzcMutatorECB128<POWER>; error template parametr: POWER; maximum="STR(POWERLIMINT)"; [en]: Key exceeded the limit;"
    static_assert(!(POWER > POWERLIMINT), MSG2);

public:
  xzcMutatorECB128();
}

main.cpp

#include "headerfile.h"
int main(int argc, char *argv[])
{
xzcMutatorECB128<3400> xzc128e;
}

result:

error: C2338: xzcMutatorECB128<POWER>; error template parametr: POWER; maximum=(128 * 34 * 0.7); [en]: Key exceeded the limit;

how to do so:

error: C2338: xzcMutatorECB128<POWER>; error template parametr: POWER; maximum=3046; [en]: Key exceeded the limit;

NBIT and DATASIZE will change


Aucun commentaire:

Enregistrer un commentaire