From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2hPZ-0003AB-GU for qemu-devel@nongnu.org; Fri, 16 Apr 2010 05:00:29 -0400 Received: from [140.186.70.92] (port=35555 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2hPX-00039U-Io for qemu-devel@nongnu.org; Fri, 16 Apr 2010 05:00:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2hPV-0004Ea-RE for qemu-devel@nongnu.org; Fri, 16 Apr 2010 05:00:27 -0400 Received: from mail-gx0-f209.google.com ([209.85.217.209]:39624) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2hPV-0004EP-NU for qemu-devel@nongnu.org; Fri, 16 Apr 2010 05:00:25 -0400 Received: by gxk1 with SMTP id 1so1388370gxk.16 for ; Fri, 16 Apr 2010 02:00:25 -0700 (PDT) MIME-Version: 1.0 From: Jun Koi Date: Fri, 16 Apr 2010 18:00:04 +0900 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] dummy field in CPUTLBEntry? List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, I find the way we calculate the dummy field in CPUTLBEntry funny. What is the point of having: ((-sizeof(target_ulong) * 3) & (sizeof(unsigned long) - 1)) in its size? Why shouldnt it be more simple, like below? uint8_t dummy[(1 << CPU_TLB_ENTRY_BITS) - (sizeof(target_ulong) * 3 + sizeof(unsigned long))]; Thanks, J typedef struct CPUTLBEntry { /* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address bit TARGET_PAGE_BITS-1..4 : Nonzero for accesses that should not go directly to ram. bit 3 : indicates that the entry is invalid bit 2..0 : zero */ target_ulong addr_read; target_ulong addr_write; target_ulong addr_code; /* Addend to virtual address to get host address. IO accesses use the corresponding iotlb value. */ unsigned long addend; /* padding to get a power of two size */ uint8_t dummy[(1 << CPU_TLB_ENTRY_BITS) - (sizeof(target_ulong) * 3 + ((-sizeof(target_ulong) * 3) & (sizeof(unsigned long) - 1)) + sizeof(unsigned long))]; } CPUTLBEntry;