[BACK]Return to unaligned.h CVS log [TXT][DIR] Up to [Development] / linux-2.6-xfs / include / asm-mips

File: [Development] / linux-2.6-xfs / include / asm-mips / unaligned.h (download)

Revision 1.4, Mon Dec 3 16:26:37 2007 UTC (9 years, 10 months ago) by lachlan.longdrop.melbourne.sgi.com
Branch: MAIN
Changes since 1.3: +21 -6 lines

Merge up to 2.6.24-rc3
Merge of 2.6.x-xfs-melb:linux:30183b by kenmcd.

/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
 */
#ifndef __ASM_GENERIC_UNALIGNED_H
#define __ASM_GENERIC_UNALIGNED_H

#include <linux/compiler.h>

#define get_unaligned(ptr)					\
({								\
	struct __packed {					\
		typeof(*(ptr)) __v;				\
	} *__p = (void *) (ptr);				\
	__p->__v;						\
})

#define put_unaligned(val, ptr)					\
do {								\
	struct __packed {					\
		typeof(*(ptr)) __v;				\
	} *__p = (void *) (ptr);				\
	__p->__v = (val);					\
} while(0)

#endif /* __ASM_GENERIC_UNALIGNED_H */