From 858d1fab584fa97804e0658904dde902202c3630 Mon Sep 17 00:00:00 2001 From: Soren Sandmann Date: Mon, 21 Aug 2006 04:12:12 +0000 Subject: [PATCH] Initialize crc to 0xffffffff and invert it before returning. 2006-08-20 Soren Sandmann * elfparser.c (elf_parser_get_crc32): Initialize crc to 0xffffffff and invert it before returning. * elfparser.h: Declare elf_parser_get_debug_link() --- ChangeLog | 7 +++++++ elfparser.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fec853f..dbbee48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-08-20 Soren Sandmann + + * elfparser.c (elf_parser_get_crc32): Initialize crc to 0xffffffff + and invert it before returning. + + * elfparser.h: Declare elf_parser_get_debug_link() + 2006-08-20 Soren Sandmann * elfparser.c (elf_parser_get_load_address): Comment out debug spew. diff --git a/elfparser.c b/elfparser.c index 7153be3..8cd411e 100644 --- a/elfparser.c +++ b/elfparser.c @@ -245,12 +245,12 @@ elf_parser_get_crc32 (ElfParser *parser) data = bin_parser_get_data (parser->parser); length = bin_parser_get_length (parser->parser); - crc = 0; + crc = 0xffffffff; for (i = 0; i < length; ++i) crc = crc32_table[(crc ^ data[i]) & 0xff] ^ (crc >> 8); - return crc & 0xFFFFFFFF; + return ~crc & 0xffffffff; } void -- 2.7.4