ProtoFlux:Shift Right: Difference between revisions

From Resonite Wiki
Created a page for the Shift Right node.
 
clarify the arithmetic/logical shift thingy and cleanup
Line 13: Line 13:
|}}
|}}


The '''Shift Right''' node takes in a value we want to shift (using a bitwise operation) and the amount we want to shift by to the right, and returns the new shifted value. Shifting is the act of moving the bits in a byte in a direction, and when shifting, the bits that fall outside the bounds will be lost.
The '''Shift Right''' node shifts every bit of the input bool vector or integer to the right.


== Inputs ==
== Inputs ==


=== A (Pseudo-Generic) ===  
=== A (Pseudo-Generic) ===


The value we want to shift.
The value to shift.


=== Shift ([[Type:int|int]]) ===
=== Shift ([[Type:int|int]]) ===


The amount to shift this value by to the right.
The amount to shift <code>A</code> to the right. If the type being shifted is [[Type:Long|Long]] or [[Type:Ulong]], the shift amount is determined by the lowest six bits of <code>Shift</code>. Otherwise, it is determined by the lowest five bits of <code>Shift</code>.


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


The new shifted value.
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>


== Further Reading ==
== Further Reading ==
Line 38: Line 38:


== See Also ==
== See Also ==
* Wikipedia's definition of [https://en.wikipedia.org/wiki/Bitwise_operation bitwise operation] & [https://en.wikipedia.org/wiki/Logical_shift logical shift].
* [https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators Microsoft documentation on the shifting operators].
* Microsoft's documentation on the [https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators shifting] operators.


[[Category:ProtoFlux:Operators:Boolean]]
[[Category:ProtoFlux:Operators:Boolean]]

Revision as of 18:20, 29 June 2024

> >
A
*
Shift
Boolean

The Shift Right node shifts every bit of the input bool vector or integer to the right.

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. Otherwise, it performs a logical shift on A

Further Reading

Videos

See Also