Re: [RFC v2] Documentation about unaligned memory access

From: Jan Engelhardt
Date: Thu Nov 29 2007 - 13:01:09 EST



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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/