speeding up device construction (nw)

This commit is contained in:
andreasnaive 2015-08-07 17:40:00 +02:00
parent 97751f47c3
commit b5f3517129
3 changed files with 6 additions and 5 deletions

View File

@ -462,7 +462,7 @@ READ16_MEMBER( namcos10_state::nand_data_r )
UINT16 data = nand_read2( nand_address * 2 ); UINT16 data = nand_read2( nand_address * 2 );
// logerror("read %08x = %04x\n", nand_address*2, data); // logerror("read %08x = %04x\n", nand_address*2, data);
printf("read %08x = %04x\n", nand_address*2, data); //printf("read %08x = %04x\n", nand_address*2, data);
/* printf( "data<-%08x (%08x)\n", data, nand_address ); */ /* printf( "data<-%08x (%08x)\n", data, nand_address ); */

View File

@ -150,11 +150,11 @@ UINT16 ns10_decrypter_device::decrypt(UINT16 cipherword)
for (int j = 15; j >= 0; --j) for (int j = 15; j >= 0; --j)
{ {
_mask <<= 1; _mask <<= 1;
_mask ^= _reducer.gf2_reduce(_logic.eMask[j] & _previous_cipherwords); _mask ^= _reducer->gf2_reduce(_logic.eMask[j] & _previous_cipherwords);
_mask ^= _reducer.gf2_reduce(_logic.dMask[j] & _previous_plainwords); _mask ^= _reducer->gf2_reduce(_logic.dMask[j] & _previous_plainwords);
} }
_mask ^= _logic.xMask; _mask ^= _logic.xMask;
_mask ^= _logic.nonlinear_calculation(_previous_cipherwords, _previous_plainwords, _reducer); _mask ^= _logic.nonlinear_calculation(_previous_cipherwords, _previous_plainwords, *_reducer);
return plainword; return plainword;
} }
@ -162,6 +162,7 @@ UINT16 ns10_decrypter_device::decrypt(UINT16 cipherword)
void ns10_decrypter_device::device_start() void ns10_decrypter_device::device_start()
{ {
_active = false; _active = false;
_reducer = auto_alloc(machine(), gf2_reducer());
} }
void ns10_decrypter_device::init(int iv) void ns10_decrypter_device::init(int iv)

View File

@ -44,7 +44,7 @@ private:
bool _active; bool _active;
const ns10_crypto_logic& _logic; const ns10_crypto_logic& _logic;
static const int initSbox[16]; static const int initSbox[16];
const gf2_reducer _reducer; const gf2_reducer *_reducer;
void device_start(); void device_start();
void init(int iv); void init(int iv);