Changeset 3130 for proto


Ignore:
Timestamp:
May 11, 2013, 4:54:05 PM (6 years ago)
Author:
lindanl
Message:

Add floating point processing.

Location:
proto/PDF
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_template.cpp

    r3129 r3130  
    1414#include "../../simd-lib/s2p.hpp"
    1515#include "../../simd-lib/p2s.hpp"
    16 #include <math.h>
     16#include "../simd-float.cpp"
    1717
    1818#include "../../simd-lib/perflib/perfsec.h"
     
    4646
    4747int pow_ten[8] = {1,10,100,1000,10000,100000,1000000,10000000};
     48float inv_pow_ten[8] = {1.0,0.1,00.1,000.1,0000.1,00000.1,000000.1,0000000.1};
    4849
    4950static inline int Digit_postprocessing(char * source, int pos);
     
    8788#define MAX_NUM 1000000
    8889int numbers[MAX_NUM];
    89 int dec_pl[MAX_NUM];
     90float num_rslt[MAX_NUM];
     91float dec_pl[MAX_NUM];
    9092int num_idx=0;
    9193
     
    113115    numbers[num_idx] = num;
    114116    if(start_pos!=-1){
    115       dec_pl[num_idx] = pow_ten[pos - start_pos];
     117      dec_pl[num_idx] = inv_pow_ten[pos - start_pos];
    116118      tokenArray[token_idx].type = flt_token;
    117119      tokenArray[token_idx].token.idx = num_idx;
    118120    }
    119121    else{
    120       dec_pl[num_idx] = 1;
     122      dec_pl[num_idx] = 1.0;
    121123      tokenArray[token_idx].type = int_token;
    122124      tokenArray[token_idx].token.idx = num_idx;
     
    412414    content_buf[cb_idx+1] = (char*)malloc(BUF_SIZE*2);
    413415    Postprocessing(content_buf[cb_idx], content_buf_ptr-content_buf[cb_idx], content_buf[cb_idx+1], marker, unitsums_per_reg, at_start, at_optr, base_pos);
     416//     ints_2_floats(numbers, dec_pl, num_rslt, num_idx);
     417//      ints_x_floats(numbers, dec_pl, num_rslt, num_idx);
     418//    simd_ints_2_floats(numbers, dec_pl, num_rslt, num_idx);
    414419    content_buf_ptr =  content_buf[cb_idx+1]+base_pos;
    415420    cb_idx++; 
     
    484489     
    485490      if(tokenArray[i].type==flt_token)
    486         printf("Number: %i\n",numbers[tokenArray[i].token.idx]);
     491        printf("Number: %f\n",num_rslt[tokenArray[i].token.idx]);
    487492     
    488493      if(tokenArray[i].type==kw_token){
     
    492497        printf("\n");
    493498      }
    494     }
     499    }*/
    495500   
    496 
     501/*
    497502    for(int i=0;i<100;i++)  {
    498503        printf("len at %i is %i\n",i, optrArray[i].len);
Note: See TracChangeset for help on using the changeset viewer.