wgtmac commented on code in PR #653:
URL: https://github.com/apache/iceberg-cpp/pull/653#discussion_r3288516436


##########
src/iceberg/util/temporal_util.cc:
##########
@@ -21,19 +21,40 @@
 
 #include <chrono>
 #include <cstdint>
+#include <limits>
 #include <utility>
 
 #include "iceberg/expression/literal.h"
+#include "iceberg/util/int128.h"
 
 namespace iceberg {
 
 namespace {
 
 using namespace std::chrono;  // NOLINT
 
+constexpr int64_t kNanosPerMicro = 1000;
+
 constexpr auto kEpochYmd = year{1970} / January / 1;
 constexpr auto kEpochDays = sys_days(kEpochYmd);
 
+inline constexpr int64_t FloorDiv(int64_t dividend, int64_t divisor) {
+  const auto quotient = dividend / divisor;
+  if ((dividend ^ divisor) < 0 && quotient * divisor != dividend) {
+    return quotient - 1;
+  }
+  return quotient;
+}
+
+Result<int64_t> MultiplyExact(int64_t lhs, int64_t rhs) {

Review Comment:
   nit: we may introduce a dedicated math utility like 
https://github.com/apache/arrow/blob/96f80729c1581ee98f9d0a2cd9994ae50302491d/cpp/src/arrow/util/int_util_overflow.h#L184



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to