Skip to content

Commit 8eec970

Browse files
committed
---
yaml --- r: 7067 b: refs/heads/master c: ae225e2 h: refs/heads/master i: 7065: 1875b92 7063: e3e740a v: v3
1 parent 6d44b23 commit 8eec970

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: fefae72a53a61c256481328ed29aafb725056f5c
2+
refs/heads/master: ae225e2b6c8dfe7a24444bd5b11b8b21df7d5f9d

trunk/src/libcore/u32.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,49 @@ Return the maximal value for a u32
1616
*/
1717
const max_value: u32 = 0xffff_ffffu32;
1818

19+
/* Function: add */
20+
pure fn add(x: u32, y: u32) -> u32 { ret x + y; }
21+
22+
/* Function: sub */
23+
pure fn sub(x: u32, y: u32) -> u32 { ret x - y; }
24+
25+
/* Function: mul */
26+
pure fn mul(x: u32, y: u32) -> u32 { ret x * y; }
27+
28+
/* Function: div */
29+
pure fn div(x: u32, y: u32) -> u32 { ret x / y; }
30+
31+
/* Function: rem */
32+
pure fn rem(x: u32, y: u32) -> u32 { ret x % y; }
33+
34+
/* Predicate: lt */
35+
pure fn lt(x: u32, y: u32) -> bool { ret x < y; }
36+
37+
/* Predicate: le */
38+
pure fn le(x: u32, y: u32) -> bool { ret x <= y; }
39+
40+
/* Predicate: eq */
41+
pure fn eq(x: u32, y: u32) -> bool { ret x == y; }
42+
43+
/* Predicate: ne */
44+
pure fn ne(x: u32, y: u32) -> bool { ret x != y; }
45+
46+
/* Predicate: ge */
47+
pure fn ge(x: u32, y: u32) -> bool { ret x >= y; }
48+
49+
/* Predicate: gt */
50+
pure fn gt(x: u32, y: u32) -> bool { ret x > y; }
51+
52+
/*
53+
Function: range
54+
55+
Iterate over the range [`lo`..`hi`)
56+
*/
57+
fn range(lo: u32, hi: u32, it: block(u32)) {
58+
let i = lo;
59+
while i < hi { it(i); i += 1u32; }
60+
}
61+
1962
//
2063
// Local Variables:
2164
// mode: rust

trunk/src/libcore/u64.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,49 @@ Return the maximal value for a u64
1616
*/
1717
const max_value: u64 = 18446744073709551615u64;
1818

19+
/* Function: add */
20+
pure fn add(x: u64, y: u64) -> u64 { ret x + y; }
21+
22+
/* Function: sub */
23+
pure fn sub(x: u64, y: u64) -> u64 { ret x - y; }
24+
25+
/* Function: mul */
26+
pure fn mul(x: u64, y: u64) -> u64 { ret x * y; }
27+
28+
/* Function: div */
29+
pure fn div(x: u64, y: u64) -> u64 { ret x / y; }
30+
31+
/* Function: rem */
32+
pure fn rem(x: u64, y: u64) -> u64 { ret x % y; }
33+
34+
/* Predicate: lt */
35+
pure fn lt(x: u64, y: u64) -> bool { ret x < y; }
36+
37+
/* Predicate: le */
38+
pure fn le(x: u64, y: u64) -> bool { ret x <= y; }
39+
40+
/* Predicate: eq */
41+
pure fn eq(x: u64, y: u64) -> bool { ret x == y; }
42+
43+
/* Predicate: ne */
44+
pure fn ne(x: u64, y: u64) -> bool { ret x != y; }
45+
46+
/* Predicate: ge */
47+
pure fn ge(x: u64, y: u64) -> bool { ret x >= y; }
48+
49+
/* Predicate: gt */
50+
pure fn gt(x: u64, y: u64) -> bool { ret x > y; }
51+
52+
/*
53+
Function: range
54+
55+
Iterate over the range [`lo`..`hi`)
56+
*/
57+
fn range(lo: u64, hi: u64, it: block(u64)) {
58+
let i = lo;
59+
while i < hi { it(i); i += 1u64; }
60+
}
61+
1962
/*
2063
Function: to_str
2164

0 commit comments

Comments
 (0)