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 #90: Quickstep 28 29
Date Mon, 15 Aug 2016 16:22:14 GMT
Github user hbdeshmukh commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/90#discussion_r74788256
  
    --- Diff: expressions/aggregation/AggregationHandleAvg.hpp ---
    @@ -57,26 +58,39 @@ class AggregationStateAvg : public AggregationState {
        */
       AggregationStateAvg(const AggregationStateAvg &orig)
           : sum_(orig.sum_),
    -        count_(orig.count_) {
    +        count_(orig.count_),
    +        sum_offset(orig.sum_offset),
    +        count_offset(orig.count_offset),
    +        mutex_offset(orig.mutex_offset) {
       }
     
       /**
        * @brief Destructor.
        */
       ~AggregationStateAvg() override {}
     
    +  size_t getPayloadSize() const {
    +     size_t p1 = reinterpret_cast<size_t>(&sum_);
    +     size_t p2 = reinterpret_cast<size_t>(&mutex_);
    +     return (p2-p1);
    +  }
    +
      private:
       friend class AggregationHandleAvg;
     
       AggregationStateAvg()
    -      : sum_(0), count_(0) {
    +      : sum_(0), count_(0), sum_offset(0),
    +        count_offset(reinterpret_cast<uint8_t *>(&count_)-reinterpret_cast<uint8_t
*>(&sum_)),
    +        mutex_offset(reinterpret_cast<uint8_t *>(&mutex_)-reinterpret_cast<uint8_t
*>(&sum_)) {
       }
     
       // TODO(shoban): We might want to specialize sum_ and count_ to use atomics
       // for int types similar to in AggregationStateCount.
       TypedValue sum_;
       std::int64_t count_;
       SpinMutex mutex_;
    +
    +  int sum_offset, count_offset, mutex_offset;
    --- End diff --
    
    As a convention, the class member variables have an underscore prefix, e.g. ``count_``
and the local function variables don't have the underscore prefix e.g. ``count``. This helps
in a better readability. Can you please make the appropriate changes? 


---
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