aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2019-01-19 08:25:30 -0500
committerAndrew Gallant <jamslam@gmail.com>2019-01-19 09:01:19 -0500
commit5b3ffeeed2d04ec5051336ea2c6e6d36abc94581 (patch)
treef9acbb831121cbdb934d6d664cc6aa4f0b19a568 /src
parentce4489fc040716d3748c4a4e9705f6416e2abd70 (diff)
downloadbyteorder-5b3ffeeed2d04ec5051336ea2c6e6d36abc94581.tar.gz
i128: enable support for 128-bit integers automatically
This adds a build.rs to byteorder that will set a conditional compilation flag automatically if the current Rust compiler supports 128-bit integers. This makes the i128 feature itself a no-op. We continue to allow the feature to be supplied for backwards compatibility. Addresses https://github.com/TyOverby/bincode/issues/250
Diffstat (limited to 'src')
-rw-r--r--src/io.rs21
-rw-r--r--src/lib.rs285
2 files changed, 154 insertions, 152 deletions
diff --git a/src/io.rs b/src/io.rs
index 74cf9dd..bc49a1c 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -370,7 +370,7 @@ pub trait ReadBytesExt: io::Read {
/// ]);
/// assert_eq!(16947640962301618749969007319746179, rdr.read_u128::<BigEndian>().unwrap());
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_u128<T: ByteOrder>(&mut self) -> Result<u128> {
let mut buf = [0; 16];
@@ -391,14 +391,13 @@ pub trait ReadBytesExt: io::Read {
/// Read a signed 128 bit big-endian integer from a `Read`:
///
/// ```rust
- /// #![feature(i128_type)]
/// use std::io::Cursor;
/// use byteorder::{BigEndian, ReadBytesExt};
///
/// let mut rdr = Cursor::new(vec![0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
/// assert_eq!(i128::min_value(), rdr.read_i128::<BigEndian>().unwrap());
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_i128<T: ByteOrder>(&mut self) -> Result<i128> {
let mut buf = [0; 16];
@@ -457,7 +456,7 @@ pub trait ReadBytesExt: io::Read {
}
/// Reads an unsigned n-bytes integer from the underlying reader.
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_uint128<T: ByteOrder>(&mut self, nbytes: usize) -> Result<u128> {
let mut buf = [0; 16];
@@ -466,7 +465,7 @@ pub trait ReadBytesExt: io::Read {
}
/// Reads a signed n-bytes integer from the underlying reader.
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_int128<T: ByteOrder>(&mut self, nbytes: usize) -> Result<i128> {
let mut buf = [0; 16];
@@ -672,7 +671,7 @@ pub trait ReadBytesExt: io::Read {
/// rdr.read_u128_into::<BigEndian>(&mut dst).unwrap();
/// assert_eq!([517, 768], dst);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_u128_into<T: ByteOrder>(
&mut self,
@@ -822,7 +821,7 @@ pub trait ReadBytesExt: io::Read {
/// rdr.read_i128_into::<BigEndian>(&mut dst).unwrap();
/// assert_eq!([517, 768], dst);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_i128_into<T: ByteOrder>(
&mut self,
@@ -1373,7 +1372,7 @@ pub trait WriteBytesExt: io::Write {
}
/// Writes an unsigned 128 bit integer to the underlying writer.
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_u128<T: ByteOrder>(&mut self, n: u128) -> Result<()> {
let mut buf = [0; 16];
@@ -1382,7 +1381,7 @@ pub trait WriteBytesExt: io::Write {
}
/// Writes a signed 128 bit integer to the underlying writer.
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_i128<T: ByteOrder>(&mut self, n: i128) -> Result<()> {
let mut buf = [0; 16];
@@ -1466,7 +1465,7 @@ pub trait WriteBytesExt: io::Write {
///
/// If the given integer is not representable in the given number of bytes,
/// this method panics. If `nbytes > 16`, this method panics.
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_uint128<T: ByteOrder>(
&mut self,
@@ -1482,7 +1481,7 @@ pub trait WriteBytesExt: io::Write {
///
/// If the given integer is not representable in the given number of bytes,
/// this method panics. If `nbytes > 16`, this method panics.
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_int128<T: ByteOrder>(
&mut self,
diff --git a/src/lib.rs b/src/lib.rs
index fe3808f..63d5170 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,7 +84,7 @@ fn extend_sign(val: u64, nbytes: usize) -> i64 {
(val << shift) as i64 >> shift
}
-#[cfg(feature = "i128")]
+#[cfg(byteorder_i128)]
#[inline]
fn extend_sign128(val: u128, nbytes: usize) -> i128 {
let shift = (16 - nbytes) * 8;
@@ -97,7 +97,7 @@ fn unextend_sign(val: i64, nbytes: usize) -> u64 {
(val << shift) as u64 >> shift
}
-#[cfg(feature = "i128")]
+#[cfg(byteorder_i128)]
#[inline]
fn unextend_sign128(val: i128, nbytes: usize) -> u128 {
let shift = (16 - nbytes) * 8;
@@ -125,7 +125,7 @@ fn pack_size(n: u64) -> usize {
}
}
-#[cfg(feature = "i128")]
+#[cfg(byteorder_i128)]
#[inline]
fn pack_size128(n: u128) -> usize {
if n < 1 << 8 {
@@ -314,7 +314,7 @@ pub trait ByteOrder
/// LittleEndian::write_u128(&mut buf, 1_000_000);
/// assert_eq!(1_000_000, LittleEndian::read_u128(&buf));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn read_u128(buf: &[u8]) -> u128;
/// Reads an unsigned n-bytes integer from `buf`.
@@ -355,7 +355,7 @@ pub trait ByteOrder
/// LittleEndian::write_uint128(&mut buf, 1_000_000, 3);
/// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn read_uint128(buf: &[u8], nbytes: usize) -> u128;
/// Writes an unsigned 16 bit integer `n` to `buf`.
@@ -474,7 +474,7 @@ pub trait ByteOrder
/// LittleEndian::write_u128(&mut buf, 1_000_000);
/// assert_eq!(1_000_000, LittleEndian::read_u128(&buf));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn write_u128(buf: &mut [u8], n: u128);
/// Writes an unsigned integer `n` to `buf` using only `nbytes`.
@@ -515,7 +515,7 @@ pub trait ByteOrder
/// LittleEndian::write_uint128(&mut buf, 1_000_000, 3);
/// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize);
/// Reads a signed 16 bit integer from `buf`.
@@ -645,7 +645,7 @@ pub trait ByteOrder
/// LittleEndian::write_i128(&mut buf, -1_000_000_000);
/// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_i128(buf: &[u8]) -> i128 {
Self::read_u128(buf) as i128
@@ -692,7 +692,7 @@ pub trait ByteOrder
/// LittleEndian::write_int128(&mut buf, -1_000, 3);
/// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_int128(buf: &[u8], nbytes: usize) -> i128 {
extend_sign128(Self::read_uint128(buf, nbytes), nbytes)
@@ -871,7 +871,7 @@ pub trait ByteOrder
/// LittleEndian::write_i128(&mut buf, -1_000_000_000);
/// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_i128(buf: &mut [u8], n: i128) {
Self::write_u128(buf, n as u128)
@@ -918,7 +918,7 @@ pub trait ByteOrder
/// LittleEndian::write_int128(&mut buf, -1_000, 3);
/// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3));
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_int128(buf: &mut [u8], n: i128, nbytes: usize) {
Self::write_uint128(buf, unextend_sign128(n, nbytes), nbytes)
@@ -1062,7 +1062,7 @@ pub trait ByteOrder
/// LittleEndian::read_u128_into(&bytes, &mut numbers_got);
/// assert_eq!(numbers_given, numbers_got);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn read_u128_into(src: &[u8], dst: &mut [u128]);
/// Reads signed 16 bit integers from `src` to `dst`.
@@ -1173,7 +1173,7 @@ pub trait ByteOrder
/// LittleEndian::read_i128_into(&bytes, &mut numbers_got);
/// assert_eq!(numbers_given, numbers_got);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_i128_into(src: &[u8], dst: &mut [i128]) {
let dst = unsafe {
@@ -1332,7 +1332,7 @@ pub trait ByteOrder
/// LittleEndian::read_u128_into(&bytes, &mut numbers_got);
/// assert_eq!(numbers_given, numbers_got);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn write_u128_into(src: &[u128], dst: &mut [u8]);
/// Writes signed 16 bit integers from `src` into `dst`.
@@ -1440,7 +1440,7 @@ pub trait ByteOrder
/// LittleEndian::read_i128_into(&bytes, &mut numbers_got);
/// assert_eq!(numbers_given, numbers_got);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn write_i128_into(src: &[i128], dst: &mut [u8]) {
let src = unsafe {
slice::from_raw_parts(src.as_ptr() as *const u128, src.len())
@@ -1584,7 +1584,7 @@ pub trait ByteOrder
/// BigEndian::from_slice_u128(&mut numbers);
/// assert_eq!(numbers, [5u128.to_be(), 65000u128.to_be()]);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
fn from_slice_u128(numbers: &mut [u128]);
/// Converts the given slice of signed 16 bit integers to a particular
@@ -1679,7 +1679,7 @@ pub trait ByteOrder
/// BigEndian::from_slice_i128(&mut numbers);
/// assert_eq!(numbers, [5i128.to_be(), 65000i128.to_be()]);
/// ```
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn from_slice_i128(src: &mut [i128]) {
let src = unsafe {
@@ -1894,7 +1894,7 @@ impl ByteOrder for BigEndian {
read_num_bytes!(u64, 8, buf, to_be)
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_u128(buf: &[u8]) -> u128 {
read_num_bytes!(u128, 16, buf, to_be)
@@ -1912,7 +1912,7 @@ impl ByteOrder for BigEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_uint128(buf: &[u8], nbytes: usize) -> u128 {
assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len());
@@ -1940,7 +1940,7 @@ impl ByteOrder for BigEndian {
write_num_bytes!(u64, 8, n, buf, to_be);
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_u128(buf: &mut [u8], n: u128) {
write_num_bytes!(u128, 16, n, buf, to_be);
@@ -1959,7 +1959,7 @@ impl ByteOrder for BigEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) {
assert!(pack_size128(n) <= nbytes && nbytes <= 16);
@@ -1988,7 +1988,7 @@ impl ByteOrder for BigEndian {
read_slice!(src, dst, 8, to_be);
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_u128_into(src: &[u8], dst: &mut [u128]) {
read_slice!(src, dst, 16, to_be);
@@ -2021,7 +2021,7 @@ impl ByteOrder for BigEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_u128_into(src: &[u128], dst: &mut [u8]) {
if cfg!(target_endian = "big") {
@@ -2058,7 +2058,7 @@ impl ByteOrder for BigEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn from_slice_u128(numbers: &mut [u128]) {
if cfg!(target_endian = "little") {
@@ -2109,7 +2109,7 @@ impl ByteOrder for LittleEndian {
read_num_bytes!(u64, 8, buf, to_le)
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_u128(buf: &[u8]) -> u128 {
read_num_bytes!(u128, 16, buf, to_le)
@@ -2126,7 +2126,7 @@ impl ByteOrder for LittleEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_uint128(buf: &[u8], nbytes: usize) -> u128 {
assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len());
@@ -2153,7 +2153,7 @@ impl ByteOrder for LittleEndian {
write_num_bytes!(u64, 8, n, buf, to_le);
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_u128(buf: &mut [u8], n: u128) {
write_num_bytes!(u128, 16, n, buf, to_le);
@@ -2169,7 +2169,7 @@ impl ByteOrder for LittleEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) {
assert!(pack_size128(n as u128) <= nbytes && nbytes <= 16);
@@ -2195,7 +2195,7 @@ impl ByteOrder for LittleEndian {
read_slice!(src, dst, 8, to_le);
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn read_u128_into(src: &[u8], dst: &mut [u128]) {
read_slice!(src, dst, 16, to_le);
@@ -2228,7 +2228,7 @@ impl ByteOrder for LittleEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn write_u128_into(src: &[u128], dst: &mut [u8]) {
if cfg!(target_endian = "little") {
@@ -2265,7 +2265,7 @@ impl ByteOrder for LittleEndian {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
#[inline]
fn from_slice_u128(numbers: &mut [u128]) {
if cfg!(target_endian = "big") {
@@ -2307,7 +2307,10 @@ mod test {
use self::quickcheck::{QuickCheck, StdGen, Testable};
use self::rand::thread_rng;
- #[cfg(feature = "i128")] use self::quickcheck::{Arbitrary, Gen};
+ #[cfg(byteorder_i128)]
+ use self::rand::Rng;
+ #[cfg(byteorder_i128)]
+ use self::quickcheck::{Arbitrary, Gen};
pub const U24_MAX: u32 = 16_777_215;
pub const I24_MAX: i32 = 8_388_607;
@@ -2327,7 +2330,7 @@ mod test {
#[derive(Clone, Debug)]
pub struct Wi128<T>(pub T);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
impl<T: Clone> Wi128<T> {
pub fn clone(&self) -> T {
self.0.clone()
@@ -2340,7 +2343,7 @@ mod test {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
impl Arbitrary for Wi128<u128> {
fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<u128> {
let max = calc_max!(::core::u128::MAX, gen.size(), 16);
@@ -2351,7 +2354,7 @@ mod test {
}
}
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
impl Arbitrary for Wi128<i128> {
fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<i128> {
let max = calc_max!(::core::i128::MAX, gen.size(), 16);
@@ -2464,9 +2467,9 @@ mod test {
qc_byte_order!(prop_f32, f32, ::core::u64::MAX as u64, read_f32, write_f32);
qc_byte_order!(prop_f64, f64, ::core::i64::MAX as u64, read_f64, write_f64);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_u128, Wi128<u128>, 16 + 1, read_u128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_i128, Wi128<i128>, 16 + 1, read_i128, write_i128);
qc_byte_order!(prop_uint_1,
@@ -2486,52 +2489,52 @@ mod test {
qc_byte_order!(prop_uint_8,
u64, calc_max!(super::U64_MAX, 8), 8, read_uint, write_uint);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_1,
Wi128<u128>, 1, 1, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_2,
Wi128<u128>, 2, 2, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_3,
Wi128<u128>, 3, 3, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_4,
Wi128<u128>, 4, 4, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_5,
Wi128<u128>, 5, 5, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_6,
Wi128<u128>, 6, 6, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_7,
Wi128<u128>, 7, 7, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_8,
Wi128<u128>, 8, 8, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_9,
Wi128<u128>, 9, 9, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_10,
Wi128<u128>, 10, 10, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_11,
Wi128<u128>, 11, 11, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_12,
Wi128<u128>, 12, 12, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_13,
Wi128<u128>, 13, 13, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_14,
Wi128<u128>, 14, 14, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_15,
Wi128<u128>, 15, 15, read_uint128, write_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_uint128_16,
Wi128<u128>, 16, 16, read_uint128, write_uint128);
@@ -2552,52 +2555,52 @@ mod test {
qc_byte_order!(prop_int_8,
i64, calc_max!(super::I64_MAX, 8), 8, read_int, write_int);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_1,
Wi128<i128>, 1, 1, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_2,
Wi128<i128>, 2, 2, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_3,
Wi128<i128>, 3, 3, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_4,
Wi128<i128>, 4, 4, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_5,
Wi128<i128>, 5, 5, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_6,
Wi128<i128>, 6, 6, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_7,
Wi128<i128>, 7, 7, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_8,
Wi128<i128>, 8, 8, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_9,
Wi128<i128>, 9, 9, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_10,
Wi128<i128>, 10, 10, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_11,
Wi128<i128>, 11, 11, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_12,
Wi128<i128>, 12, 12, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_13,
Wi128<i128>, 13, 13, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_14,
Wi128<i128>, 14, 14, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_15,
Wi128<i128>, 15, 15, read_int128, write_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_byte_order!(prop_int128_16,
Wi128<i128>, 16, 16, read_int128, write_int128);
@@ -2692,9 +2695,9 @@ mod test {
too_small!(small_i64, 7, 0, read_i64, write_i64);
too_small!(small_f32, 3, 0.0, read_f32, write_f32);
too_small!(small_f64, 7, 0.0, read_f64, write_f64);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_u128, 15, 0, read_u128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_i128, 15, 0, read_i128, write_i128);
too_small!(small_uint_1, 1, read_uint);
@@ -2705,35 +2708,35 @@ mod test {
too_small!(small_uint_6, 6, read_uint);
too_small!(small_uint_7, 7, read_uint);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_1, 1, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_2, 2, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_3, 3, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_4, 4, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_5, 5, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_6, 6, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_7, 7, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_8, 8, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_9, 9, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_10, 10, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_11, 11, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_12, 12, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_13, 13, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_14, 14, read_uint128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_uint128_15, 15, read_uint128);
too_small!(small_int_1, 1, read_int);
@@ -2744,35 +2747,35 @@ mod test {
too_small!(small_int_6, 6, read_int);
too_small!(small_int_7, 7, read_int);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_1, 1, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_2, 2, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_3, 3, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_4, 4, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_5, 5, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_6, 6, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_7, 7, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_8, 8, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_9, 9, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_10, 10, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_11, 11, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_12, 12, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_13, 13, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_14, 14, read_int128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
too_small!(small_int128_15, 15, read_int128);
// Test that reading/writing slices enforces the correct lengths.
@@ -2860,16 +2863,16 @@ mod test {
slice_lengths!(
slice_len_too_big_i64, read_i64_into, write_i64_into, 17, [0, 0]);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
slice_lengths!(
slice_len_too_small_u128, read_u128_into, write_u128_into, 31, [0, 0]);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
slice_lengths!(
slice_len_too_big_u128, read_u128_into, write_u128_into, 33, [0, 0]);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
slice_lengths!(
slice_len_too_small_i128, read_i128_into, write_i128_into, 31, [0, 0]);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
slice_lengths!(
slice_len_too_big_i128, read_i128_into, write_i128_into, 33, [0, 0]);
@@ -3016,9 +3019,9 @@ mod stdtests {
qc_bytes_ext!(prop_ext_f64,
f64, ::std::i64::MAX as u64, read_f64, write_f64);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_u128, Wi128<u128>, 16 + 1, read_u128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_i128, Wi128<i128>, 16 + 1, read_i128, write_i128);
qc_bytes_ext!(prop_ext_uint_1,
@@ -3038,52 +3041,52 @@ mod stdtests {
qc_bytes_ext!(prop_ext_uint_8,
u64, calc_max!(::test::U64_MAX, 8), 8, read_uint, write_u64);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_1,
Wi128<u128>, 1, 1, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_2,
Wi128<u128>, 2, 2, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_3,
Wi128<u128>, 3, 3, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_4,
Wi128<u128>, 4, 4, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_5,
Wi128<u128>, 5, 5, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_6,
Wi128<u128>, 6, 6, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_7,
Wi128<u128>, 7, 7, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_8,
Wi128<u128>, 8, 8, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_9,
Wi128<u128>, 9, 9, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_10,
Wi128<u128>, 10, 10, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_11,
Wi128<u128>, 11, 11, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_12,
Wi128<u128>, 12, 12, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_13,
Wi128<u128>, 13, 13, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_14,
Wi128<u128>, 14, 14, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_15,
Wi128<u128>, 15, 15, read_uint128, write_u128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_uint128_16,
Wi128<u128>, 16, 16, read_uint128, write_u128);
@@ -3104,52 +3107,52 @@ mod stdtests {
qc_bytes_ext!(prop_ext_int_8,
i64, calc_max!(::test::I64_MAX, 8), 8, read_int, write_i64);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_1,
Wi128<i128>, 1, 1, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_2,
Wi128<i128>, 2, 2, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_3,
Wi128<i128>, 3, 3, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_4,
Wi128<i128>, 4, 4, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_5,
Wi128<i128>, 5, 5, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_6,
Wi128<i128>, 6, 6, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_7,
Wi128<i128>, 7, 7, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_8,
Wi128<i128>, 8, 8, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_9,
Wi128<i128>, 9, 9, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_10,
Wi128<i128>, 10, 10, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_11,
Wi128<i128>, 11, 11, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_12,
Wi128<i128>, 12, 12, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_13,
Wi128<i128>, 13, 13, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_14,
Wi128<i128>, 14, 14, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_15,
Wi128<i128>, 15, 15, read_int128, write_i128);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_bytes_ext!(prop_ext_int128_16,
Wi128<i128>, 16, 16, read_int128, write_i128);
@@ -3235,10 +3238,10 @@ mod stdtests {
qc_slice!(prop_slice_i32, i32, read_i32_into, write_i32_into, 0);
qc_slice!(prop_slice_u64, u64, read_u64_into, write_u64_into, 0);
qc_slice!(prop_slice_i64, i64, read_i64_into, write_i64_into, 0);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_slice!(
prop_slice_u128, Wi128<u128>, read_u128_into, write_u128_into, 0);
- #[cfg(feature = "i128")]
+ #[cfg(byteorder_i128)]
qc_slice!(
prop_slice_i128, Wi128<i128>, read_i128_into, write_i128_into, 0);