You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2022/08/29 20:47:20 UTC

[datasketches-cpp] branch empty_entries created (now 66fc3c5)

This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a change to branch empty_entries
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git


      at 66fc3c5  avoid needless call to memcpy with an empty entries_ array, even if correctly trying to write 0 values, to keep sanitizer=undefined happy

This branch includes the following new commits:

     new 66fc3c5  avoid needless call to memcpy with an empty entries_ array, even if correctly trying to write 0 values, to keep sanitizer=undefined happy

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[datasketches-cpp] 01/01: avoid needless call to memcpy with an empty entries_ array, even if correctly trying to write 0 values, to keep sanitizer=undefined happy

Posted by jm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch empty_entries
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit 66fc3c56c85cf50cd0b83db205dd69dd820ec26d
Author: Jon <jm...@apache.org>
AuthorDate: Mon Aug 29 13:46:46 2022 -0700

    avoid needless call to memcpy with an empty entries_ array, even if correctly trying to write 0 values, to keep sanitizer=undefined happy
---
 theta/include/theta_sketch_impl.hpp | 4 ++--
 tuple/include/tuple_sketch_impl.hpp | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/theta/include/theta_sketch_impl.hpp b/theta/include/theta_sketch_impl.hpp
index 172074a..b7ea693 100644
--- a/theta/include/theta_sketch_impl.hpp
+++ b/theta/include/theta_sketch_impl.hpp
@@ -359,7 +359,7 @@ void compact_theta_sketch_alloc<A>::serialize(std::ostream& os) const {
   write(os, flags_byte);
   const uint16_t seed_hash = get_seed_hash();
   write(os, seed_hash);
-  if (!this->is_empty()) {
+  if (entries_.size() > 0) {
     if (!is_single_item) {
       const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
       write(os, num_entries);
@@ -397,7 +397,7 @@ auto compact_theta_sketch_alloc<A>::serialize(unsigned header_size_bytes) const
   ptr += copy_to_mem(flags_byte, ptr);
   const uint16_t seed_hash = get_seed_hash();
   ptr += copy_to_mem(seed_hash, ptr);
-  if (!this->is_empty()) {
+  if (entries_.size() > 0) {
     if (!is_single_item) {
       const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
       ptr += copy_to_mem(num_entries, ptr);
diff --git a/tuple/include/tuple_sketch_impl.hpp b/tuple/include/tuple_sketch_impl.hpp
index ff7fbfa..616b630 100644
--- a/tuple/include/tuple_sketch_impl.hpp
+++ b/tuple/include/tuple_sketch_impl.hpp
@@ -385,7 +385,7 @@ void compact_tuple_sketch<S, A>::serialize(std::ostream& os, const SerDe& sd) co
   write(os, flags_byte);
   const uint16_t seed_hash = get_seed_hash();
   write(os, seed_hash);
-  if (!this->is_empty()) {
+  if (entries_.size() > 0) {
     if (!is_single_item) {
       const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
       write(os, num_entries);
@@ -430,7 +430,7 @@ auto compact_tuple_sketch<S, A>::serialize(unsigned header_size_bytes, const Ser
   ptr += copy_to_mem(flags_byte, ptr);
   const uint16_t seed_hash = get_seed_hash();
   ptr += copy_to_mem(seed_hash, ptr);
-  if (!this->is_empty()) {
+  if (entries_.size() > 0) {
     if (!is_single_item) {
       const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
       ptr += copy_to_mem(num_entries, ptr);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org