Skip to content

Commit 9e18aaa

Browse files
committed
Tiny performance tweak.
1 parent 8ba0f1c commit 9e18aaa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Utils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ struct Union
293293
public static void Xor(byte[] dest, int destOffset, byte[] left, int leftOffset, byte[] right, int rightOffset, int byteCount)
294294
{
295295
int i = 0;
296-
if ((destOffset & 7) == 0 && (leftOffset & 7) == 0 && (rightOffset & 7) == 0) // all offsets must be multiples of 8 for long-sized xor
296+
if (((destOffset | leftOffset | rightOffset) & 7) == 0) // all offsets must be multiples of 8 for long-sized xor
297297
{
298298
Union destUnion = new Union { Bytes = dest }, leftUnion = new Union { Bytes = left }, rightBuffer = new Union { Bytes = right };
299299
int longDestOffset = destOffset >> 3, longLeftOffset = leftOffset >> 3, longRightOffset = rightOffset >> 3, longCount = byteCount >> 3;
@@ -306,7 +306,7 @@ public static void Xor(byte[] dest, int destOffset, byte[] left, int leftOffset,
306306
public static void Xor(byte[] dest, int destOffset, byte[] left, int leftOffset, int byteCount)
307307
{
308308
int i = 0;
309-
if ((destOffset & 7) == 0 && (leftOffset & 7) == 0) // all offsets must be multiples of 8 for long-sized xor
309+
if (((destOffset | leftOffset) & 7) == 0) // all offsets must be multiples of 8 for long-sized xor
310310
{
311311
Union destUnion = new Union { Bytes = dest }, leftUnion = new Union { Bytes = left };
312312
int longDestOffset = destOffset >> 3, longLeftOffset = leftOffset >> 3, longCount = byteCount >> 3;

0 commit comments

Comments
 (0)