diff options
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/hash/hashfunc.c | 64 |
1 files changed, 52 insertions, 12 deletions
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index 1aa0b25d38a..a0060a633db 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -466,9 +466,9 @@ hash_any(register const unsigned char *k, register int keylen) /* fall through */ case 9: c += ((uint32) k[8] << 24); - /* the lowest byte of c is reserved for the length */ /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += ka[1]; a += ka[0]; break; @@ -505,9 +505,9 @@ hash_any(register const unsigned char *k, register int keylen) /* fall through */ case 9: c += ((uint32) k[8] << 8); - /* the lowest byte of c is reserved for the length */ /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += ka[1]; a += ka[0]; break; @@ -558,57 +558,77 @@ hash_any(register const unsigned char *k, register int keylen) /* handle the last 11 bytes */ #ifdef WORDS_BIGENDIAN - switch (len) /* all the case statements fall through */ + switch (len) { case 11: c += ((uint32) k[10] << 8); + /* fall through */ case 10: c += ((uint32) k[9] << 16); + /* fall through */ case 9: c += ((uint32) k[8] << 24); - /* the lowest byte of c is reserved for the length */ + /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += k[7]; + /* fall through */ case 7: b += ((uint32) k[6] << 8); + /* fall through */ case 6: b += ((uint32) k[5] << 16); + /* fall through */ case 5: b += ((uint32) k[4] << 24); + /* fall through */ case 4: a += k[3]; + /* fall through */ case 3: a += ((uint32) k[2] << 8); + /* fall through */ case 2: a += ((uint32) k[1] << 16); + /* fall through */ case 1: a += ((uint32) k[0] << 24); /* case 0: nothing left to add */ } #else /* !WORDS_BIGENDIAN */ - switch (len) /* all the case statements fall through */ + switch (len) { case 11: c += ((uint32) k[10] << 24); + /* fall through */ case 10: c += ((uint32) k[9] << 16); + /* fall through */ case 9: c += ((uint32) k[8] << 8); - /* the lowest byte of c is reserved for the length */ + /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += ((uint32) k[7] << 24); + /* fall through */ case 7: b += ((uint32) k[6] << 16); + /* fall through */ case 6: b += ((uint32) k[5] << 8); + /* fall through */ case 5: b += k[4]; + /* fall through */ case 4: a += ((uint32) k[3] << 24); + /* fall through */ case 3: a += ((uint32) k[2] << 16); + /* fall through */ case 2: a += ((uint32) k[1] << 8); + /* fall through */ case 1: a += k[0]; /* case 0: nothing left to add */ @@ -686,9 +706,9 @@ hash_any_extended(register const unsigned char *k, register int keylen, /* fall through */ case 9: c += ((uint32) k[8] << 24); - /* the lowest byte of c is reserved for the length */ /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += ka[1]; a += ka[0]; break; @@ -725,9 +745,9 @@ hash_any_extended(register const unsigned char *k, register int keylen, /* fall through */ case 9: c += ((uint32) k[8] << 8); - /* the lowest byte of c is reserved for the length */ /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += ka[1]; a += ka[0]; break; @@ -778,57 +798,77 @@ hash_any_extended(register const unsigned char *k, register int keylen, /* handle the last 11 bytes */ #ifdef WORDS_BIGENDIAN - switch (len) /* all the case statements fall through */ + switch (len) { case 11: c += ((uint32) k[10] << 8); + /* fall through */ case 10: c += ((uint32) k[9] << 16); + /* fall through */ case 9: c += ((uint32) k[8] << 24); - /* the lowest byte of c is reserved for the length */ + /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += k[7]; + /* fall through */ case 7: b += ((uint32) k[6] << 8); + /* fall through */ case 6: b += ((uint32) k[5] << 16); + /* fall through */ case 5: b += ((uint32) k[4] << 24); + /* fall through */ case 4: a += k[3]; + /* fall through */ case 3: a += ((uint32) k[2] << 8); + /* fall through */ case 2: a += ((uint32) k[1] << 16); + /* fall through */ case 1: a += ((uint32) k[0] << 24); /* case 0: nothing left to add */ } #else /* !WORDS_BIGENDIAN */ - switch (len) /* all the case statements fall through */ + switch (len) { case 11: c += ((uint32) k[10] << 24); + /* fall through */ case 10: c += ((uint32) k[9] << 16); + /* fall through */ case 9: c += ((uint32) k[8] << 8); - /* the lowest byte of c is reserved for the length */ + /* fall through */ case 8: + /* the lowest byte of c is reserved for the length */ b += ((uint32) k[7] << 24); + /* fall through */ case 7: b += ((uint32) k[6] << 16); + /* fall through */ case 6: b += ((uint32) k[5] << 8); + /* fall through */ case 5: b += k[4]; + /* fall through */ case 4: a += ((uint32) k[3] << 24); + /* fall through */ case 3: a += ((uint32) k[2] << 16); + /* fall through */ case 2: a += ((uint32) k[1] << 8); + /* fall through */ case 1: a += k[0]; /* case 0: nothing left to add */ |