Skip to content

Bitwise complement snippet - #439

Merged
BillWagner merged 2 commits into
dotnet:masterfrom
pkulikov:bitwise-complement-snippet
Nov 3, 2018
Merged

BillWagner merged 2 commits into
dotnet:masterfrom
pkulikov:bitwise-complement-snippet

Conversation

@pkulikov

@pkulikov pkulikov commented Nov 3, 2018 •

Copy link
Copy Markdown
Contributor

Supports dotnet/docs#8829

int c = a & b;
uint a = 0b_1111_1000;
uint b = 0b_1001_1111;
uint c = a & b;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed that to using one type, to eliminate possible confusion.

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this set of changes @pkulikov
I'll :shipit: now.

Thanks again for your continued contributions.

uint b = ~a;
Console.WriteLine(Convert.ToString(b, toBase: 2));
// Output:
// 11110000111100001111000011110011

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the simplicity and clarity of this sample. 🥇

@BillWagner
BillWagner merged commit 63ba91e into dotnet:master Nov 3, 2018
@pkulikov
pkulikov deleted the bitwise-complement-snippet branch November 3, 2018 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants