IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

break_into_powers_of_two

def break_into_powers_of_two[origins: OriginSet, //, func: def[pow_two: Int, offset: Int]() capturing thin -> None, N: Int, *, max_value: Int = Int(128)]()

Calls func for each power-of-two-sized chunk of N, plus a final pow_two=0 call for pipeline cleanup.

Parameters:

  • ​origins (OriginSet): Origin set captured by the callback (inferred).
  • ​func (def[pow_two: Int, offset: Int]() capturing thin -> None): Callback invoked once per power-of-two chunk with the chunk size and starting offset, plus a final pow_two=0 cleanup call.
  • ​N (Int): Total size to decompose into power-of-two chunks.
  • ​max_value (Int): Upper bound on the largest power-of-two chunk size (defaults to 128).

Was this page helpful?