1#![allow(non_snake_case)]
2
3use crate::prelude::*;
4
5#[cfg_attr(feature = "use_attributes", in_hacspec)]
8pub fn U16_to_le_bytes(x: U16) -> U16Word {
9 U16Word::from_vec(U16::to_le_bytes(&[x]))
10}
11
12#[cfg_attr(feature = "use_attributes", in_hacspec)]
13pub fn U16_to_be_bytes(x: U16) -> U16Word {
14 U16Word::from_vec(U16::to_be_bytes(&[x]))
15}
16
17#[cfg_attr(feature = "use_attributes", in_hacspec)]
18pub fn U16_from_be_bytes(s: U16Word) -> U16 {
19 U16::from_be_bytes(&s.0)[0]
20}
21
22#[cfg_attr(feature = "use_attributes", in_hacspec)]
23pub fn U16_from_le_bytes(s: U16Word) -> U16 {
24 U16::from_le_bytes(&s.0)[0]
25}
26
27#[cfg_attr(feature = "use_attributes", in_hacspec)]
30pub fn U32_to_le_bytes(x: U32) -> U32Word {
31 U32Word::from_vec(U32::to_le_bytes(&[x]))
32}
33
34#[cfg_attr(feature = "use_attributes", in_hacspec)]
35pub fn U32_to_be_bytes(x: U32) -> U32Word {
36 U32Word::from_vec(U32::to_be_bytes(&[x]))
37}
38
39#[cfg_attr(feature = "use_attributes", in_hacspec)]
40pub fn U32_from_be_bytes(s: U32Word) -> U32 {
41 U32::from_be_bytes(&s.0)[0]
42}
43
44#[cfg_attr(feature = "use_attributes", in_hacspec)]
45pub fn U32_from_le_bytes(s: U32Word) -> U32 {
46 U32::from_le_bytes(&s.0)[0]
47}
48
49#[cfg_attr(feature = "use_attributes", in_hacspec)]
52pub fn U64_to_le_bytes(x: U64) -> U64Word {
53 U64Word::from_vec(U64::to_le_bytes(&[x]))
54}
55
56#[cfg_attr(feature = "use_attributes", in_hacspec)]
57pub fn U64_to_be_bytes(x: U64) -> U64Word {
58 U64Word::from_vec(U64::to_be_bytes(&[x]))
59}
60
61#[cfg_attr(feature = "use_attributes", in_hacspec)]
62pub fn U64_from_be_bytes(s: U64Word) -> U64 {
63 U64::from_be_bytes(&s.0)[0]
64}
65
66#[cfg_attr(feature = "use_attributes", in_hacspec)]
67pub fn U64_from_le_bytes(s: U64Word) -> U64 {
68 U64::from_le_bytes(&s.0)[0]
69}
70
71#[cfg_attr(feature = "use_attributes", in_hacspec)]
74pub fn U128_to_le_bytes(x: U128) -> U128Word {
75 U128Word::from_vec(U128::to_le_bytes(&[x]))
76}
77
78#[cfg_attr(feature = "use_attributes", in_hacspec)]
79pub fn U128_to_be_bytes(x: U128) -> U128Word {
80 U128Word::from_vec(U128::to_be_bytes(&[x]))
81}
82
83#[cfg_attr(feature = "use_attributes", in_hacspec)]
84pub fn U128_from_be_bytes(s: U128Word) -> U128 {
85 U128::from_be_bytes(&s.0)[0]
86}
87
88#[cfg_attr(feature = "use_attributes", in_hacspec)]
89pub fn U128_from_le_bytes(s: U128Word) -> U128 {
90 U128::from_le_bytes(&s.0)[0]
91}
92
93#[cfg_attr(feature = "use_attributes", in_hacspec)]
96pub fn u16_to_le_bytes(x: u16) -> u16Word {
97 u16Word::from_array(u16::to_le_bytes(x))
98}
99
100#[cfg_attr(feature = "use_attributes", in_hacspec)]
101pub fn u16_to_be_bytes(x: u16) -> u16Word {
102 u16Word::from_array(u16::to_be_bytes(x))
103}
104
105#[cfg_attr(feature = "use_attributes", in_hacspec)]
106pub fn u16_from_be_bytes(s: u16Word) -> u16 {
107 u16::from_be_bytes(s.0)
108}
109
110#[cfg_attr(feature = "use_attributes", in_hacspec)]
111pub fn u16_from_le_bytes(s: u16Word) -> u16 {
112 u16::from_le_bytes(s.0)
113}
114
115#[cfg_attr(feature = "use_attributes", in_hacspec)]
118pub fn u32_to_le_bytes(x: u32) -> u32Word {
119 u32Word::from_array(u32::to_le_bytes(x))
120}
121
122#[cfg_attr(feature = "use_attributes", in_hacspec)]
123pub fn u32_to_be_bytes(x: u32) -> u32Word {
124 u32Word::from_array(u32::to_be_bytes(x))
125}
126
127#[cfg_attr(feature = "use_attributes", in_hacspec)]
128pub fn u32_from_be_bytes(s: u32Word) -> u32 {
129 u32::from_be_bytes(s.0)
130}
131
132#[cfg_attr(feature = "use_attributes", in_hacspec)]
133pub fn u32_from_le_bytes(s: u32Word) -> u32 {
134 u32::from_le_bytes(s.0)
135}
136
137#[cfg_attr(feature = "use_attributes", in_hacspec)]
140pub fn u64_to_le_bytes(x: u64) -> u64Word {
141 u64Word::from_array(u64::to_le_bytes(x))
142}
143
144#[cfg_attr(feature = "use_attributes", in_hacspec)]
145pub fn u64_to_be_bytes(x: u64) -> u64Word {
146 u64Word::from_array(u64::to_be_bytes(x))
147}
148
149#[cfg_attr(feature = "use_attributes", in_hacspec)]
150pub fn u64_from_be_bytes(s: u64Word) -> u64 {
151 u64::from_be_bytes(s.0)
152}
153
154#[cfg_attr(feature = "use_attributes", in_hacspec)]
155pub fn u64_from_le_bytes(s: u64Word) -> u64 {
156 u64::from_le_bytes(s.0)
157}
158
159#[cfg_attr(feature = "use_attributes", in_hacspec)]
162pub fn u128_to_le_bytes(x: u128) -> u128Word {
163 u128Word::from_array(u128::to_le_bytes(x))
164}
165
166#[cfg_attr(feature = "use_attributes", in_hacspec)]
167pub fn u128_to_be_bytes(x: u128) -> u128Word {
168 u128Word::from_array(u128::to_be_bytes(x))
169}
170
171#[cfg_attr(feature = "use_attributes", in_hacspec)]
172pub fn u128_from_be_bytes(s: u128Word) -> u128 {
173 u128::from_be_bytes(s.0)
174}
175
176#[cfg_attr(feature = "use_attributes", in_hacspec)]
177pub fn u128_from_le_bytes(s: u128Word) -> u128 {
178 u128::from_le_bytes(s.0)
179}