Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project('libpisp', 'c', 'cpp',
default_options : [
'werror=true',
'warning_level=2',
'cpp_std=c++17',
'cpp_std=c++20',
'buildtype=release',
],
license : 'BSD-2-Clause')
Expand Down
20 changes: 10 additions & 10 deletions src/libpisp/backend/tiling/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ struct Length2
explicit Length2(int len) : Length2(len, len) {}
int dx, dy;
int operator[](Dir dir) const { return dir == Dir::Y ? dy : dx; }
Length2 operator-(Length2 const &other) { return Length2(dx - other.dx, dy - other.dy); }
Length2 operator/(int num) { return Length2(dx / num, dy / num); }
Length2 operator-(Length2 const &other) const { return Length2(dx - other.dx, dy - other.dy); }
Length2 operator/(int num) const { return Length2(dx / num, dy / num); }
};

inline std::ostream &operator<<(std::ostream &os, Length2 const &l)
Expand All @@ -44,7 +44,7 @@ struct Crop
Crop(int _start, int _end) : start(_start), end(_end) {}
explicit Crop(int crop) : Crop(crop, crop) {}
int start, end;
Crop operator+(Crop const &other) { return Crop(start + other.start, end + other.end); }
Crop operator+(Crop const &other) const { return Crop(start + other.start, end + other.end); }
};

inline std::ostream &operator<<(std::ostream &os, Crop const &c)
Expand All @@ -61,11 +61,11 @@ struct Interval
int End() const { return offset + length; }
void SetStart(int start) { length += (offset - start), offset = start; } // leave End unchanged
void SetEnd(int end) { length = end - offset; }
bool operator==(Interval const &other) { return offset == other.offset && length == other.length; }
bool operator==(Interval const &other) const { return offset == other.offset && length == other.length; }
Interval operator-(Crop const &crop) const { return Interval(offset - crop.start, length - crop.start - crop.end); }
Crop operator-(Interval const &other) { return Crop(other.offset - offset, End() - other.End()); }
bool operator>(Interval const &other) { return offset <= other.offset && End() >= other.End(); } // contains
bool operator<(Interval const &other) { return offset >= other.offset && End() <= other.End(); } // is contained
Crop operator-(Interval const &other) const { return Crop(other.offset - offset, End() - other.End()); }
bool operator>(Interval const &other) const { return offset <= other.offset && End() >= other.End(); } // contains
bool operator<(Interval const &other) const { return offset >= other.offset && End() <= other.End(); } // is contained
Interval &operator|=(int off)
{
if (off < offset)
Expand All @@ -88,7 +88,7 @@ struct Crop2
Crop x, y;
Crop operator[](Dir dir) const { return dir == Dir::Y ? y : x; }
Crop &operator[](Dir dir) { return dir == Dir::Y ? y : x; }
Crop2 operator+(Crop2 const &other) { return Crop2(x + other.x, y + other.y); }
Crop2 operator+(Crop2 const &other) const { return Crop2(x + other.x, y + other.y); }
};

inline std::ostream &operator<<(std::ostream &os, Crop2 const &c)
Expand All @@ -104,8 +104,8 @@ struct Interval2
Interval x, y;
Interval operator[](Dir dir) const { return dir == Dir::Y ? y : x; }
Interval &operator[](Dir dir) { return dir == Dir::Y ? y : x; }
bool operator==(Interval2 const &other) { return x == other.x && y == other.y; }
bool operator!=(Interval2 const &other) { return !(*this == other); }
bool operator==(Interval2 const &other) const { return x == other.x && y == other.y; }
bool operator!=(Interval2 const &other) const { return !(*this == other); }
};

inline std::ostream &operator<<(std::ostream &os, Interval2 const &i)
Expand Down
Loading