Lines Matching refs:native
169 ($name:ident, $native:ident) => {
181 ($name:ident, $native:ident, "floating point number") => {
183 impl_dbg_trait!($name, $native);
193 ($name:ident, $native:ident, "unsigned integer") => {
194 impl_dbg_traits!($name, $native, @all_types);
196 ($name:ident, $native:ident, "signed integer") => {
197 impl_dbg_traits!($name, $native, @all_types);
199 ($name:ident, $native:ident, @all_types) => {
200 impl_dbg_trait!($name, $native);
205 ($name:ident, $native:ident, $trait:ident) => {
216 ($name:ident, $native:ident, "floating point number") => {
218 impl_fmt_trait!($name, $native, Display);
220 ($name:ident, $native:ident, "unsigned integer") => {
221 impl_fmt_traits!($name, $native, @all_types);
223 ($name:ident, $native:ident, "signed integer") => {
224 impl_fmt_traits!($name, $native, @all_types);
226 ($name:ident, $native:ident, @all_types) => {
227 impl_fmt_trait!($name, $native, Display);
228 impl_fmt_trait!($name, $native, Octal);
229 impl_fmt_trait!($name, $native, LowerHex);
230 impl_fmt_trait!($name, $native, UpperHex);
231 impl_fmt_trait!($name, $native, Binary);
236 ($name:ident, $native:ident, "floating point number") => {
237 impl_ops_traits!($name, $native, @all_types);
238 impl_ops_traits!($name, $native, @signed_integer_floating_point);
247 ($name:ident, $native:ident, "unsigned integer") => {
248 impl_ops_traits!($name, $native, @signed_unsigned_integer);
249 impl_ops_traits!($name, $native, @all_types);
251 ($name:ident, $native:ident, "signed integer") => {
252 impl_ops_traits!($name, $native, @signed_unsigned_integer);
253 impl_ops_traits!($name, $native, @signed_integer_floating_point);
254 impl_ops_traits!($name, $native, @all_types);
256 ($name:ident, $native:ident, @signed_unsigned_integer) => {
257 …impl_ops_traits!(@without_byteorder_swap $name, $native, BitAnd, bitand, BitAndAssign, bitand_assi…
258 … impl_ops_traits!(@without_byteorder_swap $name, $native, BitOr, bitor, BitOrAssign, bitor_assign);
259 …impl_ops_traits!(@without_byteorder_swap $name, $native, BitXor, bitxor, BitXorAssign, bitxor_assi…
260 impl_ops_traits!(@with_byteorder_swap $name, $native, Shl, shl, ShlAssign, shl_assign);
261 impl_ops_traits!(@with_byteorder_swap $name, $native, Shr, shr, ShrAssign, shr_assign);
268 let self_native = $native::from_ne_bytes(self.0);
287 impl<O: ByteOrder> PartialOrd<$native> for $name<O> {
289 fn partial_cmp(&self, other: &$native) -> Option<Ordering> {
294 ($name:ident, $native:ident, @signed_integer_floating_point) => {
300 let self_native: $native = self.get();
306 ($name:ident, $native:ident, @all_types) => {
307 impl_ops_traits!(@with_byteorder_swap $name, $native, Add, add, AddAssign, add_assign);
308 impl_ops_traits!(@with_byteorder_swap $name, $native, Div, div, DivAssign, div_assign);
309 impl_ops_traits!(@with_byteorder_swap $name, $native, Mul, mul, MulAssign, mul_assign);
310 impl_ops_traits!(@with_byteorder_swap $name, $native, Rem, rem, RemAssign, rem_assign);
311 impl_ops_traits!(@with_byteorder_swap $name, $native, Sub, sub, SubAssign, sub_assign);
313 …(@with_byteorder_swap $name:ident, $native:ident, $trait:ident, $method:ident, $trait_assign:ident…
319 let self_native: $native = self.get();
320 let rhs_native: $native = rhs.get();
326 impl<O: ByteOrder> core::ops::$trait<$name<O>> for $native {
331 let rhs_native: $native = rhs.get();
337 impl<O: ByteOrder> core::ops::$trait<$native> for $name<O> {
341 fn $method(self, rhs: $native) -> $name<O> {
342 let self_native: $native = self.get();
355 impl<O: ByteOrder> core::ops::$trait_assign<$name<O>> for $native {
358 let rhs_native: $native = rhs.get();
363 impl<O: ByteOrder> core::ops::$trait_assign<$native> for $name<O> {
365 fn $method_assign(&mut self, rhs: $native) {
376 …(@without_byteorder_swap $name:ident, $native:ident, $trait:ident, $method:ident, $trait_assign:id…
382 let self_native = $native::from_ne_bytes(self.0);
383 let rhs_native = $native::from_ne_bytes(rhs.0);
389 impl<O: ByteOrder> core::ops::$trait<$name<O>> for $native {
395 let rhs_native = $native::from_ne_bytes(rhs.0);
399 let slf_native = $native::from_ne_bytes(slf_byteorder.0);
407 impl<O: ByteOrder> core::ops::$trait<$native> for $name<O> {
411 fn $method(self, rhs: $native) -> $name<O> {
415 let rhs_native = $native::from_ne_bytes(rhs_byteorder.0);
417 let slf_native = $native::from_ne_bytes(self.0);
432 impl<O: ByteOrder> core::ops::$trait_assign<$name<O>> for $native {
442 impl<O: ByteOrder> core::ops::$trait_assign<$native> for $name<O> {
444 fn $method_assign(&mut self, rhs: $native) {
483 $native:ident,
499 `", stringify!($name), "` is like the native `", stringify!($native), "` type with
507 `",stringify!($native), "` using the [`get`] method, or updated in place with
511 has endianness `O` and that, b) the layout of `", stringify!($native), "` has
590 pub const fn new(n: $native) -> $name<O> {
606 pub const fn get(self) -> $native {
618 pub fn set(&mut self, n: $native) {
642 impl<O: ByteOrder> From<$name<O>> for $native {
644 fn from(x: $name<O>) -> $native {
649 impl<O: ByteOrder> From<$native> for $name<O> {
651 fn from(x: $native) -> $name<O> {
670 $native::try_from(x).map($name::new)
722 impl<O: ByteOrder> PartialEq<$native> for $name<O> {
724 fn eq(&self, other: &$native) -> bool {
729 impl_dbg_traits!($name, $native, $number_kind);
730 impl_fmt_traits!($name, $native, $number_kind);
731 impl_ops_traits!($name, $native, $number_kind);
1116 fn new(native: Self::Native) -> Self; in new()
1118 fn set(&mut self, native: Self::Native); in set()
1162 ($name:ident, $native:ident, $sign:ident $(, @$float:ident)?) => {
1163 impl Native for $native {
1169 const ZERO: $native = 0 as $native;
1170 const MAX_VALUE: $native = $native::MAX;
1179 type Native = $native;
1180 type ByteArray = [u8; mem::size_of::<$native>()];
1184 fn new(native: $native) -> $name<O> {
1185 $name::new(native)
1188 fn get(self) -> $native {
1192 fn set(&mut self, native: $native) {
1193 $name::set(self, native)
1196 fn from_bytes(bytes: [u8; mem::size_of::<$native>()]) -> $name<O> {
1200 fn into_bytes(self) -> [u8; mem::size_of::<$native>()] {
1201 <[u8; mem::size_of::<$native>()]>::from(self)
1352 let native = T::Native::rand(&mut r); in test_endian() localVariable
1354 bytes.as_mut_bytes().copy_from_slice(native.as_bytes()); in test_endian()
1358 let mut from_native = T::new(native); in test_endian()
1362 from_native.get().assert_eq_or_nan(native); in test_endian()
1363 from_bytes.get().assert_eq_or_nan(native); in test_endian()