core: Formulate all unsigned max_values as 0 - 1 for consistency

This commit is contained in:
Brian Anderson 2012-02-12 00:00:09 -08:00
parent 4838d7860e
commit 5fb0906f43
3 changed files with 3 additions and 3 deletions

View file

@ -16,7 +16,7 @@ Const: max_value
Return the maximal value for a u32
*/
const max_value: u32 = 0xffff_ffffu32;
const max_value: u32 = 0u32 - 1u32;
pure fn min(x: u32, y: u32) -> u32 { if x < y { x } else { y } }
pure fn max(x: u32, y: u32) -> u32 { if x > y { x } else { y } }

View file

@ -16,7 +16,7 @@ Const: max_value
Return the maximal value for a u64
*/
const max_value: u64 = 18446744073709551615u64;
const max_value: u64 = 0u64 - 1u64;
pure fn min(x: u64, y: u64) -> u64 { if x < y { x } else { y } }
pure fn max(x: u64, y: u64) -> u64 { if x > y { x } else { y } }

View file

@ -16,7 +16,7 @@ Const: max_value
The maximum value of a u8.
*/
const max_value: u8 = 255u8;
const max_value: u8 = 0u8 - 1u8;
/* Function: add */
pure fn add(x: u8, y: u8) -> u8 { ret x + y; }