fn load_discr(bcx: &Block, ity: IntType, ptr: ValueRef, min: Disr, max: Disr)
    -> ValueRef {
    let llty = ll_inttype(bcx.ccx(), ity);
    assert_eq!(val_ty(ptr), llty.ptr_to());
    let bits = machine::llbitsize_of_real(bcx.ccx(), llty);
    assert!(bits <= 64);
    let mask = (-1u64 >> (64 - bits)) as Disr;
    if (max + 1) & mask == min & mask {
        // i.e., if the range is everything.  The lo==hi case would be
        // rejected by the LLVM verifier (it would mean either an
        // empty set, which is impossible, or the entire range of the
        // type, which is pointless).
        Load(bcx, ptr)
    } else {
        // llvm::ConstantRange can deal with ranges that wrap around,
        // so an overflow on (max + 1) is fine.
        LoadRangeAssert(bcx, ptr, min as c_ulonglong,
                        (max + 1) as c_ulonglong,
                        /* signed: */ True)
    }
}
/// Helper for cases where the discriminant is simply loaded.
Helper for cases where the discriminant is simply loaded.
Helper for cases where the discriminant is simply loaded .
fn load_discr(bcx: &Block, ity: IntType, ptr: ValueRef, min: Disr, max: Disr)
    -> ValueRef {
    let llty = ll_inttype(bcx.ccx(), ity);
    assert_eq!(val_ty(ptr), llty.ptr_to());
    let bits = machine::llbitsize_of_real(bcx.ccx(), llty);
    assert!(bits <= 64);
    let mask = (-1u64 >> (64 - bits)) as Disr;
    if (max + 1) & mask == min & mask {
        // i.e., if the range is everything.  The lo==hi case would be
        // rejected by the LLVM verifier (it would mean either an
        // empty set, which is impossible, or the entire range of the
        // type, which is pointless).
        Load(bcx, ptr)
    } else {
        // llvm::ConstantRange can deal with ranges that wrap around,
        // so an overflow on (max + 1) is fine.
        LoadRangeAssert(bcx, ptr, min as c_ulonglong,
                        (max + 1) as c_ulonglong,
                        /* signed: */ True)
    }
}
fn load_discr ( bcx : & Block , ity : IntType , ptr : ValueRef , min : Disr , max : Disr ) -> ValueRef { let llty = ll_inttype ( bcx . ccx ( ) , ity ) ; assert_eq ! ( val_ty ( ptr ) llty ptr_to ( ) ) ; let bits = machine :: llbitsize_of_real ( bcx . ccx ( ) , llty ) ; assert ! ( bits 64 ) ; let mask = ( - 1u64 >> ( 64 - bits ) ) as Disr ; if ( max + 1 ) & mask == min & mask { // i.e., if the range is everything.  The lo==hi case would be // rejected by the LLVM verifier (it would mean either an // empty set, which is impossible, or the entire range of the // type, which is pointless). Load ( bcx , ptr ) } else { // llvm::ConstantRange can deal with ranges that wrap around, // so an overflow on (max + 1) is fine. LoadRangeAssert ( bcx , ptr , min as c_ulonglong , ( max + 1 ) as c_ulonglong , /* signed: */ True ) } }
Helper for cases where the discriminant is simply loaded.
Helper for cases where the discriminant is simply loaded .
bcx
&Block
ity
IntType
ptr
ValueRef
min
Disr
max
Disr
bcx
&Block
ity
IntType
ptr
ValueRef
min
Disr
max
Disr