P4C
The P4 Compiler
Loading...
Searching...
No Matches
safe_width.h
1
19#ifndef BF_P4C_LIB_SAFE_WIDTH_H_
20#define BF_P4C_LIB_SAFE_WIDTH_H_
21
22#include "ir/ir.h"
23
25inline int safe_width_bits(const IR::Type *type) {
26 int width = 0;
27 if (!type->is<IR::Type_Enum>() && !type->is<IR::Type_Error>() &&
28 !type->is<IR::Type_Unknown>() && !type->is<IR::Type_Dontcare>())
29 width = type->width_bits();
30 return width;
31}
32
34inline int safe_width_bits(const IR::Expression *e) { return safe_width_bits(e->type); }
35
36#endif /* BF_P4C_LIB_SAFE_WIDTH_H_ */