Longfellow ZK 0290cb32

Loading...
Searching...
No Matches
panic.h
1// Copyright 2025 Google LLC.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef PRIVACY_PROOFS_ZK_LIB_UTIL_PANIC_H_
16#define PRIVACY_PROOFS_ZK_LIB_UTIL_PANIC_H_
17
18#if defined(__ABSL__)
19#include "third_party/absl/log/check.h"
20#else
21#include <cstdio>
22#include <cstdlib>
23#endif
24
25 namespace proofs {
26
27 inline void check(bool truth, const char* why) {
28#if defined(__ABSL__)
29 CHECK(truth) << why;
30#else
31 if (!truth) {
32 fprintf(stderr, "%s", why);
33 abort();
34 }
35#endif
36}
37
38} // namespace proofs
39
40#endif // PRIVACY_PROOFS_ZK_LIB_UTIL_PANIC_H_