Flutter Impeller
impeller::Range Struct Reference

#include <range.h>

Public Member Functions

constexpr Range ()
 
constexpr Range (size_t p_offset, size_t p_length)
 
constexpr bool operator== (const Range &o) const
 
constexpr Range Merge (const Range &other)
 Create a new range that is a union of this range and other. More...
 

Public Attributes

size_t offset = 0
 
size_t length = 0
 

Detailed Description

Definition at line 13 of file range.h.

Constructor & Destructor Documentation

◆ Range() [1/2]

constexpr impeller::Range::Range ( )
inlineconstexpr

Definition at line 17 of file range.h.

17 {}

◆ Range() [2/2]

constexpr impeller::Range::Range ( size_t  p_offset,
size_t  p_length 
)
inlineconstexpr

Definition at line 19 of file range.h.

20  : offset(p_offset), length(p_length) {}
size_t length
Definition: range.h:15
size_t offset
Definition: range.h:14

Member Function Documentation

◆ Merge()

constexpr Range impeller::Range::Merge ( const Range other)
inlineconstexpr

Create a new range that is a union of this range and other.

Definition at line 27 of file range.h.

27  {
28  if (other.length == 0) {
29  return *this;
30  }
31  if (length == 0) {
32  return other;
33  }
34  auto end_offset = std::max(offset + length, other.offset + other.length);
35  auto start_offset = std::min(offset, other.offset);
36  return Range{start_offset, end_offset - start_offset};
37  }
constexpr Range()
Definition: range.h:17

References length, and offset.

Referenced by impeller::testing::TEST().

◆ operator==()

constexpr bool impeller::Range::operator== ( const Range o) const
inlineconstexpr

Definition at line 22 of file range.h.

22  {
23  return offset == o.offset && length == o.length;
24  }

References length, and offset.

Member Data Documentation

◆ length

◆ offset


The documentation for this struct was generated from the following file: