Skip to content

Commit

Permalink
Change EstimatedAllocatedSizeForTesting() so that it is more sensit…
Browse files Browse the repository at this point in the history
…ive to the

value of the argument and the number of calls, to make it more likely to find
bugs in size estimations.

PiperOrigin-RevId: 629407914
  • Loading branch information
QrczakMK committed Apr 30, 2024
1 parent 9597fd0 commit 7c54c39
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion riegeli/base/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ cc_library(
deps = [
":arithmetic",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/numeric:bits",
],
)

Expand Down
3 changes: 1 addition & 2 deletions riegeli/base/estimated_allocated_size.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <stddef.h>

#include "absl/base/attributes.h"
#include "absl/numeric/bits.h"
#include "riegeli/base/arithmetic.h"

namespace riegeli {
Expand All @@ -42,7 +41,7 @@ inline size_t EstimatedAllocatedSize(ABSL_ATTRIBUTE_UNUSED const void* ptr,

// A deterministic variant of `EstimatedAllocatedSize()`, useful for testing.
inline size_t EstimatedAllocatedSizeForTesting(size_t requested_size) {
return absl::bit_ceil(requested_size);
return 16 + requested_size;
}

} // namespace riegeli
Expand Down

0 comments on commit 7c54c39

Please sign in to comment.