Skip to content

Commit 0cad0c6

Browse files
committed
---
yaml --- r: 11247 b: refs/heads/master c: acc57a4 h: refs/heads/master i: 11245: 2805a6f 11243: 711ed68 11239: a8bb4af 11231: da3b12a v: v3
1 parent 52b254d commit 0cad0c6

File tree

11 files changed

+47
-2
lines changed

11 files changed

+47
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 2784314a1ff4f9b5230abb44c86b09d74d6b5e73
2+
refs/heads/master: acc57a44fde9e60163f3d4700bdca453f8a23a11
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/i16.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ fn range(lo: i16, hi: i16, it: fn(i16)) {
2929
let i = lo;
3030
while i < hi { it(i); i += 1i16; }
3131
}
32+
33+
#[doc = "Computes the bitwise complement"]
34+
fn compl(i: i16) -> i16 {
35+
u16::compl(i as u16) as i16
36+
}

trunk/src/libcore/i32.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ fn range(lo: i32, hi: i32, it: fn(i32)) {
2929
let i = lo;
3030
while i < hi { it(i); i += 1i32; }
3131
}
32+
33+
#[doc = "Computes the bitwise complement"]
34+
fn compl(i: i32) -> i32 {
35+
u32::compl(i as u32) as i32
36+
}

trunk/src/libcore/i64.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ fn range(lo: i64, hi: i64, it: fn(i64)) {
2929
let i = lo;
3030
while i < hi { it(i); i += 1i64; }
3131
}
32+
33+
#[doc = "Computes the bitwise complement"]
34+
fn compl(i: i64) -> i64 {
35+
u64::compl(i as u64) as i64
36+
}

trunk/src/libcore/i8.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ fn range(lo: i8, hi: i8, it: fn(i8)) {
2929
let i = lo;
3030
while i < hi { it(i); i += 1i8; }
3131
}
32+
33+
#[doc = "Computes the bitwise complement"]
34+
fn compl(i: i8) -> i8 {
35+
u8::compl(i as u8) as i8
36+
}

trunk/src/libcore/int.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ fn pow(base: int, exponent: uint) -> int {
186186
ret acc;
187187
}
188188

189+
#[doc = "Computes the bitwise complement"]
190+
fn compl(i: int) -> int {
191+
uint::compl(i as uint) as int
192+
}
193+
189194
#[test]
190195
fn test_from_str() {
191196
assert(from_str("0") == 0);

trunk/src/libcore/u16.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ fn range(lo: u16, hi: u16, it: fn(u16)) {
2929
let i = lo;
3030
while i < hi { it(i); i += 1u16; }
3131
}
32+
33+
#[doc = "Computes the bitwise complement"]
34+
fn compl(i: u16) -> u16 {
35+
max_value ^ i
36+
}

trunk/src/libcore/u32.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ fn range(lo: u32, hi: u32, it: fn(u32)) {
6464
while i < hi { it(i); i += 1u32; }
6565
}
6666

67+
#[doc = "Computes the bitwise complement"]
68+
fn compl(i: u32) -> u32 {
69+
max_value ^ i
70+
}
71+
6772
//
6873
// Local Variables:
6974
// mode: rust

trunk/src/libcore/u64.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,8 @@ fn from_str(buf: str, radix: u64) -> u64 {
134134
}
135135
fail;
136136
}
137+
138+
#[doc = "Computes the bitwise complement"]
139+
fn compl(i: u64) -> u64 {
140+
max_value ^ i
141+
}

trunk/src/libcore/u8.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ fn range(lo: u8, hi: u8, it: fn(u8)) {
6464
while i < hi { it(i); i += 1u8; }
6565
}
6666

67+
#[doc = "Computes the bitwise complement"]
68+
fn compl(i: u8) -> u8 {
69+
max_value ^ i
70+
}
71+
6772
// Local Variables:
6873
// mode: rust;
6974
// fill-column: 78;

trunk/src/libcore/uint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ Function: compl
274274
Computes the bitwise complement.
275275
*/
276276
fn compl(i: uint) -> uint {
277-
uint::max_value ^ i
277+
max_value ^ i
278278
}
279279

280280
#[cfg(test)]

0 commit comments

Comments
 (0)