/** * These lines of codes were obtained from Debian package linux-kernel-headers * and adapted by Micha Lenk to meet the needs of * nictools-pci. The package linux-kernel-headers in turn obtained the sources * via BitKeeper from: bk://linux.bkbits.net/linux-2.5, and kernel.org mirrors * under the terms of the GPL license. */ #ifndef __UNALIGNED_H #define __UNALIGNED_H /** * get_unaligned - get value from possibly mis-aligned location * @ptr: pointer to value * * This macro should be used for accessing values larger in size than * single bytes at locations that are expected to be improperly aligned, * e.g. retrieving a u16 value from a location not u16-aligned. * * Note that unaligned accesses can be very expensive on some architectures. */ #define get_unaligned(ptr) (*(ptr)) /** * put_unaligned - put value to a possibly mis-aligned location * @val: value to place * @ptr: pointer to location * * This macro should be used for placing values larger in size than * single bytes at locations that are expected to be improperly aligned, * e.g. writing a u16 value to a location not u16-aligned. * * Note that unaligned accesses can be very expensive on some architectures. */ #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) #endif