Skip to content

Commit

Permalink
align spec for difference to actual behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jul 14, 2023
1 parent ea40e7f commit 5b171dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec.md
Expand Up @@ -407,7 +407,12 @@ The following are examples of the complement of a flags value:

#### Difference

The intersection of a source flags value with the complement of a target flags value (`&!`), truncating the result.
The bitwise union (`|`) of the bits in one flags value and the bitwise negation (`!`) of the bits in another.

----

This operation is not equivalent to the intersection of one flags value with the complement of another (`&!`).
The former will truncate the result, where difference will not.

----

Expand All @@ -416,7 +421,7 @@ The following are examples of the difference between two flags values:
```rust
0b0000_0001 & !0b0000_0010 = 0b0000_0001
0b0000_1101 & !0b0000_0011 = 0b0000_1100
0b1111_1111 & !0b0000_0001 = 0b0000_1110
0b1111_1111 & !0b0000_0001 = 0b1111_1110
```

### Iteration
Expand Down

0 comments on commit 5b171dc

Please sign in to comment.