MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / CheckedNegation

Function CheckedNegation

internal/overflow.cc:104–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104absl::StatusOr<int64_t> CheckedNegation(int64_t v) {
105#if ABSL_HAVE_BUILTIN(__builtin_mul_overflow)
106 int64_t prod;
107 if (!__builtin_mul_overflow(v, -1, &prod)) {
108 return prod;
109 }
110 return absl::OutOfRangeError("integer overflow");
111#else
112 CEL_RETURN_IF_ERROR(CheckRange(v != kInt64Min, "integer overflow"));
113 return -v;
114#endif
115}
116
117absl::StatusOr<int64_t> CheckedMul(int64_t x, int64_t y) {
118#if ABSL_HAVE_BUILTIN(__builtin_mul_overflow)

Callers 2

overflow_test.ccFile · 0.85

Calls 2

CheckRangeFunction · 0.85
IsFiniteFunction · 0.85

Tested by

no test coverage detected