From 6f076a3daebc86bba86ca2fb9746a47d35212cf2 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 30 May 2020 20:34:27 -0700 Subject: [PATCH] Apply no_panic to s2d --- src/s2d.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/s2d.rs b/src/s2d.rs index 83b0a45..5482394 100644 --- a/src/s2d.rs +++ b/src/s2d.rs @@ -2,6 +2,8 @@ use crate::common::*; use crate::d2s; use crate::d2s_intrinsics::*; use crate::parse::Error; +#[cfg(feature = "no-panic")] +use no_panic::no_panic; const DOUBLE_EXPONENT_BIAS: usize = 1023; @@ -9,6 +11,7 @@ fn floor_log2(value: u64) -> u32 { 63_u32.wrapping_sub(value.leading_zeros()) } +#[cfg_attr(feature = "no-panic", no_panic)] pub fn s2d(buffer: &[u8]) -> Result { let len = buffer.len(); if len == 0 {