From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 1360C2F1FC for ; Tue, 26 Dec 2000 09:35:23 -0500 (EST) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id eBQEZMM18319 for axp-list@listman.redhat.com; Tue, 26 Dec 2000 09:35:22 -0500 Received: from oracle.clara.net (oracle.clara.net [195.8.69.94]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id eBQEZMD18311 for ; Tue, 26 Dec 2000 09:35:22 -0500 Received: from [195.8.79.9] (helo=tardis) by oracle.clara.net with esmtp (Exim 3.11 #5) id 14AvCC-000Cuu-00; Tue, 26 Dec 2000 14:35:20 +0000 Date: Tue, 26 Dec 2000 14:31:58 +0000 (GMT) From: Dave Gilbert X-Sender: gilbertd@tardis.home.dave To: axp-list@redhat.com Cc: debian-alpha@lists.debian.org Subject: byteswap.h: Un 64bit ism Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0beta4 Precedence: bulk Reply-To: axp-list@redhat.com List-Id: Linux and Red Hat on Alpha processors Hi, In /usr/include/bits/byteswap.h is the following macro: # define __bswap_64(x) \ (__extension__ \ ({ union { unsigned long long int __ll; \ unsigned long int __l[2]; } __v, __r; \ __v.__ll = (x); \ __r.__l[0] = __bswap_32 (__v.__l[1]); \ __r.__l[1] = __bswap_32 (__v.__l[0]); \ __r.__ll; })) It is supposed to do a byte swap on a 64 bit value by swapping the two 32 bit quantities and then byteswapping each of those. Unfortunatly you'll notice that the union uses a union of an unsigned long long and unsigned long int; both 64 bit on Alpha. I've changed this in my installation to : # define __bswap_64(x) \ (__extension__ \ ({ union { uint64_t __ll; \ uint32_t __l[2]; } __v, __r; \ __v.__ll = (x); \ __r.__l[0] = __bswap_32 (__v.__l[1]); \ __r.__l[1] = __bswap_32 (__v.__l[0]); \ __r.__ll; })) I found this while debugging the Xine DVD/MPEG/VCD player; which now does a passable attempt at playing a DVD on Linux/Alpha - although its dropping frames all over. I haven't got the 'Xv' video extension working so its doing everything in software. (That construct is in libac3/bswap.h in the xine distribution). Share & Enjoy, Dave -- ---------------- Have a happy GNU millennium! ---------------------- / Dr. David Alan Gilbert | Running GNU/Linux on | Happy \ \ gro.gilbert @ treblig.org | Alpha, x86, ARM and SPARC | In Hex / \ ___________________________|___ http://www.treblig.org |________/