diff options
Diffstat (limited to 'src/ir/bits.h')
-rw-r--r-- | src/ir/bits.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ir/bits.h b/src/ir/bits.h index 96b36a846..25d80fba7 100644 --- a/src/ir/bits.h +++ b/src/ir/bits.h @@ -437,6 +437,17 @@ Index getMaxBits(Expression* curr, } } +// As getMaxBits, but returns the minimum amount of bits. +inline Index getMinBits(Expression* curr) { + if (auto* c = curr->dynCast<Const>()) { + // Constants are simple: the min and max are identical. + return getMaxBits(c); + } + + // TODO: everything else + return 0; +} + } // namespace wasm::Bits #endif // wasm_ir_bits_h |