Function bitXor [src]

r = a ^ b under 2s complement semantics. r may alias with a or b. Asserts that r has enough limbs to store the result. If a and b share the same signedness, the upper bound is @max(a.limbs.len, b.limbs.len). Otherwise, if either a or b is negative but not both, the upper bound is @max(a.limbs.len, b.limbs.len) + 1.

Prototype

pub fn bitXor(r: *Mutable, a: Const, b: Const) void

Parameters

r: *Mutablea: Constb: Const

Source

pub fn bitXor(r: *Mutable, a: Const, b: Const) void { // Trivial cases, because llsignedxor does not support negative zero. if (a.eqlZero()) { r.copy(b); return; } else if (b.eqlZero()) { r.copy(a); return; } if (a.limbs.len > b.limbs.len) { r.positive = llsignedxor(r.limbs, a.limbs, a.positive, b.limbs, b.positive); r.normalize(a.limbs.len + @intFromBool(a.positive != b.positive)); } else { r.positive = llsignedxor(r.limbs, b.limbs, b.positive, a.limbs, a.positive); r.normalize(b.limbs.len + @intFromBool(a.positive != b.positive)); } }