# HG changeset patch # User Jaroslav Hajek # Date 1261859415 -3600 # Node ID 8db5553c24f54ec321a44044b8ed32ca8b250b1f # Parent 83bb2a78c07d28f30553351c62c52bba6bf48efa optimize xor diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-12-26 Jaroslav Hajek + + * miscellaneous/xor.m: Optimize. + 2009-12-25 Jaroslav Hajek * general/issquare.m: Do not check type. diff --git a/scripts/miscellaneous/xor.m b/scripts/miscellaneous/xor.m --- a/scripts/miscellaneous/xor.m +++ b/scripts/miscellaneous/xor.m @@ -33,7 +33,8 @@ if (nargin == 2) if (isscalar (x) || isscalar (y) || size_equal (x, y)) - z = logical ((x | y) - (x & y)); + ## Typecast to logicals is necessary for other numeric types. + z = logical (x) != logical (y); else error ("xor: x and y must be of common size or scalars"); endif