X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Funaligned.h;h=ead4629583d9eec3b270eb495aefb121ac248766;hp=d25e76f6d909fb1e61ccd507956d12e56896daff;hb=4a20aae0dd8469a352517a0b107416ffa99ccc55;hpb=c8ac9e0e82aa8b8e0487a3bd7f89720b5bdd1aea diff --git a/include/wimlib/unaligned.h b/include/wimlib/unaligned.h index d25e76f6..ead46295 100644 --- a/include/wimlib/unaligned.h +++ b/include/wimlib/unaligned.h @@ -1,13 +1,21 @@ /* - * unaligned.h + * unaligned.h - inline functions for unaligned memory accesses * - * Inline functions for unaligned memory accesses. + * The following copying information applies to this specific source code file: * - * Author: Eric Biggers - * Year: 2014, 2015 + * Written in 2014-2015 by Eric Biggers * - * The author dedicates this file to the public domain. - * You can do whatever you want with this file. + * To the extent possible under law, the author(s) have dedicated all copyright + * and related and neighboring rights to this software to the public domain + * worldwide via the Creative Commons Zero 1.0 Universal Public Domain + * Dedication (the "CC0"). + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the CC0 for more details. + * + * You should have received a copy of the CC0 along with this software; if not + * see . */ #ifndef _WIMLIB_UNALIGNED_H @@ -22,13 +30,13 @@ struct type##_unaligned { \ type v; \ } _packed_attribute; \ \ -static inline type \ +static forceinline type \ load_##type##_unaligned(const void *p) \ { \ return ((const struct type##_unaligned *)p)->v; \ } \ \ -static inline void \ +static forceinline void \ store_##type##_unaligned(type val, void *p) \ { \ ((struct type##_unaligned *)p)->v = val; \ @@ -49,7 +57,7 @@ DEFINE_UNALIGNED_TYPE(machine_word_t); #define load_word_unaligned load_machine_word_t_unaligned #define store_word_unaligned store_machine_word_t_unaligned -static inline u16 +static forceinline u16 get_unaligned_le16(const u8 *p) { if (UNALIGNED_ACCESS_IS_FAST) @@ -58,7 +66,7 @@ get_unaligned_le16(const u8 *p) return ((u16)p[1] << 8) | p[0]; } -static inline u32 +static forceinline u32 get_unaligned_le32(const u8 *p) { if (UNALIGNED_ACCESS_IS_FAST) @@ -68,7 +76,7 @@ get_unaligned_le32(const u8 *p) ((u32)p[1] << 8) | p[0]; } -static inline void +static forceinline void put_unaligned_le16(u16 v, u8 *p) { if (UNALIGNED_ACCESS_IS_FAST) { @@ -79,7 +87,7 @@ put_unaligned_le16(u16 v, u8 *p) } } -static inline void +static forceinline void put_unaligned_le32(u32 v, u8 *p) { if (UNALIGNED_ACCESS_IS_FAST) { @@ -98,7 +106,7 @@ put_unaligned_le32(u32 v, u8 *p) * bits contain the first 3 bytes, arranged in octets in a platform-dependent * order, at the memory location from which the input 32-bit value was loaded. */ -static inline u32 +static forceinline u32 loaded_u32_to_u24(u32 v) { if (CPU_IS_LITTLE_ENDIAN) @@ -113,7 +121,7 @@ loaded_u32_to_u24(u32 v) * in the 24 bits is platform-dependent. At least LOAD_U24_REQUIRED_NBYTES * bytes must be available at @p; note that this may be more than 3. */ -static inline u32 +static forceinline u32 load_u24_unaligned(const u8 *p) { #if UNALIGNED_ACCESS_IS_FAST