Skip to content

Commit

Permalink
Optimize conditional compilation flags for smaller code
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Oom committed Aug 27, 2024
1 parent f0b51fa commit 3b991da
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tracing/src/raylogger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ impl RayLoggerWriter {
pixel_y: u16,
bounces: u8,
) -> Result<(), Error> {
if !cfg!(feature = "ray_logging") {
return Ok(());
}

if let Self::File(buf) = self {
let mut bytes = [0u8; 32];
bytes[0..2].copy_from_slice(&iteration.to_le_bytes());
Expand Down Expand Up @@ -89,9 +93,6 @@ pub struct RayLoggerWithIterationAndPixel<'a> {

impl RayLoggerWithIterationAndPixel<'_> {
pub fn log_infinite(&mut self, ray: &Ray, bounces: u8) -> Result<(), Error> {
if !cfg!(feature = "ray_logging") {
return Ok(());
}
self.writer.write(
ray,
true,
Expand All @@ -103,9 +104,6 @@ impl RayLoggerWithIterationAndPixel<'_> {
}

pub fn log_finite(&mut self, ray: &Ray, bounces: u8) -> Result<(), Error> {
if !cfg!(feature = "ray_logging") {
return Ok(());
}
self.writer.write(
ray,
false,
Expand Down

0 comments on commit 3b991da

Please sign in to comment.