MCPcopy Index your code
hub / github.com/processing/processing / indexHunt

Method indexHunt

core/src/processing/core/PFont.java:649–664  ·  view source on GitHub ↗
(int c, int start, int stop)

Source from the content-addressed store, hash-verified

647
648
649 protected int indexHunt(int c, int start, int stop) {
650 int pivot = (start + stop) / 2;
651
652 // if this is the char, then return it
653 if (c == glyphs[pivot].value) return pivot;
654
655 // char doesn't exist, otherwise would have been the pivot
656 //if (start == stop) return -1;
657 if (start >= stop) return -1;
658
659 // if it's in the lower half, continue searching that
660 if (c < glyphs[pivot].value) return indexHunt(c, start, pivot-1);
661
662 // if it's in the upper half, continue there
663 return indexHunt(c, pivot+1, stop);
664 }
665
666
667 /**

Callers 1

indexActualMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected