diff options
| author | bors <bors@rust-lang.org> | 2014-05-14 09:21:25 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-14 09:21:25 -0700 |
| commit | 1a1645d3b1986b494087a3d3ab608e029432de20 (patch) | |
| tree | e1d29f652e68dcb64bfa794f4aa1dc6f9d3b06b8 /src/rustllvm/RustWrapper.cpp | |
| parent | 96bcadc1813b069869219163f90f6b0299d63132 (diff) | |
| parent | 1595885501897a2827d11afa193adda8771a967d (diff) | |
| download | rust-1a1645d3b1986b494087a3d3ab608e029432de20.tar.gz rust-1a1645d3b1986b494087a3d3ab608e029432de20.zip | |
auto merge of #14009 : jcmoyer/rust/bitflags-complement, r=alexcrichton
I feel that this is a very vital, missing piece of functionality. This adds on to #13072.
Only bits used in the definition of the bitflag are considered for the universe set. This is a bit safer than simply inverting all of the bits in the wrapped value.
```rust
bitflags!(flags Flags: u32 {
FlagA = 0x00000001,
FlagB = 0x00000010,
FlagC = 0x00000100,
FlagABC = FlagA.bits
| FlagB.bits
| FlagC.bits
})
...
// `Not` implements set complement
assert!(!(FlagB | FlagC) == FlagA);
// `all` and `is_all` are the inverses of `empty` and `is_empty`
assert!(Flags::all() - FlagA == !FlagA);
assert!(FlagABC.is_all());
```
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
