1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-24 06:59:10 +00:00

(svn r3181) -Bracing

-Indentation
-Whitespace
-DeMorgan's Law
-Test with NULL or 0 for non-booleans
-'\0' instead of 0 for chars
-Remove redundantly redundant comments (like DoFoo(); // Do foo)
-Join multiple short lines with a single statement
-Split single lines with multiple statements
-Avoid assignments in if
This commit is contained in:
tron
2005-11-14 19:48:04 +00:00
parent d8b56c123e
commit f7abff5f96
63 changed files with 1984 additions and 2359 deletions

View File

@@ -198,21 +198,21 @@ typedef unsigned char byte;
static inline uint16 TO_LE16(uint16 x) { return BSWAP16(x); }
static inline uint32 FROM_LE32(uint32 x) { return BSWAP32(x); }
static inline uint16 FROM_LE16(uint16 x) { return BSWAP16(x); }
# define TO_BE32(x) x
# define TO_BE16(x) x
# define FROM_BE32(x) x
# define FROM_BE16(x) x
# define TO_BE32X(x) x
# define TO_BE32(x) (x)
# define TO_BE16(x) (x)
# define FROM_BE32(x) (x)
# define FROM_BE16(x) (x)
# define TO_BE32X(x) (x)
#else
static inline uint32 TO_BE32(uint32 x) { return BSWAP32(x); }
static inline uint16 TO_BE16(uint16 x) { return BSWAP16(x); }
static inline uint32 FROM_BE32(uint32 x) { return BSWAP32(x); }
static inline uint16 FROM_BE16(uint16 x) { return BSWAP16(x); }
# define TO_LE32(x) x
# define TO_LE16(x) x
# define TO_LE32(x) (x)
# define TO_LE16(x) (x)
# define TO_BE32X(x) BSWAP32(x)
# define FROM_LE32(x) x
# define FROM_LE16(x) x
# define FROM_LE32(x) (x)
# define FROM_LE16(x) (x)
#endif /* TTD_BIG_ENDIAN */
#if !defined(GAME_DATA_DIR)
@@ -241,7 +241,7 @@ typedef unsigned char byte;
assert_compile(sizeof(uint32) == 4);
assert_compile(sizeof(uint16) == 2);
assert_compile(sizeof(uint8) == 1);
assert_compile(sizeof(uint8) == 1);
#define lengthof(x) (sizeof(x)/sizeof(x[0]))
#define endof(x) (&x[lengthof(x)])