MCPcopy Create free account
hub / github.com/Effect-TS/effect / increasing

Function increasing

packages/effect/src/ui/internal/kernel.ts:2191–2212  ·  view source on GitHub ↗
(sources: Int32Array)

Source from the content-addressed store, hash-verified

2189}
2190
2191const increasing = (sources: Int32Array): Array<number> => {
2192 const before = new Int32Array(sources.length)
2193 const run: Array<number> = []
2194 for (let index = 0; index < sources.length; index++) {
2195 const value = sources[index]!
2196 if (value === 0) continue
2197 let low = 0
2198 let high = run.length
2199 while (low < high) {
2200 const mid = (low + high) >> 1
2201 if (sources[run[mid]!]! < value) low = mid + 1
2202 else high = mid
2203 }
2204 before[index] = low > 0 ? run[low - 1]! : -1
2205 run[low] = index
2206 }
2207 for (let index = run.length - 1, at = run[index]; index >= 0; index--) {
2208 run[index] = at!
2209 at = before[at!]
2210 }
2211 return run
2212}
2213
2214/** @internal */
2215export interface Root {

Callers 1

patchListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected