mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
refactor(naga): factor out write_arg
This commit is contained in:
parent
628e4cfcf5
commit
bb12f6287f
@ -3889,14 +3889,15 @@ impl<'a, W: Write> Writer<'a, W> {
|
||||
if was_signed {
|
||||
write!(self.out, "uint(")?;
|
||||
}
|
||||
let write_arg = |this: &mut Self| this.write_expr(arg, ctx);
|
||||
write!(self.out, "(")?;
|
||||
self.write_expr(arg, ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[0] & 0xFF{const_suffix}) | ((")?;
|
||||
self.write_expr(arg, ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[1] & 0xFF{const_suffix}) << 8) | ((")?;
|
||||
self.write_expr(arg, ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[2] & 0xFF{const_suffix}) << 16) | ((")?;
|
||||
self.write_expr(arg, ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[3] & 0xFF{const_suffix}) << 24)")?;
|
||||
if was_signed {
|
||||
write!(self.out, ")")?;
|
||||
|
||||
@ -3643,14 +3643,15 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
|
||||
if was_signed {
|
||||
write!(self.out, "uint(")?;
|
||||
}
|
||||
let write_arg = |this: &mut Self| this.write_expr(module, arg, func_ctx);
|
||||
write!(self.out, "(")?;
|
||||
self.write_expr(module, arg, func_ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[0] & 0xFF) | ((")?;
|
||||
self.write_expr(module, arg, func_ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[1] & 0xFF) << 8) | ((")?;
|
||||
self.write_expr(module, arg, func_ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[2] & 0xFF) << 16) | ((")?;
|
||||
self.write_expr(module, arg, func_ctx)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[3] & 0xFF) << 24)")?;
|
||||
if was_signed {
|
||||
write!(self.out, ")")?;
|
||||
|
||||
@ -2440,14 +2440,15 @@ impl<W: Write> Writer<W> {
|
||||
if was_signed {
|
||||
write!(self.out, "uint(")?;
|
||||
}
|
||||
let write_arg = |this: &mut Self| this.put_expression(arg, context, true);
|
||||
write!(self.out, "(")?;
|
||||
self.put_expression(arg, context, true)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[0] & 0xFF) | ((")?;
|
||||
self.put_expression(arg, context, true)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[1] & 0xFF) << 8) | ((")?;
|
||||
self.put_expression(arg, context, true)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[2] & 0xFF) << 16) | ((")?;
|
||||
self.put_expression(arg, context, true)?;
|
||||
write_arg(self)?;
|
||||
write!(self.out, "[3] & 0xFF) << 24)")?;
|
||||
if was_signed {
|
||||
write!(self.out, ")")?;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user