guiyanakuang commented on a change in pull request #917:
URL: https://github.com/apache/orc/pull/917#discussion_r717203373



##########
File path: c++/src/Statistics.hh
##########
@@ -964,7 +964,23 @@ namespace orc {
       _stats.setSum(sum);
     }
 
-    void update(int64_t value, int repetitions);
+    void update(int64_t value, int repetitions) {
+      _stats.updateMinMax(value);
+
+      if (_stats.hasSum()) {
+        if (repetitions > 1) {
+          _stats.setHasSum(__builtin_mul_overflow(value, repetitions, &value) 
== 0);

Review comment:
       
https://docs.microsoft.com/en-us/windows/win32/api/intsafe/nf-intsafe-longadd
   
https://docs.microsoft.com/en-us/windows/win32/api/intsafe/nf-intsafe-longmult
   ```c++
   #define __builtin_mul_overflow LongMult
   #define __builtin_add_overflow LongAdd
   ```
   @wgtmac Can you give me some advice, I have very little practice in C++. I 
don't have a Win machine to hand, so I can't verify if this is possible at the 
moment.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@orc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to