Repository: incubator-quickstep Updated Branches: refs/heads/decimal-type 7e668513f -> 85b0694b0
DecimalLit conversions. Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/85b0694b Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/85b0694b Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/85b0694b Branch: refs/heads/decimal-type Commit: 85b0694b0a3479add75ae5a0d4e379dbd35d4621 Parents: 7e66851 Author: Hakan Memisoglu <[email protected]> Authored: Mon Jun 20 13:53:00 2016 -0500 Committer: Hakan Memisoglu <[email protected]> Committed: Mon Jun 20 13:53:00 2016 -0500 ---------------------------------------------------------------------- types/DecimalLit.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/85b0694b/types/DecimalLit.hpp ---------------------------------------------------------------------- diff --git a/types/DecimalLit.hpp b/types/DecimalLit.hpp index b9f0508..7675788 100644 --- a/types/DecimalLit.hpp +++ b/types/DecimalLit.hpp @@ -258,21 +258,29 @@ struct DecimalLit { return *this; } - inline operator int() const { + inline explicit operator int() const { return static_cast<int>(getIntegerPart()); } - inline operator long() const { + inline explicit operator long() const { return static_cast<long>(getIntegerPart()); } - inline operator double() const { + inline explicit operator double() const { return static_cast<double>(data_) / kMaxFractionInt; } - inline operator float() const { + inline explicit operator float() const { return static_cast<float>(data_) / kMaxFractionInt; } + + explicit DecimalLit(const int value) + : data_(value * kMaxFractionInt) { + } + + explicit DecimalLit(const long value) + : data_(value * kMaxFractionInt) { + } }; //** @} */
