/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __VDSO_UNALIGNED_H
#define __VDSO_UNALIGNED_H

#include <linux/compiler_types.h>


#define __get_unaligned_t(type, ptr) ({					\
	type *__get_unaligned_ctrl_type __always_unused = NULL;		\
	__unqual_scalar_typeof(*__get_unaligned_ctrl_type) __get_unaligned_val; \
	__builtin_memcpy(&__get_unaligned_val, (void *)(ptr),		\
			 sizeof(__get_unaligned_val));			\
	__get_unaligned_val;						\
})


#define __put_unaligned_t(type, val, ptr) do {				\
	type __put_unaligned_val = (val);				\
	__builtin_memcpy((void *)(ptr), &__put_unaligned_val,		\
			 sizeof(__put_unaligned_val));			\
} while (0)

#endif 
