use crate::types::*;
#[cfg(feature = "production")]
use smallvec::SmallVec;
#[cfg(feature = "production")]
pub type StackElement = SmallVec<[u8; 80]>;
#[cfg(not(feature = "production"))]
pub type StackElement = ByteString;
#[inline]
pub fn to_stack_element(data: &[u8]) -> StackElement {
#[cfg(feature = "production")]
return SmallVec::from_slice(data);
#[cfg(not(feature = "production"))]
return data.to_vec();
}
#[cfg(feature = "production")]
#[inline(always)]
pub fn cast_to_bool(v: &[u8]) -> bool {
for i in 0..v.len() {
if v[i] != 0 {
if i == v.len() - 1 && v[i] == 0x80 {
return false;
}
return true;
}
}
false
}
#[cfg(not(feature = "production"))]
#[inline]
pub fn cast_to_bool(v: &[u8]) -> bool {
for i in 0..v.len() {
if v[i] != 0 {
if i == v.len() - 1 && v[i] == 0x80 {
return false;
}
return true;
}
}
false
}