source:proto/PDF/simd-float.cpp@5159

Last change on this file since 5159 was 3251, checked in by cameron, 6 years ago

Decimal point bug fix

File size: 1.6 KB
Line
1#define unaligned_numerics
2#ifdef unaligned_numerics
4#define store4(p, v) bitblock::store_unaligned(v, (BitBlock *) p)
5#endif
6#ifndef unaligned_numerics
8#define store4(p, v) bitblock::store_aligned(v, (BitBlock *) p)
9#endif
10
11
12static inline void ints_2_floats(int value[], int powten[], float rslt[], int numcount) {
13  for (int i = 0; i < numcount; i++) {
14    rslt[i] = ((float) value[i]) / ((float) powten[i]);
15  }
16}
17
18
19static inline void simd_ints_2_floats(int value[], int powten[], float rslt[], int numcount) {
20  for (int i = 0; i < numcount; i+=4) {
23    BitBlock rslt4 = simd<32>::fdiv(simd<32>::i2f(val4), simd<32>::i2f(powten4));
24    store4(&rslt[i], rslt4);
25  }
26}
27
28/*
29  Assume that we have stored the inverse power of ten value for the number
30  of decimal places in our fixed point number.
31  float inv_pow_ten[8] = {1.0,0.1,0.01,0.001,0.0001,0.00001,0.000001,0.0000001};
32*/
33
34
35static inline void ints_x_floats(int value[], float invpowten[], float rslt[], int numcount) {
36  for (int i = 0; i < numcount; i++) {
37    rslt[i] = ((float) value[i]) * invpowten[i];
38  }
39}
40
41
42static inline void simd_ints_x_floats(int value[], float invpowten[], float rslt[], int numcount) {
43  for (int i = 0; i < numcount; i+=4) {