Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8ba40049
Commit
8ba40049
authored
May 14, 2010
by
antirez
Browse files
Fixed sha1.c compilation on Linux, due to endianess detection lameness
parent
5d373da9
Changes
1
Hide whitespace changes
Inline
Side-by-side
sha1.c
View file @
8ba40049
...
@@ -21,6 +21,8 @@ A million repetitions of "a"
...
@@ -21,6 +21,8 @@ A million repetitions of "a"
#define SHA1HANDSOFF
#define SHA1HANDSOFF
#include <endian.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <sys/types.h>
/* for u_int*_t */
#include <sys/types.h>
/* for u_int*_t */
...
@@ -56,6 +58,14 @@ A million repetitions of "a"
...
@@ -56,6 +58,14 @@ A million repetitions of "a"
#endif
/* BSD */
#endif
/* BSD */
#endif
/* BYTE_ORDER */
#endif
/* BYTE_ORDER */
#if defined(__BYTE_ORDER) && !defined(BYTE_ORDER)
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif
#if !defined(BYTE_ORDER) || \
#if !defined(BYTE_ORDER) || \
(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
BYTE_ORDER != PDP_ENDIAN)
BYTE_ORDER != PDP_ENDIAN)
...
@@ -64,7 +74,7 @@ A million repetitions of "a"
...
@@ -64,7 +74,7 @@ A million repetitions of "a"
* which will force your compiles to bomb until you fix
* which will force your compiles to bomb until you fix
* the above macros.
* the above macros.
*/
*/
error
"Undefined or invalid BYTE_ORDER"
;
#
error "Undefined or invalid BYTE_ORDER"
#endif
#endif
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment