From aa66de4f27748cad84efe8113744f607e7b6b79a Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 4 Dec 2019 16:46:59 -0800 Subject: [PATCH] refactor(h1): un-split record_header_indicies for ARM --- src/proto/h1/role.rs | 47 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/src/proto/h1/role.rs b/src/proto/h1/role.rs index 47ca29b517..5c44590342 100644 --- a/src/proto/h1/role.rs +++ b/src/proto/h1/role.rs @@ -948,44 +948,17 @@ fn record_header_indices( ) -> Result<(), crate::error::Parse> { let bytes_ptr = bytes.as_ptr() as usize; - // FIXME: This should be a single plain `for` loop. - // Splitting it is a work-around for /~https://github.com/rust-lang/rust/issues/55105 - macro_rules! split_loops_if { - ( - cfg($($cfg: tt)+) - for $i: pat in ($iter: expr) { - $body1: block - $body2: block - } - ) => { - for $i in $iter { - $body1 - #[cfg(not($($cfg)+))] $body2 - } - #[cfg($($cfg)+)] - for $i in $iter { - $body2 - } - } - } - split_loops_if! { - cfg(all(target_arch = "arm", target_feature = "v7", target_feature = "neon")) - for (header, indices) in (headers.iter().zip(indices.iter_mut())) { - { - if header.name.len() >= (1 << 16) { - debug!("header name larger than 64kb: {:?}", header.name); - return Err(crate::error::Parse::TooLarge); - } - let name_start = header.name.as_ptr() as usize - bytes_ptr; - let name_end = name_start + header.name.len(); - indices.name = (name_start, name_end); - } - { - let value_start = header.value.as_ptr() as usize - bytes_ptr; - let value_end = value_start + header.value.len(); - indices.value = (value_start, value_end); - } + for (header, indices) in headers.iter().zip(indices.iter_mut()) { + if header.name.len() >= (1 << 16) { + debug!("header name larger than 64kb: {:?}", header.name); + return Err(crate::error::Parse::TooLarge); } + let name_start = header.name.as_ptr() as usize - bytes_ptr; + let name_end = name_start + header.name.len(); + indices.name = (name_start, name_end); + let value_start = header.value.as_ptr() as usize - bytes_ptr; + let value_end = value_start + header.value.len(); + indices.value = (value_start, value_end); } Ok(())