mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-15 09:36:24 +02:00
51 lines
1.4 KiB
Diff
51 lines
1.4 KiB
Diff
--- a/c/common/platform.h
|
|
+++ b/c/common/platform.h
|
|
@@ -318,19 +326,34 @@
|
|
#else /* not BROTLI_USE_PACKED_FOR_UNALIGNED */
|
|
|
|
static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) {
|
|
+#if defined(__mips__) && (!defined(__mips_isa_rev) || __mips_isa_rev < 6)
|
|
+ const struct { uint16_t x; } __attribute__((__packed__)) *t = p;
|
|
+ return t->x;
|
|
+#else
|
|
uint16_t t;
|
|
memcpy(&t, p, sizeof t);
|
|
return t;
|
|
+#endif
|
|
}
|
|
static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) {
|
|
+#if defined(__mips__) && (!defined(__mips_isa_rev) || __mips_isa_rev < 6)
|
|
+ const struct { uint32_t x; } __attribute__((__packed__)) *t = p;
|
|
+ return t->x;
|
|
+#else
|
|
uint32_t t;
|
|
memcpy(&t, p, sizeof t);
|
|
return t;
|
|
+#endif
|
|
}
|
|
static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
|
|
+#if defined(__mips__) && (!defined(__mips_isa_rev) || __mips_isa_rev < 6)
|
|
+ const struct { uint64_t x; } __attribute__((__packed__)) *t = p;
|
|
+ return t->x;
|
|
+#else
|
|
uint64_t t;
|
|
memcpy(&t, p, sizeof t);
|
|
return t;
|
|
+#endif
|
|
}
|
|
static BROTLI_INLINE size_t BrotliUnalignedReadSizeT(const void* p) {
|
|
size_t t;
|
|
@@ -338,7 +361,12 @@
|
|
return t;
|
|
}
|
|
static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
|
|
+#if defined(__mips__) && (!defined(__mips_isa_rev) || __mips_isa_rev < 6)
|
|
+ struct { uint64_t x; } __attribute__((__packed__)) *t = p;
|
|
+ t->x = v;
|
|
+#else
|
|
memcpy(p, &v, sizeof v);
|
|
+#endif
|
|
}
|
|
|
|
#endif /* BROTLI_USE_PACKED_FOR_UNALIGNED */
|