File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2514,12 +2514,12 @@ EidosValue_SP Eidos_ExecuteFunction_sum(const std::vector<EidosValue_SP> &p_argu
25142514 // case across multiple threads seems excessively complex; instead we look for an overflow afterwards
25152515 const int64_t *int_data = x_value->IntData ();
25162516 double sum_d = 0 ;
2517-
2517+
25182518 EIDOS_THREAD_COUNT (gEidos_OMP_threads_SUM_INTEGER );
25192519#pragma omp parallel for simd schedule(simd:static) default(none) shared(x_count) firstprivate(int_data) reduction(+: sum_d) if(parallel:x_count >= EIDOS_OMPMIN_SUM_INTEGER) num_threads(thread_count)
25202520 for (int value_index = 0 ; value_index < x_count; ++value_index)
25212521 sum_d += int_data[value_index];
2522-
2522+
25232523 // 2^53 is the largest integer such that it and all smaller integers can be represented in double losslessly
25242524 int64_t sum = (int64_t )sum_d;
25252525 bool fits_in_integer = (((double )sum == sum_d) && (sum < 9007199254740992L ) && (sum > -9007199254740992L ));
@@ -2535,7 +2535,7 @@ EidosValue_SP Eidos_ExecuteFunction_sum(const std::vector<EidosValue_SP> &p_argu
25352535 {
25362536 const double *float_data = x_value->FloatData ();
25372537 double sum = 0 ;
2538-
2538+
25392539#ifdef _OPENMP
25402540 EIDOS_THREAD_COUNT (gEidos_OMP_threads_SUM_FLOAT );
25412541 #pragma omp parallel for simd schedule(simd:static) default(none) shared(x_count) firstprivate(float_data) reduction(+: sum) if(parallel:x_count >= EIDOS_OMPMIN_SUM_FLOAT) num_threads(thread_count)
@@ -2544,7 +2544,7 @@ EidosValue_SP Eidos_ExecuteFunction_sum(const std::vector<EidosValue_SP> &p_argu
25442544#else
25452545 sum = Eidos_SIMD::sum_float64 (float_data, x_count);
25462546#endif
2547-
2547+
25482548 result_SP = EidosValue_SP (new (gEidosValuePool ->AllocateChunk ()) EidosValue_Float (sum));
25492549 }
25502550 else if (x_type == EidosValueType::kValueLogical )
You can’t perform that action at this time.
0 commit comments