BigInt and xor
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Mar 24 08:45:34 PDT 2015
Tell me, please, how can I replace this code?
import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;
void main() {
BigInt[10] bitArr;
ulong n = 18_446_724_073_709_551_614U;
bitArr[0] = format("%b", n).to!BigInt;
writeln(bitArr[0]);
writeln(bitArr[0] ^ 1); // not work
}
Output:
1111111111111111111011011100111101100011000110101011111111111110
1111111111111111111011011100111101100011000110101011111111111111
More information about the Digitalmars-d-learn
mailing list