summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/crypt-blowfish.c
diff options
context:
space:
mode:
authorTom Lane2007-04-06 05:36:51 +0000
committerTom Lane2007-04-06 05:36:51 +0000
commit37a609b27fcb67c28ff34d02ae3e82cd9903dd13 (patch)
tree037c29effb24f829edcf52ad172a4c0af0fcc14a /contrib/pgcrypto/crypt-blowfish.c
parent3e23b68dac006e8deb0afa327e855258df8de064 (diff)
Now that core functionality is depending on autoconf's AC_C_BIGENDIAN to be
right, there seems precious little reason to have a pile of hand-maintained endianness definitions in src/include/port/*.h. Get rid of those, and make the couple of places that used them depend on WORDS_BIGENDIAN instead.
Diffstat (limited to 'contrib/pgcrypto/crypt-blowfish.c')
-rw-r--r--contrib/pgcrypto/crypt-blowfish.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c
index f8bd00e2da..f951f2c411 100644
--- a/contrib/pgcrypto/crypt-blowfish.c
+++ b/contrib/pgcrypto/crypt-blowfish.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.11 2006/03/11 04:38:30 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.12 2007/04/06 05:36:50 tgl Exp $
*
* This code comes from John the Ripper password cracker, with reentrant
* and crypt(3) interfaces added, but optimizations specific to password
@@ -436,19 +436,19 @@ BF_encode(char *dst, const BF_word * src, int size)
}
static void
-BF_swap(BF_word * x, int count)
+BF_swap(BF_word *x, int count)
{
- static int endianness_check = 1;
- char *is_little_endian = (char *) &endianness_check;
+ /* Swap on little-endian hardware, else do nothing */
+#ifndef WORDS_BIGENDIAN
BF_word tmp;
- if (*is_little_endian)
- do
- {
- tmp = *x;
- tmp = (tmp << 16) | (tmp >> 16);
- *x++ = ((tmp & 0x00FF00FF) << 8) | ((tmp >> 8) & 0x00FF00FF);
- } while (--count);
+ do
+ {
+ tmp = *x;
+ tmp = (tmp << 16) | (tmp >> 16);
+ *x++ = ((tmp & 0x00FF00FF) << 8) | ((tmp >> 8) & 0x00FF00FF);
+ } while (--count);
+#endif
}
#if BF_SCALE