ProtoFlux:Shift Right: Difference between revisions

From Resonite Wiki
clarify the arithmetic/logical shift thingy and cleanup
clarification, maybe describing what stuff is on the actual page is nice
 
Line 13: Line 13:
|}}
|}}


The '''Shift Right''' node shifts every bit of the input bool vector or integer to the right.
The '''Shift Right''' node shifts every bit of the input bool vector or integer to the right. Shifting is the act of moving each bit of the input to the right by the shift amount, where bits that fall off the end are lost.


== Inputs ==
== Inputs ==
Line 29: Line 29:
=== * (Pseudo-Generic) ===
=== * (Pseudo-Generic) ===


The shifted value. If the type of <code>A</code> is a signed type, such as [[Type:Int]] or [[Type:Long]], this node performs an [https://en.wikipedia.org/wiki/Arithmetic_shift arithmetic shift] on <code>A</code>. Otherwise, it performs a [https://en.wikipedia.org/wiki/Logical_shift logical shift] on <code>A</code>
The shifted value. If the type of <code>A</code> is a signed type, such as [[Type:Int]] or [[Type:Long]], this node performs an [https://en.wikipedia.org/wiki/Arithmetic_shift arithmetic shift] on <code>A</code>, which copies the most significant bit to each lower bit for the shift amount. Otherwise, it performs a [https://en.wikipedia.org/wiki/Logical_shift logical shift] on <code>A</code>, where the highest-order bits are filled with <code>0</code> or <code>False</code> for the shift amount.


== Further Reading ==
== Further Reading ==

Latest revision as of 18:23, 29 June 2024

> >
A
*
Shift
Boolean

The Shift Right node shifts every bit of the input bool vector or integer to the right. Shifting is the act of moving each bit of the input to the right by the shift amount, where bits that fall off the end are lost.

Inputs

A (Pseudo-Generic)

The value to shift.

Shift (int)

The amount to shift A to the right. If the type being shifted is Long or Type:Ulong, the shift amount is determined by the lowest six bits of Shift. Otherwise, it is determined by the lowest five bits of Shift.

Outputs

* (Pseudo-Generic)

The shifted value. If the type of A is a signed type, such as Type:Int or Type:Long, this node performs an arithmetic shift on A, which copies the most significant bit to each lower bit for the shift amount. Otherwise, it performs a logical shift on A, where the highest-order bits are filled with 0 or False for the shift amount.

Further Reading

Videos

See Also