Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - English

Change language to:
Français - 日本語 - Português

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Elementary Functions > Bitwise operations > bitxor

bitxor

bitwise XOR

Calling Sequence

z = bitxor(x,y)

Parameters

x :

a m-by-n matrix of doubles or a m1-by-m2-by-...-by-mm hypermatrix of doubles or a m-by-n matrix of unsigned integers (uint8, uint16 or uint32). Must contain positive integer values.

y :

a m-by-n matrix of doubles or a m1-by-m2-by-...-by-mm hypermatrix of doubles or a m-by-n matrix of unsigned integers (uint8, uint16 or uint32). Must contain positive integer values.

z :

a m-by-n matrix of doubles or a m1-by-m2-by-...-by-mm hypermatrix of doubles or a m-by-n matrix of unsigned integers.

Description

Given x, y two positive integers, this function returns the decimal number whose the binary form is the XOR of the binary representations of x and y.

Examples

// Compute the bitwise XOR of two matrices of doubles.
x = [0 1 0 1];
y = [0 0 1 1];
z = bitxor(x, y)
expected = [0 1 1 1];

// Compute the bitwise XOR of two matrices of integers.
x = uint8([0 1 0 1]);
y = uint8([0 0 1 1]);
z = bitxor(x, y)

// The types of x and y cannot be mixed (error).
x = [0 1 0 1];
y = uint8([0 0 1 1]);
z = bitxor(x, y)

//  13 is (01101)_2
//  27 is (11011)_2
// XOR is (10110)_2 which is 22.
bitxor(uint8(13), uint8(27))
bitxor(13, 27)

Authors

  • Copyright (C) 2011 - DIGITEO - Michael Baudin
  • Copyright (C) INRIA - Farid BELAHCENE
  • Copyright (C) 2008 - INRIA - Pierre MARECHAL
<< bitset Bitwise operations Complex >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:09:38 CEST 2011