From patchwork Fri Apr 23 15:03:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guy Martin X-Patchwork-Id: 94678 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3NF3TdZ006941 for ; Fri, 23 Apr 2010 15:03:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755428Ab0DWPD0 (ORCPT ); Fri, 23 Apr 2010 11:03:26 -0400 Received: from smtp5.tech.numericable.fr ([82.216.111.41]:44476 "EHLO smtp5.tech.numericable.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485Ab0DWPDZ (ORCPT ); Fri, 23 Apr 2010 11:03:25 -0400 Received: from ibiza.bxl.tuxicoman.be (cable-85.28.107.20.coditel.net [85.28.107.20]) by smtp5.tech.numericable.fr (Postfix) with ESMTP id 30169124019 for ; Fri, 23 Apr 2010 17:03:21 +0200 (CEST) Received: from [2001:6f8:310:301::1] (helo=borg.bxl.tuxicoman.be) by ibiza.bxl.tuxicoman.be with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1O5KPU-0006eJ-Aj for linux-media@vger.kernel.org; Fri, 23 Apr 2010 17:03:21 +0200 Date: Fri, 23 Apr 2010 17:03:16 +0200 From: Guy Martin To: Linux Media Mailing List Subject: Xawtv sparc 64bit fix Message-ID: <20100423170316.12e01bfc@borg.bxl.tuxicoman.be> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.7; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 23 Apr 2010 15:03:30 +0000 (UTC) diff --git a/structs/struct-dump.c b/structs/struct-dump.c index 0ee7fc8..ba1dc6f 100644 --- a/structs/struct-dump.c +++ b/structs/struct-dump.c @@ -43,7 +43,9 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data, int16_t s16; uint8_t u8; int8_t s8; - int al = sizeof(long)-1; /* struct + union + 64bit alignment */ + struct al64_t { char c; uint64_t t; } al64_t; + int al = sizeof(long)-1; /* struct + union */ + int al64 = (unsigned)&al64_t.t - (unsigned)&al64_t.c - 1; /* 64 bit alignement */ void *p; unsigned int i,j,first; @@ -149,7 +151,7 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data, ptr += 4; break; case BITS64: - ptr = (void*)(((intptr_t)ptr + al) & ~al); + ptr = (void*)(((intptr_t)ptr + al64) & ~al64); u64 = *((uint64_t*)ptr); first = 1; fprintf(fp,"0x%" PRIx64 " [",u64); @@ -166,13 +168,13 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data, break; case UINT64: - ptr = (void*)(((intptr_t)ptr + al) & ~al); + ptr = (void*)(((intptr_t)ptr + al64) & ~al64); u64 = *((uint64_t*)ptr); fprintf(fp,"%" PRIu64,u64); ptr += 8; break; case SINT64: - ptr = (void*)(((intptr_t)ptr + al) & ~al); + ptr = (void*)(((intptr_t)ptr + al64) & ~al64); s64 = *((int64_t*)ptr); fprintf(fp,"%" PRId64,s64); ptr += 8;