summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-06 11:38:46 +0000
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-06 11:38:46 +0000
commit0fd21c35f1bbe6014cd18dc187a9e8e135137ab2 (patch)
tree84cb7a59b5601c05888ee22f76caff55b40fef10
parent892e7b037a7ac749cd787f2a91bd9041cd221202 (diff)
downloadgcc-0fd21c35f1bbe6014cd18dc187a9e8e135137ab2.tar.gz
gcc/ChangeLog
2010-06-06 Segher Boessenkool <segher@kernel.crashing.org> PR bootstrap/44427 PR bootstrap/44428 genautomata.c (SET_BIT, CLEAR_BIT, TEST_BIT): Make these macros endianness-independent. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160338 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/genautomata.c11
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9dddeb18c96..d353dfbb61d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2010-06-06 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR bootstrap/44427
+ PR bootstrap/44428
+ genautomata.c (SET_BIT, CLEAR_BIT, TEST_BIT): Make these macros
+ endianness-independent.
+
2010-06-05 Steven Bosscher <steven@gcc.gnu.org>
* c-common.c: Move to c-family/.
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index ad7caa611b5..f7493c7071d 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -3314,15 +3314,18 @@ finish_alt_states (void)
/* Set bit number bitno in the bit string. The macro is not side
effect proof. */
#define SET_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] |= 1 << (bitno) % CHAR_BIT)
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] |= \
+ (HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))
#define CLEAR_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] &= ~(1 << (bitno) % CHAR_BIT))
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] &= \
+ ~((HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)))
/* Test if bit number bitno in the bitstring is set. The macro is not
side effect proof. */
-#define TEST_BIT(bitstring, bitno) \
- (((char *) (bitstring)) [(bitno) / CHAR_BIT] >> (bitno) % CHAR_BIT & 1)
+#define TEST_BIT(bitstring, bitno) \
+ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] >> \
+ (bitno) % (sizeof (*(bitstring)) * CHAR_BIT) & 1)