LCOV - code coverage report
Current view: top level - elsa/storage/memory_resource - Util.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 2 4 50.0 %
Date: 2024-05-16 04:22:26 Functions: 0 0 -

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <cstddef>
       4             : #include <tuple>
       5             : 
       6             : namespace elsa::mr::util
       7             : {
       8             : 
       9             :     size_t computeRealSize(size_t requestedSize, size_t granularity);
      10             : 
      11             :     /// @return [realSize, blockSize] where
      12             :     ///     realSize:  the size of the block to return
      13             :     ///     blockSize: the required size for a block,
      14             :     ///                so that the allocation can be carved out of it.
      15             :     ///                blockSize >= realSize holds, to satisfy alignment guarantees.
      16             :     std::pair<size_t, size_t> computeSizeWithAlignment(size_t requestedSize,
      17             :                                                        size_t requestedAlignment,
      18             :                                                        size_t granularity);
      19             : } // namespace elsa::mr::util
      20             : 
      21             : #if defined(__GNUC__) || defined(__clang__)
      22             : #define likely(x) __builtin_expect(!!(x), 1)
      23     1655514 : #define unlikely(x) __builtin_expect(!!(x), 0)
      24             : #else
      25             : #define likely(x) (x)
      26             : #define unlikely(x) (x)
      27             : #endif
      28             : 
      29             : #define ASSERT(x)                          \
      30     1176666 :     if (unlikely(!static_cast<bool>(x))) { \
      31           0 :         std::abort();                      \
      32           0 :     }

Generated by: LCOV version 1.14