vyre-foundation 0.4.1

Foundation layer: IR, type system, memory model, wire format. Zero application semantics. Part of the vyre GPU compiler.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::ir::Expr;

#[inline]
pub(crate) fn const_truth(expr: &Expr) -> Option<bool> {
    match expr {
        Expr::LitBool(value) => Some(*value),
        Expr::LitU32(value) => Some(*value != 0),
        Expr::LitI32(value) => Some(*value != 0),
        _ => None,
    }
}