Skip to content

Commit

Permalink
Common: Add vector rsize()
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jan 16, 2025
1 parent 9377198 commit 0507054
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/gsvector_neon.h
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,8 @@ class alignas(16) GSVector4i
ALWAYS_INLINE s32 width() const { return right - left; }
ALWAYS_INLINE s32 height() const { return bottom - top; }

ALWAYS_INLINE GSVector2i rsize() const { return zwzw().sub32(xyxy()).xy(); }

ALWAYS_INLINE bool rempty() const
{
// !any((x, y) < (z, w)) i.e. !not_empty
Expand Down
1 change: 1 addition & 0 deletions src/common/gsvector_nosimd.h
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ class alignas(16) GSVector4i
ALWAYS_INLINE s32 width() const { return right - left; }
ALWAYS_INLINE s32 height() const { return bottom - top; }

ALWAYS_INLINE GSVector2i rsize() const { return GSVector2i(width(), height()); }
ALWAYS_INLINE bool rempty() const { return (lt32(zwzw()).mask() != 0x00ff); }
ALWAYS_INLINE bool rvalid() const { return ((ge32(zwzw()).mask() & 0xff) == 0); }

Expand Down
1 change: 1 addition & 0 deletions src/common/gsvector_sse.h
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ class alignas(16) GSVector4i
ALWAYS_INLINE s32 width() const { return right - left; }
ALWAYS_INLINE s32 height() const { return bottom - top; }

ALWAYS_INLINE GSVector2i rsize() const { return zwzw().sub32(xyxy()).xy(); }
ALWAYS_INLINE bool rempty() const { return (lt32(zwzw()).mask() != 0x00ff); }
ALWAYS_INLINE bool rvalid() const { return ((ge32(zwzw()).mask() & 0xff) == 0); }

Expand Down

0 comments on commit 0507054

Please sign in to comment.