ComfyUI > Nodes > ComfyUI-LogicUtils > Bitwise Shift

ComfyUI Node: Bitwise Shift

Class Name

LogicGateBitwiseShift

Category
Logic Gates
Author
aria1th (Account age: 3016days)
Extension
ComfyUI-LogicUtils
Latest Updated
2026-01-21
Github Stars
0.1K

How to Install ComfyUI-LogicUtils

Install this extension via the ComfyUI Manager by searching for ComfyUI-LogicUtils
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-LogicUtils in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Bitwise Shift Description

Performs bitwise shift on integers, adjusting bit positions left or right based on input.

Bitwise Shift:

The LogicGateBitwiseShift node is designed to perform bitwise shift operations on integer values, allowing you to manipulate binary data efficiently. This node is particularly useful in scenarios where you need to adjust the bit positions of an integer, either shifting them to the left or right. The primary function of this node is to shift the bits of a given integer (input1) by a specified number of positions (input2). A positive input2 value results in a left shift, effectively multiplying the integer by a power of two, while a negative input2 value results in a right shift, dividing the integer by a power of two. This node is essential for tasks that require precise control over binary data, such as optimizing storage or performing low-level data manipulation.

Bitwise Shift Input Parameters:

input1

input1 is the integer value whose bits you want to shift. This parameter serves as the base number for the bitwise shift operation. The impact of this parameter is directly related to the value of input2, as it determines the initial binary representation that will be shifted. The default value for input1 is 0, and it must be an integer.

input2

input2 specifies the number of bit positions to shift input1. A positive value shifts the bits to the left, effectively multiplying the number by 2 raised to the power of input2. Conversely, a negative value shifts the bits to the right, dividing the number by 2 raised to the absolute value of input2. The range for input2 is between -32 and 32, inclusive, with a default value of 0. This parameter is crucial as it dictates the direction and magnitude of the shift operation.

Bitwise Shift Output Parameters:

INT

The output is a single integer value representing the result of the bitwise shift operation. This output reflects the new binary configuration of input1 after being shifted by the number of positions specified in input2. The significance of this output lies in its ability to represent a transformed version of the original integer, which can be used for further processing or analysis in your workflow.

Bitwise Shift Usage Tips:

  • Ensure that input1 is an integer, as the node only operates on integer values. Non-integer inputs will result in errors.
  • Use input2 values within the range of -32 to 32 to avoid errors and ensure the operation is performed correctly.

Bitwise Shift Common Errors and Solutions:

ValueError: input2 must be between -32 and 32

  • Explanation: This error occurs when the input2 value is outside the permissible range of -32 to 32.
  • Solution: Adjust the input2 value to fall within the specified range to perform the bitwise shift operation successfully.

Bitwise Shift Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-LogicUtils
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Bitwise Shift