quickstep-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbdeshmukh <...@git.apache.org>
Subject [GitHub] incubator-quickstep pull request #98: QUICKSTEP-53 DateLit improvements
Date Wed, 07 Sep 2016 01:37:22 GMT
Github user hbdeshmukh commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/98#discussion_r77748322
  
    --- Diff: types/DatetimeLit.hpp ---
    @@ -51,53 +54,70 @@ struct DateLit {
             + 1   // -
             + 2;  // Day
     
    +  // Years should be between [-kMaxYear, +kMaxYear] inclusive both end.
    +  static constexpr std::int32_t kMaxYear = 99999;
    +  static constexpr std::uint8_t kBitsNeededForDay = 5u;
    +  static constexpr std::uint8_t kBitsNeededForMonth = 4u;
    +
       static DateLit Create(const std::int32_t _year,
                             const std::uint8_t _month,
                             const std::uint8_t _day) {
         DateLit date;
    -    date.year = _year;
    -    date.month = _month;
    -    date.day = _day;
    +    // Normalize year by adding kMaxYear value, because we try to
    +    // encode signed year value into an unsigned integer.
    --- End diff --
    
    Hi @hakanmemisoglu 
    
    What's the impact on the leap year calculation because of this normalization (i.e. adding
kMaxYear value to the negative value of year). More specifically, if ``_year`` is a leap year,
is there a guarantee that ``_year + kMaxYear`` is also a leap year?  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message