MCPcopy Create free account
hub / github.com/NetHack/NetHack / nearest

Function nearest

sys/amiga/bmp2iff_host.c:81–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81static int
82nearest(const RGB *c, const RGB *pal, int n)
83{
84 int best = 0, bestd = 0x7fffffff, i;
85 for (i = 0; i < n; i++) {
86 int d = coldist(c, &pal[i]);
87 if (d < bestd) { bestd = d; best = i; }
88 }
89 return best;
90}
91
92/* --------------------------------------------------------- */
93/* IFF output */

Callers 1

build_paletteFunction · 0.85

Calls 1

coldistFunction · 0.85

Tested by

no test coverage detected