impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Apple (Code Review)" <ger...@cloudera.org>
Subject [Impala-ASF-CR] IMPALA-5722: Fix string to decimal cast
Date Thu, 27 Jul 2017 17:19:55 GMT
Jim Apple has posted comments on this change.

Change subject: IMPALA-5722: Fix string to decimal cast
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7517/1/be/src/util/decimal-util.h
File be/src/util/decimal-util.h:

Line 63:       DCHECK_GE(result * 10, result);
If T is signed, the compiler is permitted to turn this into a no-op: http://eel.is/c++draft/expr#4
, https://blog.regehr.org/archives/1520

You could use make_unsigned_t to do the multiplication in the unsigned domain and then convert
back or you could use https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html.

Using make_unsigned is tricky for __int128.


-- 
To view, visit http://gerrit.cloudera.org:8080/7517
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1f5eb5b64a6924af2e8eb7f9a50da67015757efe
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Taras Bobrovytsky <tbobrovytsky@cloudera.com>
Gerrit-Reviewer: Jim Apple <jbapple-impala@apache.org>
Gerrit-Reviewer: Tim Armstrong <tarmstrong@cloudera.com>
Gerrit-HasComments: Yes

Mime
View raw message