Max Int
A ceiling guard you can wire in seconds
- INT
ComfyUI is full of integers that need to respect a minimum: batch sizes that shouldn't drop below 1, step counts that shouldn't go under a floor, indices that must stay positive. SL_MaxInt is the one-node answer - it takes two integers and returns the larger one. Wire value into a, wire a fixed minimum into b, and you've built "never go below this" without touching a clamp or a compare.
Mechanically it's max(a, b), Python's built-in. Two integers in, the larger out. Equal values return that value. There's no rounding (nothing to round), no clamping range to misconfigure, just a straight comparison. That simplicity is the appeal: it's the least-accidentally-wrong math node in the pack.
Where it earns its keep:
- Minimum enforcement:
max(batch_size, 1)guarantees a batch of at least one even if the calculation returns 0 or negative. - Dynamic floors: because both inputs are wired, the "minimum" can be a computed value, not a hardcoded constant - more flexible than a fixed clamp.
- Picking the larger of two paths: if two branches each yield a step count or a resolution, take the max to decide which wins.
Inputs and outputs:
a(INT) - first candidate, default 0b(INT) - second candidate, default 0- Output:
INT- whichever ofaandbis larger
Installing it
Part of ComfyUI-SimpleLogics. Manager → search "SimpleLogics" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/danipisca07/ComfyUI-SimpleLogics
Restart, Add Node → search "Max Int" (menu group SimpleLogics/Math). Zero dependencies, no model files.
Gotchas
- Both inputs default to 0. An unwired
bmakes this a "keep everything at least 0" node, which is almost the safe default - but if your real minimum is 1, you must wire it. Silent defaults are the enemy here; label your wires. - INT input is strict. Feeding it a FLOAT source gets you a red link - convert with
SL_FloatToIntfirst. The float twin (SL_MaxFloat) is the reverse: it accepts INT wires fine. - Exactly two inputs. Three candidates means chaining two Max nodes.
Pair it with SL_ClampInt when you need both a floor and a ceiling on a value, and with SL_CompareInt when you want to act on the comparison rather than just pick the bigger number. On its own, Max Int is the smallest, most honest guardrail in the pack.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0 | — |
| b | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |