Skip to content

Commit

Permalink
Update sn3d.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Oct 26, 2024
1 parent 6e54d0d commit 74f9234
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sn3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ inline void print_line_start() {
}
}

// Luke: for reasons unknown, the macro printout and the template function printout lead to differences
// in simulation output data (dead code elimination prevents a random number call somewhere perhaps?)
#define printout(...) \
{ \
print_line_start(); \
Expand All @@ -121,6 +123,18 @@ inline void print_line_start() {
output_file.flush(); \
}

__attribute__((__format__(__printf__, 1, 2))) inline auto printoutf(const char *format, ...) -> void {
print_line_start();
va_list args{};
va_start(args, format);
vsnprintf(outputlinebuf, sizeof(outputlinebuf), format, args);
va_end(args);

outputstartofline = (outputlinebuf[strlen(outputlinebuf) - 1] == '\n');
output_file << outputlinebuf;
output_file.flush();
}

#define __artis_assert(e) \
{ \
const bool assertpass = static_cast<bool>(e); \
Expand Down

0 comments on commit 74f9234

Please sign in to comment.