373{
378
379 /* Set up the internal state */
381 a =
b =
c = 0x9e3779b9 +
len + 3923095;
382
383 /* If the seed is non-zero, use it to perturb the internal state. */
384 if (seed != 0)
385 {
386 /*
387 * In essence, the seed is treated as part of the data being hashed,
388 * but for simplicity, we pretend that it's padded with four bytes of
389 * zeroes so that the seed constitutes a 12-byte chunk.
390 */
394 }
395
396 /* If the source pointer is word-aligned, we use word-wide fetches */
398 {
399 /* Code path for aligned source data */
401
402 /* handle most of the key */
404 {
409 ka += 3;
411 }
412
413 /* handle the last 11 bytes */
414 k = (const unsigned char *) ka;
415#ifdef WORDS_BIGENDIAN
417 {
418 case 11:
420 /* fall through */
421 case 10:
423 /* fall through */
424 case 9:
426 /* fall through */
427 case 8:
428 /* the lowest byte of c is reserved for the length */
431 break;
432 case 7:
434 /* fall through */
435 case 6:
437 /* fall through */
438 case 5:
440 /* fall through */
441 case 4:
443 break;
444 case 3:
446 /* fall through */
447 case 2:
449 /* fall through */
450 case 1:
452 /* case 0: nothing left to add */
453 }
454#else /* !WORDS_BIGENDIAN */
456 {
457 case 11:
459 /* fall through */
460 case 10:
462 /* fall through */
463 case 9:
465 /* fall through */
466 case 8:
467 /* the lowest byte of c is reserved for the length */
470 break;
471 case 7:
473 /* fall through */
474 case 6:
476 /* fall through */
477 case 5:
479 /* fall through */
480 case 4:
482 break;
483 case 3:
485 /* fall through */
486 case 2:
488 /* fall through */
489 case 1:
491 /* case 0: nothing left to add */
492 }
493#endif /* WORDS_BIGENDIAN */
494 }
495 else
496 {
497 /* Code path for non-aligned source data */
498
499 /* handle most of the key */
501 {
502#ifdef WORDS_BIGENDIAN
506#else /* !WORDS_BIGENDIAN */
510#endif /* WORDS_BIGENDIAN */
512 k += 12;
514 }
515
516 /* handle the last 11 bytes */
517#ifdef WORDS_BIGENDIAN
519 {
520 case 11:
522 /* fall through */
523 case 10:
525 /* fall through */
526 case 9:
528 /* fall through */
529 case 8:
530 /* the lowest byte of c is reserved for the length */
532 /* fall through */
533 case 7:
535 /* fall through */
536 case 6:
538 /* fall through */
539 case 5:
541 /* fall through */
542 case 4:
544 /* fall through */
545 case 3:
547 /* fall through */
548 case 2:
550 /* fall through */
551 case 1:
553 /* case 0: nothing left to add */
554 }
555#else /* !WORDS_BIGENDIAN */
557 {
558 case 11:
560 /* fall through */
561 case 10:
563 /* fall through */
564 case 9:
566 /* fall through */
567 case 8:
568 /* the lowest byte of c is reserved for the length */
570 /* fall through */
571 case 7:
573 /* fall through */
574 case 6:
576 /* fall through */
577 case 5:
579 /* fall through */
580 case 4:
582 /* fall through */
583 case 3:
585 /* fall through */
586 case 2:
588 /* fall through */
589 case 1:
591 /* case 0: nothing left to add */
592 }
593#endif /* WORDS_BIGENDIAN */
594 }
595
597
598 /* report the result */
600}