From: leslie Date: Thu, 27 Dec 2007 21:15:12 +0000 (+0100) Subject: nagra 0101: map3e without lookup table X-Git-Tag: 0.8.7~46 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=013122be1319851c1e9d151a839e70798212b158;p=sasc-ng.git nagra 0101: map3e without lookup table --- diff --git a/systems/nagra/nagra2-0101.c b/systems/nagra/nagra2-0101.c index e061d1a..e4ef894 100644 --- a/systems/nagra/nagra2-0101.c +++ b/systems/nagra/nagra2-0101.c @@ -122,7 +122,6 @@ class cMap0101 : public cMapCore { private: static const unsigned char primes[]; static const unsigned short coef22[][32]; - static const unsigned short msbtbl3e[]; unsigned int cycles; #ifdef HAS_AUXSRV cAuxSrv aux; @@ -405,26 +404,6 @@ const unsigned short cMap0101::coef22[256][32] = { {436,17,16,17,16,17,17,16,27,26,27,26,26,27,26,27,37,38,38,37,38,37,38,38,48,49,48,49,49,48,49,48}, }; -const unsigned short cMap0101::msbtbl3e[] = { -// 0 1 2 3 4 5 6 7 8 9 a b c d e f -/*0*/ 0, 88, 148, 236, 224, 312, 312, 400, 302, 390, 390, 476, 390, 476, 476, 566, -/*1*/ 378, 466, 466, 554, 466, 554, 554, 642, 466, 554, 554, 642, 554, 642, 642, 730, -/*2*/ 448, 536, 536, 624, 536, 624, 624, 712, 536, 624, 624, 712, 624, 712, 712, 796, -/*3*/ 536, 624, 624, 712, 624, 712, 712, 796, 624, 712, 712, 796, 712, 796, 796, 884, -/*4*/ 524, 612, 612, 700, 612, 700, 700, 790, 612, 700, 700, 790, 700, 790, 790, 878, -/*5*/ 612, 700, 700, 790, 700, 790, 790, 878, 700, 790, 790, 878, 790, 878, 878, 966, -/*6*/ 612, 700, 700, 790, 700, 790, 790, 878, 700, 790, 790, 878, 790, 878, 878, 966, -/*7*/ 700, 790, 790, 878, 790, 878, 878, 966, 790, 878, 878, 966, 878, 966, 966,1054, -/*8*/ 602, 690, 690, 778, 690, 778, 778, 862, 690, 778, 778, 862, 778, 862, 862, 950, -/*9*/ 690, 778, 778, 862, 778, 862, 862, 950, 778, 862, 862, 950, 862, 950, 950,1038, -/*a*/ 690, 778, 778, 862, 778, 862, 862, 950, 778, 862, 862, 950, 862, 950, 950,1038, -/*b*/ 778, 862, 862, 950, 862, 950, 950,1038, 862, 950, 950,1038, 950,1038,1038,1126, -/*c*/ 690, 778, 778, 862, 778, 862, 862, 950, 778, 862, 862, 950, 862, 950, 950,1038, -/*d*/ 778, 862, 862, 950, 862, 950, 950,1038, 862, 950, 950,1038, 950,1038,1038,1126, -/*e*/ 778, 862, 862, 950, 862, 950, 950,1038, 862, 950, 950,1038, 950,1038,1038,1126, -/*f*/ 862, 950, 950,1038, 950,1038,1038,1126, 950,1038,1038,1126,1038,1126,1126,1214 - }; - cMap0101::cMap0101(void) { GenCRC16Table(); @@ -493,9 +472,11 @@ void cMap0101::DoMap(int f, unsigned char *data, int l) I.GetLE(data,(l?l:wordsize)<<3); BN_mod_exp(B,A,I,D,ctx); BN_one(A); - int end=(BN_num_bits(I)-1)/8; - cycles=3848 + end*650 + msbtbl3e[data[end]] - 13; - for(int i=end*8; --i>=0;) if(BN_is_bit_set(I,i)) cycles+=88; + int end=BN_num_bits(I); + int msb=data[(end-1)/8]; + cycles=3848 + ((end-1)/8)*650 - 11; + for(int i=8; --i>=1;) if(msb&(1<=0;) if(BN_is_bit_set(I,i)) cycles+=88; break; } case 0x4d: