aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-26 17:59:57 +0000
committerlloyd <[email protected]>2009-10-26 17:59:57 +0000
commitce2f07c4fc8b6967bc1418b4ab8770393c64bc80 (patch)
treec00284befe1f3e00f3e0e8c491fa315bb9e07192 /src/utils
parent49896908c8a7893586271e353c431bb91b5215a8 (diff)
Add subtraction operators to SIMD_32 classes, needed for XTEA decrypt
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/simd_32/simd_scalar.h16
-rw-r--r--src/utils/simd_32/simd_sse.h10
2 files changed, 26 insertions, 0 deletions
diff --git a/src/utils/simd_32/simd_scalar.h b/src/utils/simd_32/simd_scalar.h
index a6067f115..4b81c183b 100644
--- a/src/utils/simd_32/simd_scalar.h
+++ b/src/utils/simd_32/simd_scalar.h
@@ -96,6 +96,22 @@ class SIMD_Scalar
R3 + other.R3);
}
+ void operator-=(const SIMD_Scalar& other)
+ {
+ R0 -= other.R0;
+ R1 -= other.R1;
+ R2 -= other.R2;
+ R3 -= other.R3;
+ }
+
+ SIMD_Scalar operator-(const SIMD_Scalar& other) const
+ {
+ return SIMD_Scalar(R0 - other.R0,
+ R1 - other.R1,
+ R2 - other.R2,
+ R3 - other.R3);
+ }
+
void operator^=(const SIMD_Scalar& other)
{
R0 ^= other.R0;
diff --git a/src/utils/simd_32/simd_sse.h b/src/utils/simd_32/simd_sse.h
index d9135f1c7..d2ef4b211 100644
--- a/src/utils/simd_32/simd_sse.h
+++ b/src/utils/simd_32/simd_sse.h
@@ -70,6 +70,16 @@ class SIMD_SSE2
return _mm_add_epi32(reg, other.reg);
}
+ void operator-=(const SIMD_SSE2& other)
+ {
+ reg = _mm_sub_epi32(reg, other.reg);
+ }
+
+ SIMD_SSE2 operator-(const SIMD_SSE2& other) const
+ {
+ return _mm_sub_epi32(reg, other.reg);
+ }
+
void operator^=(const SIMD_SSE2& other)
{
reg = _mm_xor_si128(reg, other.reg);