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

Function interlace_incr

win/share/giftiles.c:420–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420static unsigned
421interlace_incr(unsigned y, unsigned height)
422{
423 static const unsigned char incr[] = { 8, 2, 4, 2 };
424
425 /* The lower three bits indicate the current pass */
426
427 /* Advance to the next row of the current pass */
428 y += incr[y & 0x3];
429
430 /* Go to the next pass if y exceeds height */
431 /* Might not be the immediately following pass if height is small */
432 if (y >= height && (y & 0x7) == 0) {
433 /* Pass 1 -> Pass 2 */
434 y = 4;
435 }
436 if (y >= height && (y & 0x7) == 4) {
437 /* Pass 2 -> Pass 3 */
438 y = 2;
439 }
440 if (y >= height && (y & 0x3) == 2) {
441 /* Pass 3 -> Pass 4 */
442 y = 1;
443 }
444
445 return y;
446}
447
448/* Decode an unsigned 16 bit quantity */
449static unsigned short

Callers 1

read_gif_tilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected