MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / check

Function check

examples/webgpu_from_scratch/run.cpp:41–49  ·  view source on GitHub ↗

* Convenience function to check if a condition is true, if not log an error * message and exit. * * @param condition: The condition to check. * @param message: The error message to log if the condition is false. * @param file: The file where the error occurred. * @param line: The line where the error occurred. */

Source from the content-addressed store, hash-verified

39 * @param line: The line where the error occurred.
40 */
41inline void check(bool condition, const char *message,
42 const char *file = "unkown", int line = -1) {
43 if (!condition) {
44 spdlog::error("Error in file {} line {}:\n{}", file, line, message);
45 exit(1);
46 } else {
47 spdlog::trace("Success in file {} line {}:\n{}", file, line, message);
48 }
49}
50
51/*
52 * Convenience function to display the first few elements of an array. A more

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected