From 0507054675a1bbedcc0d616d67cc782715fd7df5 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 16 Jan 2025 21:01:30 +1000 Subject: [PATCH] Common: Add vector rsize() --- src/common/gsvector_neon.h | 2 ++ src/common/gsvector_nosimd.h | 1 + src/common/gsvector_sse.h | 1 + 3 files changed, 4 insertions(+) diff --git a/src/common/gsvector_neon.h b/src/common/gsvector_neon.h index 1eaf2fba8..9d8487e0f 100644 --- a/src/common/gsvector_neon.h +++ b/src/common/gsvector_neon.h @@ -1180,6 +1180,8 @@ public: 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 diff --git a/src/common/gsvector_nosimd.h b/src/common/gsvector_nosimd.h index 32817ed1f..8977670bb 100644 --- a/src/common/gsvector_nosimd.h +++ b/src/common/gsvector_nosimd.h @@ -963,6 +963,7 @@ public: 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); } diff --git a/src/common/gsvector_sse.h b/src/common/gsvector_sse.h index 358acb8ca..986c4b6fe 100644 --- a/src/common/gsvector_sse.h +++ b/src/common/gsvector_sse.h @@ -1082,6 +1082,7 @@ public: 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); }