Mojo function
circular_add
circular_add[n: Int](x: Int, y: Int) -> Int
Addition modulo n, assuming 0 <= x < n and 0 <= y < n.
Equivalent to (x + y) % n. When n is a power of 2, uses unsigned
modulo which compiles to a single and instruction. Otherwise uses
a conditional subtract to avoid expensive integer division on GPU.
Returns:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!