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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#![allow(non_snake_case)]

use crate::prelude::*;

// U32

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U16_to_le_bytes(x: U16) -> U16Word {
    U16Word::from_vec(U16::to_le_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U16_to_be_bytes(x: U16) -> U16Word {
    U16Word::from_vec(U16::to_be_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U16_from_be_bytes(s: U16Word) -> U16 {
    U16::from_be_bytes(&s.0)[0]
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U16_from_le_bytes(s: U16Word) -> U16 {
    U16::from_le_bytes(&s.0)[0]
}

// U32

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U32_to_le_bytes(x: U32) -> U32Word {
    U32Word::from_vec(U32::to_le_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U32_to_be_bytes(x: U32) -> U32Word {
    U32Word::from_vec(U32::to_be_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U32_from_be_bytes(s: U32Word) -> U32 {
    U32::from_be_bytes(&s.0)[0]
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U32_from_le_bytes(s: U32Word) -> U32 {
    U32::from_le_bytes(&s.0)[0]
}

// U64

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U64_to_le_bytes(x: U64) -> U64Word {
    U64Word::from_vec(U64::to_le_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U64_to_be_bytes(x: U64) -> U64Word {
    U64Word::from_vec(U64::to_be_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U64_from_be_bytes(s: U64Word) -> U64 {
    U64::from_be_bytes(&s.0)[0]
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U64_from_le_bytes(s: U64Word) -> U64 {
    U64::from_le_bytes(&s.0)[0]
}

// U128

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U128_to_le_bytes(x: U128) -> U128Word {
    U128Word::from_vec(U128::to_le_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U128_to_be_bytes(x: U128) -> U128Word {
    U128Word::from_vec(U128::to_be_bytes(&[x]))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U128_from_be_bytes(s: U128Word) -> U128 {
    U128::from_be_bytes(&s.0)[0]
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn U128_from_le_bytes(s: U128Word) -> U128 {
    U128::from_le_bytes(&s.0)[0]
}

// u16

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u16_to_le_bytes(x: u16) -> u16Word {
    u16Word::from_array(u16::to_le_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u16_to_be_bytes(x: u16) -> u16Word {
    u16Word::from_array(u16::to_be_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u16_from_be_bytes(s: u16Word) -> u16 {
    u16::from_be_bytes(s.0)
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u16_from_le_bytes(s: u16Word) -> u16 {
    u16::from_le_bytes(s.0)
}

// u32

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u32_to_le_bytes(x: u32) -> u32Word {
    u32Word::from_array(u32::to_le_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u32_to_be_bytes(x: u32) -> u32Word {
    u32Word::from_array(u32::to_be_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u32_from_be_bytes(s: u32Word) -> u32 {
    u32::from_be_bytes(s.0)
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u32_from_le_bytes(s: u32Word) -> u32 {
    u32::from_le_bytes(s.0)
}

// u64

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u64_to_le_bytes(x: u64) -> u64Word {
    u64Word::from_array(u64::to_le_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u64_to_be_bytes(x: u64) -> u64Word {
    u64Word::from_array(u64::to_be_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u64_from_be_bytes(s: u64Word) -> u64 {
    u64::from_be_bytes(s.0)
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u64_from_le_bytes(s: u64Word) -> u64 {
    u64::from_le_bytes(s.0)
}

// u128

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u128_to_le_bytes(x: u128) -> u128Word {
    u128Word::from_array(u128::to_le_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u128_to_be_bytes(x: u128) -> u128Word {
    u128Word::from_array(u128::to_be_bytes(x))
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u128_from_be_bytes(s: u128Word) -> u128 {
    u128::from_be_bytes(s.0)
}

#[cfg_attr(feature = "use_attributes", in_hacspec)]
pub fn u128_from_le_bytes(s: u128Word) -> u128 {
    u128::from_le_bytes(s.0)
}