Ignore:
Timestamp:
Jul 5, 2010, 6:13:32 PM (9 years ago)
Author:
cameron
Message:

Add shift 1 optimization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/byteclass.py

    r439 r441  
    226226  return (u8, control, lex)
    227227
     228
     229def classify_bytes_with_shift1opt(bit) :
     230  u8 = u8_streams()
     231  lex = lexical_streams()
     232  control = control_streams()
     233  temp1 = (bit[0] | bit[1]);
     234  temp2 = (bit[2] &~ bit[3]);
     235  temp3 = (temp2 &~ temp1);
     236  temp4 = (bit[5] &~ bit[4]);
     237  temp5 = (bit[6] &~ bit[7]);
     238  temp6 = (temp4 & temp5);
     239  lex.RefStart = (temp3 & temp6);
     240  temp7 = (bit[2] & bit[3]);
     241  temp8 = (temp7 &~ temp1);
     242  temp9 = (bit[4] &~ bit[5]);
     243  temp10 = (bit[6] & bit[7]);
     244  temp11 = (temp9 & temp10);
     245  lex.Semicolon = (temp8 & temp11);
     246  temp12 = (bit[4] & bit[5]);
     247  temp13 = (bit[6] | bit[7]);
     248  temp14 = (temp12 &~ temp13);
     249  lex.LAngle = (temp8 & temp14);
     250  temp15 = (temp12 & temp5);
     251  lex.RAngle = (temp8 & temp15);
     252  temp16 = (bit[1] &~ bit[0]);
     253  temp17 = (bit[3] &~ bit[2]);
     254  temp18 = (temp16 & temp17);
     255  lex.LBracket = (temp18 & temp11);
     256  temp19 = (bit[7] &~ bit[6]);
     257  temp20 = (temp12 & temp19);
     258  lex.RBracket = (temp18 & temp20);
     259  temp21 = (bit[4] | bit[5]);
     260  temp22 = (temp19 &~ temp21);
     261  lex.Exclam = (temp3 & temp22);
     262  temp23 = (temp12 & temp10);
     263  lex.QMark = (temp8 & temp23);
     264  lex.Hyphen = (temp3 & temp20);
     265  lex.Equals = (temp8 & temp20);
     266  temp24 = (temp4 & temp10);
     267  lex.SQuote = (temp3 & temp24);
     268  temp25 = (temp5 &~ temp21);
     269  lex.DQuote = (temp3 & temp25);
     270  lex.Slash = (temp3 & temp23);
     271  temp26 = (temp10 &~ temp21);
     272  lex.Hash = (temp3 & temp26);
     273  temp27 = (temp16 & temp7);
     274  temp28 = (temp9 &~ temp13);
     275  lex.x = (temp27 & temp28);
     276  temp29 = (temp9 & temp5);
     277  lex.Colon = (temp8 & temp29);
     278  temp30 = (temp18 & temp23);
     279  temp31 = (temp30 | lex.Colon);
     280  temp32 = (temp16 &~ bit[2]);
     281  temp33 = (bit[5] | temp10);
     282  temp34 = (bit[4] & temp33);
     283  temp35 = (~temp34);
     284  temp36 = (temp21 | temp13);
     285  temp37 = ((bit[3] & temp35)|(~(bit[3]) & temp36));
     286  temp38 = (temp32 & temp37);
     287  temp39 = (temp31 | temp38);
     288  temp40 = (temp16 & bit[2]);
     289  temp41 = (temp40 & temp37);
     290  lex.ASCII_name_start = (temp39 | temp41);
     291  temp42 = (temp30 | lex.Hyphen);
     292  temp43 = (temp3 & temp15);
     293  temp44 = (temp42 | temp43);
     294  temp45 = (temp8 &~ temp34);
     295  temp46 = (temp44 | temp45);
     296  temp47 = (temp46 | temp38);
     297  lex.ASCII_name_char = (temp47 | temp41);
     298  lex.NameScan = (lex.ASCII_name_char | bit[0]);
     299  temp48 = (temp1 | bit[2]);
     300  control.x00_x1F = (~temp48);
     301  temp49 = (bit[2] | bit[3]);
     302  temp50 = (temp1 | temp49);
     303  control.CR = (temp20 &~ temp50);
     304  control.LF = (temp29 &~ temp50);
     305  temp51 = (temp9 & temp19);
     306  control.HT = (temp51 &~ temp50);
     307  control.SP = (temp3 &~ temp36);
     308  temp52 = (temp20 | temp29);
     309  temp53 = (temp52 | temp51);
     310  temp54 = (temp53 &~ temp50);
     311  lex.WS = (temp54 | control.SP);
     312  temp55 = (bit[5] | bit[6]);
     313  temp56 = (bit[4] & temp55);
     314  lex.Digit = (temp8 &~ temp56);
     315  temp57 = (temp16 &~ temp49);
     316  temp58 = (temp57 &~ bit[4]);
     317  temp59 = (~temp10);
     318  temp60 = ((bit[5] & temp59)|(~(bit[5]) & temp13));
     319  temp61 = (temp58 & temp60);
     320  temp62 = (lex.Digit | temp61);
     321  temp63 = (temp16 & temp2);
     322  temp64 = (temp63 &~ bit[4]);
     323  temp65 = (temp64 & temp60);
     324  lex.Hex = (temp62 | temp65);
     325  u8.unibyte = (~bit[0]);
     326  u8.prefix = (bit[0] & bit[1]);
     327  u8.prefix2 = (u8.prefix &~ bit[2]);
     328  u8.prefix3 = (u8.prefix & temp2);
     329  u8.prefix4 = (u8.prefix & temp7);
     330  u8.suffix = (bit[0] &~ bit[1]);
     331  temp66 = (u8.prefix &~ temp49);
     332  temp67 = (temp21 | bit[6]);
     333  temp68 = (temp66 &~ temp67);
     334  temp69 = (bit[5] & temp13);
     335  temp70 = (bit[4] | temp69);
     336  temp71 = (u8.prefix4 & temp70);
     337  u8.badprefix = (temp68 | temp71);
     338  xE0 = (u8.prefix3 &~ temp36);
     339  xED = (u8.prefix3 & temp20);
     340  xF0 = (u8.prefix4 &~ temp36);
     341  temp72 = (temp4 &~ temp13);
     342  xF4 = (u8.prefix4 & temp72);
     343  u8.xA0_xBF = (u8.suffix & bit[2]);
     344  u8.x80_x9F = (u8.suffix &~ bit[2]);
     345  u8.x90_xBF = (u8.suffix & temp49);
     346  u8.x80_x8F = (u8.suffix &~ temp49);
     347  xEF = (u8.prefix3 & temp23);
     348  temp73 = (u8.suffix & temp7);
     349  u8.xBF = (temp73 & temp23);
     350  u8.xBE = (temp73 & temp15);
     351
     352  bitshift1 = [0,0,0,0,0,0,0,0]
     353  bitshift1[0] = bitutil.Advance(bit[0])
     354  bitshift1[1] = bitutil.Advance(bit[1])
     355  bitshift1[2] = bitutil.Advance(bit[2])
     356  bitshift1[3] = bitutil.Advance(bit[3])
     357  bitshift1[4] = bitutil.Advance(bit[4])
     358  bitshift1[5] = bitutil.Advance(bit[5])
     359  bitshift1[6] = bitutil.Advance(bit[6])
     360  bitshift1[7] = bitutil.Advance(bit[7])
     361
     362
     363  shft1_temp1 = (shft1_bit[0] | shft1_bit[1]);
     364  shft1_temp2 = (shft1_bit[2] &~ shft1_bit[3]);
     365  shft1_temp3 = (shft1_temp2 &~ shft1_temp1);
     366  shft1_temp4 = (shft1_bit[5] &~ shft1_bit[4]);
     367  shft1_temp5 = (shft1_bit[6] &~ shft1_bit[7]);
     368  shft1_temp6 = (shft1_temp4 & shft1_temp5);
     369  lex.RefStart_scope = (shft1_temp3 & shft1_temp6);
     370  shft1_temp7 = (shft1_bit[2] & shft1_bit[3]);
     371  shft1_temp8 = (shft1_temp7 &~ shft1_temp1);
     372  shft1_temp9 = (shft1_bit[4] & shft1_bit[5]);
     373  shft1_temp10 = (shft1_bit[6] | shft1_bit[7]);
     374  shft1_temp11 = (shft1_temp9 &~ shft1_temp10);
     375  lex.LAngle_scope = (shft1_temp8 & shft1_temp11);
     376  shft1_temp12 = (shft1_bit[1] &~ shft1_bit[0]);
     377  shft1_temp13 = (shft1_bit[3] &~ shft1_bit[2]);
     378  shft1_temp14 = (shft1_temp12 & shft1_temp13);
     379  shft1_temp15 = (shft1_bit[7] &~ shft1_bit[6]);
     380  shft1_temp16 = (shft1_temp9 & shft1_temp15);
     381  lex.RBracket_scope = (shft1_temp14 & shft1_temp16);
     382  shft1_temp17 = (shft1_bit[6] & shft1_bit[7]);
     383  shft1_temp18 = (shft1_temp9 & shft1_temp17);
     384  lex.QMark_scope = (shft1_temp8 & shft1_temp18);
     385  lex.Hyphen_scope = (shft1_temp3 & shft1_temp16);
     386  lex.Slash_scope = (shft1_temp3 & shft1_temp18);
     387  shft1_temp19 = (shft1_bit[2] | shft1_bit[3]);
     388  shft1_temp20 = (shft1_temp1 | shft1_temp19);
     389  control.CR_scope = (shft1_temp16 &~ shft1_temp20);
     390  u8.scope2 = (shft1_bit[0] & shft1_bit[1]);
     391  u8.scope22 = (u8.scope2 &~ shft1_bit[2]);
     392  u8.scope32 = (u8.scope2 & shft1_temp2);
     393  u8.scope42 = (u8.scope2 & shft1_temp7);
     394  shft1_temp21 = (shft1_bit[4] | shft1_bit[5]);
     395  shft1_temp22 = (shft1_temp21 | shft1_temp10);
     396  u8.xE0_scope = (u8.scope32 &~ shft1_temp22);
     397  u8.xED_scope = (u8.scope32 & shft1_temp16);
     398  u8.xF0_scope = (u8.scope42 &~ shft1_temp22);
     399  shft1_temp23 = (shft1_temp4 &~ shft1_temp10);
     400  u8.xF4_scope = (u8.scope42 & shft1_temp23);
     401  u8.xEF_scope = (u8.scope32 & shft1_temp18);
     402  u8.scope33 = bitutil.Advance(u8.scope32)
     403  u8.scope43 = bitutil.Advance(u8.scope42)
     404  u8.scope44 = bitutil.Advance(u8.scope43)
     405
     406  return (u8, control, lex)
     407
Note: See TracChangeset for help on using the changeset viewer.