Github user jbapple-cloudera commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1214#discussion_r106796209
  
    --- Diff: lib/cpp/src/thrift/protocol/TCompactProtocol.tcc ---
    @@ -387,7 +389,11 @@ uint32_t 
TCompactProtocolT<Transport_>::writeVarint64(uint64_t n) {
      */
     template <class Transport_>
     uint64_t TCompactProtocolT<Transport_>::i64ToZigzag(const int64_t l) {
    -  return (l << 1) ^ (l >> 63);
    +  const int64_t m = l >> 63;
    +  uint64_t p, q;
    +  memcpy(&p, &l, sizeof(p));
    +  memcpy(&q, &m, sizeof(q));
    +  return p = (p << 1) ^ q;
    --- End diff --
    
    Good point.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to