Replace assert with static_assert here applicable.

Replaces assert() with static_assert() if the condition is can be
evaluated at compile time.

llvm-svn: 360753
This commit is contained in:
Jonas Devlieghere
2019-05-15 05:39:41 +00:00
parent c18740976e
commit 4c1d6ee83d
5 changed files with 12 additions and 11 deletions

View File

@@ -1972,8 +1972,8 @@ bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc,
// We want 4 elements from packed data
const uint32_t num_exprs = 4;
assert(num_exprs == (eExprTypeElemPtr - eExprTypeDimX + 1) &&
"Invalid number of expressions");
static_assert(num_exprs == (eExprTypeElemPtr - eExprTypeDimX + 1),
"Invalid number of expressions");
char expr_bufs[num_exprs][jit_max_expr_size];
uint64_t results[num_exprs];
@@ -2031,8 +2031,8 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem,
// We want 4 elements from packed data
const uint32_t num_exprs = 4;
assert(num_exprs == (eExprElementFieldCount - eExprElementType + 1) &&
"Invalid number of expressions");
static_assert(num_exprs == (eExprElementFieldCount - eExprElementType + 1),
"Invalid number of expressions");
char expr_bufs[num_exprs][jit_max_expr_size];
uint64_t results[num_exprs];
@@ -2090,8 +2090,8 @@ bool RenderScriptRuntime::JITSubelements(Element &elem,
}
const short num_exprs = 3;
assert(num_exprs == (eExprSubelementsArrSize - eExprSubelementsId + 1) &&
"Invalid number of expressions");
static_assert(num_exprs == (eExprSubelementsArrSize - eExprSubelementsId + 1),
"Invalid number of expressions");
char expr_buffer[jit_max_expr_size];
uint64_t results;