From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123602 invoked by alias); 28 Dec 2015 16:22:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 121695 invoked by uid 89); 28 Dec 2015 16:22:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mail-qg0-f43.google.com Received: from mail-qg0-f43.google.com (HELO mail-qg0-f43.google.com) (209.85.192.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 28 Dec 2015 16:22:13 +0000 Received: by mail-qg0-f43.google.com with SMTP id o11so149532366qge.2 for ; Mon, 28 Dec 2015 08:22:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GsLF3MsqJ3TzlFHBZvNbJidAKyXTE4r8LLYcaEMTxio=; b=hFyrTvROoH2uWa/vIgewG/w3ZG0qgWdROjaQzaLUsdM1K2sdDFAK++PKmN5Zjzxs1C hbtkvQIJfWYQyarUPvPBUuWW9cUOdwAAHQQfp9jdOg8fGCvdDQ4Cf/ZLUHtqqQKasK2z B948oj8nSvzuQ3yAPs1dZxBT4pI6BHW1oNe5cXLzGhyS1uoOhn5nwo3rsVc5HuogYjTt D4y01KSFgkvkxMVI9RHtEqKnmp7bD7LOEGn+/Vds1q+7AeWPdPjPdvUQZ7PZ0IiWVr7c ffK2RWZpxHKIYMKM5Ay5mSgozz6QZH4PenpV4BT331xQgokA49V0Rd2SZ3Y0kxyLIrQc vaXw== X-Gm-Message-State: ALoCoQmQ8RttihCQcjx15Qo0BjvLgpoCm0z+hXEyihgdcp7YZh/NmN5XY1J7up3cxluDzsIKhD+037oUJTn0ZRJeY8qbwZpjPA== X-Received: by 10.140.164.77 with SMTP id k74mr75316011qhk.6.1451319731823; Mon, 28 Dec 2015 08:22:11 -0800 (PST) Received: from localhost.localdomain (ool-4353a8be.dyn.optonline.net. [67.83.168.190]) by smtp.gmail.com with ESMTPSA id g130sm27617041qkb.28.2015.12.28.08.22.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Dec 2015 08:22:11 -0800 (PST) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH] [COMMITTED] Use libiberty's crc32 implementation in gdbserver Date: Mon, 28 Dec 2015 16:22:00 -0000 Message-Id: <1451319725-31817-1-git-send-email-patrick@parcs.ath.cx> In-Reply-To: <568122B4.7030502@redhat.com> References: <568122B4.7030502@redhat.com> X-SW-Source: 2015-12/txt/msg00521.txt.bz2 Tested on x86_64-pc-linux-gnu native-gdbserver, no new regressions. gdb/gdbserver/ChangeLog: * server.c (crc32_table): Delete. (crc32): Use libiberty's xcrc32 function. --- gdb/gdbserver/server.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index b385afb..0e3ac4e 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1911,11 +1911,6 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p) return 0; } -/* Table used by the crc32 function to calcuate the checksum. */ - -static unsigned int crc32_table[256] = -{0, 0}; - /* Compute 32 bit CRC from inferior memory. On success, return 32 bit CRC. @@ -1924,20 +1919,6 @@ static unsigned int crc32_table[256] = static unsigned long long crc32 (CORE_ADDR base, int len, unsigned int crc) { - if (!crc32_table[1]) - { - /* Initialize the CRC table and the decoding table. */ - int i, j; - unsigned int c; - - for (i = 0; i < 256; i++) - { - for (c = i << 24, j = 8; j > 0; --j) - c = c & 0x80000000 ? (c << 1) ^ 0x04c11db7 : (c << 1); - crc32_table[i] = c; - } - } - while (len--) { unsigned char byte = 0; @@ -1946,7 +1927,7 @@ crc32 (CORE_ADDR base, int len, unsigned int crc) if (read_inferior_memory (base, &byte, 1) != 0) return (unsigned long long) -1; - crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ byte) & 255]; + crc = xcrc32 (&byte, 1, crc); base++; } return (unsigned long long) crc; -- 2.7.0.rc1.98.gacf58d0.dirty