LogicUtil_Bitwise Or
Setting flags without collisions — LogicUtil_Bitwise Or, the OR you actually want
- INT
The one-line version
LogicUtil_Bitwise Or takes two integers and ORs their bits together: an output bit is 1 if either input has a 1 in that position. It's the bitwise counterpart of "add these flags up without double-counting," and it's the natural pair to Bitwise And in this pack - And checks which bits are set, Or sets them.
It ships in ComfyUI-JDCN, a pack that's mostly famous for its folder/file utilities (the JDCN_* nodes people recommend on r/comfyui for directory-based image loading). The LogicUtil section is the pack's little logic toolbox, credited in the source to aria1th's ComfyUI-LogicUtils.
How it works
OR compares each bit position independently. A 1 in either input makes the output 1:
12 | 10→1100 | 1010→1110→145 | 3→101 | 011→111→78 | 1→1000 | 0001→1001→9
The whole node is input1 | input2 - Python's bitwise OR operator, wrapped as a node. Nothing heavier.
Inputs and outputs
input1(INT) - first integer, default 0input2(INT) - second integer, default 0- Output: INT - the bitwise OR
Two integer inputs, one integer output. Feed it seeds, counters, or the output of another arithmetic node.
Installing it
Standard pack install, once:
Easiest - ComfyUI Manager → Install Custom Node → search ComfyUI-JDCN → install → restart.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt
Restart ComfyUI. The only dependency in the whole pack is piexif, and there are zero model downloads.
Common issues
- INT only, again. Bitwise operators raise
TypeErroron floats. Integer sources only. - Or vs And confusion. Or sets bits, And tests them. If you're building a flag system:
flags | 4turns on bit 3;flags & 4asks if it's on. Mixing them up produces masks that look right and behave wrong. - Not the same as
LogicUtil_AOrBGate. That node is a boolean gate (and, fair warning, check the notes on that one before trusting the name). This is the integer bit-level OR.
When you'd actually reach for it
Flag packing. If you keep a single integer as a bundle of on/off options (bit 0 = one option, bit 1 = another, …), OR is how you turn options on without disturbing the ones already set. It's also useful in any creative seed-scrambling where you want to merge two numbers' bit patterns. Outside that, it's a "nice to have in the toolbelt" node - most workflows won't need it, but it's cheap to keep around.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | INT | 0 | — |
| input2 | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |