MCPcopy Create free account
hub / github.com/benfry/processing4 / indexHunt

Method indexHunt

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

Source from the content-addressed store, hash-verified

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

Callers 1

indexActualMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected