#[cfg(feature = "std")]
macro_rules! hashsigs_println {
($($arg:tt)*) => {
::std::println!($($arg)*)
};
}
#[cfg(not(feature = "std"))]
macro_rules! hashsigs_println {
($($arg:tt)*) => {{
if false {
let _ = format_args!($($arg)*);
}
}};
}
pub(crate) fn stateless_trace_enabled() -> bool {
#[cfg(feature = "std")]
{
matches!(
std::env::var("SHRINCS_TRACE_STATELESS").as_deref(),
Ok("1") | Ok("true") | Ok("yes") | Ok("on")
)
}
#[cfg(not(feature = "std"))]
{
false
}
}
#[cfg(not(feature = "parallel"))]
pub(crate) fn stateless_trace_counter_every() -> u32 {
#[cfg(feature = "std")]
{
std::env::var("SHRINCS_TRACE_COUNTER_EVERY")
.ok()
.and_then(|value| value.parse::<u32>().ok())
.filter(|value| *value > 0)
.unwrap_or(1 << 20)
}
#[cfg(not(feature = "std"))]
{
1 << 20
}
}
pub(crate) fn stateless_trace(message: &str) {
#[cfg(feature = "std")]
if stateless_trace_enabled() {
hashsigs_println!("{message}");
}
#[cfg(not(feature = "std"))]
{
let _ = message;
}
}