``` 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
```
```#[inline]
pub fn is_valid(x: f32) -> bool {
!(x.is_nan() || x.is_infinite())
}

/// Gets the next power of two for a given value
///
/// # Examples
/// ```
/// use vex::next_power_of_two;
/// let n = next_power_of_two(1);
/// assert_eq!(n, 2);
/// ```
/// ```
/// use vex::next_power_of_two;
/// let n = next_power_of_two(2);
/// assert_eq!(n, 4);
/// ```
#[inline]
pub fn next_power_of_two(x: i32) -> i32 {
let mut r = x;
r |= r >> 1;
r |= r >> 2;
r |= r >> 4;
r |= r >> 8;
r |= r >> 16;
r + 1
}

/// Determines whether or not a given value is a power of two
///
/// # Examples
/// ```
/// use vex::is_power_of_two;
/// let n = is_power_of_two(1);
/// assert_eq!(n, true);
/// ```
/// ```
/// use vex::is_power_of_two;
/// let n = is_power_of_two(2);
/// assert_eq!(n, true);
/// ```
/// ```
/// use vex::is_power_of_two;
/// let n = is_power_of_two(3);
/// assert_eq!(n, false);
/// ```
#[inline]
pub fn is_power_of_two(x: i32) -> bool {
x > 0 && (x & (x - 1)) == 0
}

/// Returns 1 or -1 depending on the sign of the input value
///
/// # Examples
/// ```
/// use vex::sign;
/// let mul = sign(1234.0);
/// assert_eq!(mul, 1.0);
/// ```
/// ```
/// use vex::sign;
/// let mul = sign(-1234.0);
/// assert_eq!(mul, -1.0);
/// ```
#[inline]
pub fn sign(x: f32) -> f32 {
if x >= 0.0 {
1.0
} else {
-1.0
}
}

pub trait Matrix<T> {
fn transform_point(&self, point: &T) -> T;
}
```