1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
Copyright 2024 Owain Davies
SPDX-License-Identifier: Apache-2.0 OR MIT
*/
use crate::Arbi;
impl Arbi {
/// A constant `Arbi` integer representing `0`.
pub const ZERO: Arbi = Arbi::new();
/// Return an `Arbi` integer with value `0`.
///
/// Equivalent to [`Arbi::new()`].
///
/// # Examples
/// ```
/// use arbi::Arbi;
/// let zero = Arbi::zero();
/// assert_eq!(zero, 0);
/// ```
///
/// # Complexity
/// \\( O(1) \\)
#[inline(always)]
pub const fn zero() -> Self {
Arbi::new()
}
/// Return an `Arbi` integer with value `1`.
///
/// # Examples
/// ```
/// use arbi::Arbi;
/// let one = Arbi::one();
/// assert_eq!(one, 1);
/// ```
///
/// # Complexity
/// \\( O(1) \\)
#[inline(always)]
pub fn one() -> Self {
Arbi::from(1)
}
/// Return an `Arbi` integer with value `-1`.
///
/// # Examples
/// ```
/// use arbi::Arbi;
/// let neg_one = Arbi::neg_one();
/// assert_eq!(neg_one, -1);
/// ```
///
/// # Complexity
/// \\( O(1) \\)
#[inline(always)]
pub fn neg_one() -> Self {
Arbi::from(-1)
}
}