lkml.org 
[lkml]   [2007]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC v2] Documentation about unaligned memory access

On Nov 29 2007 12:04, Kyle McMartin wrote:
>
>For example, if you had 4GB of virtual memory, picture it as an
>array of bytes,
> u8 memory[4096 * (1024 * 1024)]; /* 4G bytes */

uint8_t memory[4096UL * 1024 * 1024];

>Aligned accesses would be accessing this array in this manner,
> u16 memory[(4096 * (1024 * 1024)) / sizeof(u16)] /* 2G bytes */
> u32 memory[(4096 * (1024 * 1024)) / sizeof(u32)] /* 1G bytes */
> u64 memory[(4096 * (1024 * 1024)) / sizeof(u64)] /* 512M bytes */

u64 memory[4096UL * 1024 * 1024 / sizeof(u64)] /* 4G too */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-11-29 19:03    [from the cache]
©2003-2011 Jasper Spaans