{
nir_const_value v;
memset(&v, 0, sizeof(v));
+
+ /* clang-format off */
switch (bit_size) {
case 16: v.u16 = _mesa_float_to_half(d); break;
case 32: v.f32 = d; break;
default:
unreachable("Invalid bit size");
}
+ /* clang-format on */
+
return v;
}
{
nir_const_value v;
memset(&v, 0, sizeof(v));
+
+ /* clang-format off */
switch (bit_size) {
- case 1: v.b = i & 1; break;
- case 8: v.i8 = i; break;
- case 16: v.i16 = i; break;
- case 32: v.i32 = i; break;
- case 64: v.i64 = i; break;
+ case 1: v.b = i & 1; break;
+ case 8: v.i8 = i; break;
+ case 16: v.i16 = i; break;
+ case 32: v.i32 = i; break;
+ case 64: v.i64 = i; break;
default:
unreachable("Invalid bit size");
}
+ /* clang-format on */
+
return v;
}
nir_const_value v;
memset(&v, 0, sizeof(v));
+ /* clang-format off */
switch (bit_size) {
- case 16:
- v.u16 = _mesa_float_to_half(f);
- break;
- case 32:
- v.f32 = f;
- break;
- case 64:
- v.f64 = f;
- break;
- default:
- unreachable("Invalid bit size");
+ case 16: v.u16 = _mesa_float_to_half(f); break;
+ case 32: v.f32 = f; break;
+ case 64: v.f64 = f; break;
+ default: unreachable("Invalid bit size");
}
+ /* clang-format on */
return v;
}
double
nir_const_value_as_float(nir_const_value value, unsigned bit_size)
{
+ /* clang-format off */
switch (bit_size) {
case 16: return _mesa_half_to_float(value.u16);
case 32: return value.f32;
case 64: return value.f64;
- default:
- unreachable("Invalid bit size");
+ default: unreachable("Invalid bit size");
}
+ /* clang-format on */
}
nir_const_value *
nir_const_value v;
memset(&v, 0, sizeof(v));
+ /* clang-format off */
switch (bit_size) {
case 1: v.b = x; break;
case 8: v.u8 = x; break;
default:
unreachable("Invalid bit size");
}
+ /* clang-format on */
return v;
}
static inline int64_t
nir_const_value_as_int(nir_const_value value, unsigned bit_size)
{
+ /* clang-format off */
switch (bit_size) {
/* int1_t uses 0/-1 convention */
case 1: return -(int)value.b;
default:
unreachable("Invalid bit size");
}
+ /* clang-format on */
}
static inline uint64_t
nir_const_value_as_uint(nir_const_value value, unsigned bit_size)
{
+ /* clang-format off */
switch (bit_size) {
case 1: return value.b;
case 8: return value.u8;
default:
unreachable("Invalid bit size");
}
+ /* clang-format on */
}
static inline bool