summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2012-06-30 11:42:52 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2012-06-30 11:42:52 +0000
commitcb686b9933487c30c0b40a56ad77550fe3c1c838 (patch)
treea70e5fccd55bbaf8e0965e83fa6b62299d11c5f0 /gcc/tree.c
parent1ec205bf200fa9e34f7cff4082eb73ac62f2248e (diff)
downloadgcc-cb686b9933487c30c0b40a56ad77550fe3c1c838.tar.gz
coverage.c (bbg_file_stamp): New.
* coverage.c (bbg_file_stamp): New. (read_counts_file): Merge incoming stamp with bbg_file_stamp. (build_info): Write bbg_file_stamp. (coverage_init): Initialize bbg_file_stamp. Read counts file before writing graph header. (coverage_finish): Don't unlink the data file if we can generate a unique file stamp. * tree.h (crc32_unsigned): Declare. * tree.c (crc32_unsigned_bits): New, broken out of ... (crc32_byte): ... here. Use it. (crc32_unsigned): New. From-SVN: r189095
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 1717d713698..5aa5399d7d1 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -8738,23 +8738,37 @@ dump_tree_statistics (void)
/* Generate a crc32 of a byte. */
-unsigned
-crc32_byte (unsigned chksum, char byte)
+static unsigned
+crc32_unsigned_bits (unsigned chksum, unsigned value, unsigned bits)
{
- unsigned value = (unsigned) byte << 24;
- unsigned ix;
-
- for (ix = 8; ix--; value <<= 1)
- {
- unsigned feedback;
+ unsigned ix;
- feedback = (value ^ chksum) & 0x80000000 ? 0x04c11db7 : 0;
- chksum <<= 1;
- chksum ^= feedback;
- }
+ for (ix = bits; ix--; value <<= 1)
+ {
+ unsigned feedback;
+
+ feedback = (value ^ chksum) & 0x80000000 ? 0x04c11db7 : 0;
+ chksum <<= 1;
+ chksum ^= feedback;
+ }
return chksum;
}
+/* Generate a crc32 of a 32-bit unsigned. */
+
+unsigned
+crc32_unsigned (unsigned chksum, unsigned value)
+{
+ return crc32_unsigned_bits (chksum, value, 32);
+}
+
+/* Generate a crc32 of a byte. */
+
+unsigned
+crc32_byte (unsigned chksum, char byte)
+{
+ return crc32_unsigned_bits (chksum, (unsigned) byte << 24, 8);
+}
/* Generate a crc32 of a string. */