MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / constant_float

Method constant_float

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs:93–102  ·  view source on GitHub ↗
(&self, ty: Word, val: f64)

Source from the content-addressed store, hash-verified

91 }
92
93 pub fn constant_float(&self, ty: Word, val: f64) -> SpirvValue {
94 match self.lookup_type(ty) {
95 SpirvType::Float(32) => self.def_constant(ty, SpirvConst::F32((val as f32).to_bits())),
96 SpirvType::Float(64) => self.def_constant(ty, SpirvConst::F64(val.to_bits())),
97 other => self.tcx.sess.fatal(format!(
98 "constant_float invalid on type {}",
99 other.debug(ty, self)
100 )),
101 }
102 }
103
104 pub fn constant_bool(&self, span: Span, val: bool) -> SpirvValue {
105 let ty = SpirvType::Bool.def(span, self);

Callers 3

const_realMethod · 0.80
call_libm_intrinsicMethod · 0.80

Calls 3

lookup_typeMethod · 0.80
def_constantMethod · 0.80
fatalMethod · 0.80

Tested by

no test coverage detected