Ignore:
Timestamp:
Feb 10, 2013, 1:25:26 PM (7 years ago)
Author:
lindanl
Message:

Escape parsing and numeric calculation optimization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_template.cpp

    r2902 r2903  
    3737BitBlock EOF_mask = simd<1>::constant<1>();
    3838
     39int pow_ten[8] = {1,10,100,1000,10000,100000,1000000,10000000};
     40
    3941
    4042static inline int Digit_postprocessing(char * source, int pos);
     
    4749void do_process(FILE *infile, FILE *outfile, int filesize);
    4850
    49 #define MAX_NUM 1000
     51#define MAX_NUM 1000000
    5052int numbers[MAX_NUM];
    5153int dec_pl[MAX_NUM];
     
    5658    bool negative= false;
    5759    int num = 0;
    58     int start_pos;
     60    int start_pos = -1;
    5961    if (source[pos] == '-')     {
    6062      pos++;
     
    7577    if (negative) (num) = -(num);
    7678    numbers[num_idx] = num;
    77     dec_pl[num_idx] = pow(10, pos - start_pos);
     79    if(start_pos!=-1)
     80      dec_pl[num_idx] = pow_ten[pos - start_pos];
     81    else
     82      dec_pl[num_idx] = 1;
    7883    num_idx++;
    7984}
     
    322327    PERF_SEC_END(parser_timer, chars_read);
    323328   
    324     fwrite(content_buf, 2, content_buf_ptr-content_buf, outfile);
    325 
    326 }
    327 
     329    fwrite(content_buf, 1, content_buf_ptr-content_buf, outfile);
     330
     331}
     332
Note: See TracChangeset for help on using the changeset viewer.